# HG changeset patch # User lucabe # Date 1194265510 0 # Node ID b1723b8da5958d0b0049362f202d2f4ea09a1c92 # Parent cc693f9e80ee16f1a6d47db5489d7cd8b449ed63 Do not send too many RTCP packets (according to RFC 3550, the minimum RTCP interval should be 5 seconds) diff -r cc693f9e80ee -r b1723b8da595 rtp.c --- a/rtp.c Mon Nov 05 10:15:20 2007 +0000 +++ b/rtp.c Mon Nov 05 12:25:10 2007 +0000 @@ -802,6 +802,7 @@ #endif if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE) s->first_rtcp_ntp_time = ntp_time; + s->last_rtcp_ntp_time = ntp_time; rtp_ts = av_rescale_q(ntp_time - s->first_rtcp_ntp_time, AV_TIME_BASE_Q, s1->streams[0]->time_base) + s->base_timestamp; put_byte(&s1->pb, (RTP_VERSION << 6)); @@ -984,7 +985,8 @@ /* XXX: mpeg pts hardcoded. RTCP send every 0.5 seconds */ rtcp_bytes = ((s->octet_count - s->last_octet_count) * RTCP_TX_RATIO_NUM) / RTCP_TX_RATIO_DEN; - if (s->first_packet || rtcp_bytes >= RTCP_SR_SIZE) { + if (s->first_packet || ((rtcp_bytes >= RTCP_SR_SIZE) && + (av_gettime() - s->last_rtcp_ntp_time > 5000000))) { rtcp_send_sr(s1, av_gettime()); s->last_octet_count = s->octet_count; s->first_packet = 0;