diff options
author | Luca Abeni <lucabe72@email.it> | 2007-11-05 12:25:10 +0000 |
---|---|---|
committer | Luca Abeni <lucabe72@email.it> | 2007-11-05 12:25:10 +0000 |
commit | 18c05a375ba81d435cbf89a8c9301ff30dccbcd5 (patch) | |
tree | d9ff0815ae6e338c0df9fce019f59227080ef39b | |
parent | 0aa7a2e6903d9fa9f1b39895bbf5c168dbac3fd8 (diff) | |
download | ffmpeg-18c05a375ba81d435cbf89a8c9301ff30dccbcd5.tar.gz |
Do not send too many RTCP packets (according to RFC 3550, the minimum
RTCP interval should be 5 seconds)
Originally committed as revision 10930 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/rtp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/rtp.c b/libavformat/rtp.c index 3aa7eec3ae..a5820d717d 100644 --- a/libavformat/rtp.c +++ b/libavformat/rtp.c @@ -802,6 +802,7 @@ static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time) #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 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt) /* 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; |