[FFmpeg-devel] RTCP question

Fred Rothganger frothga at sandia.gov
Fri Apr 25 01:05:17 CEST 2014


I am dealing with a use-case that may involve long pauses in streaming. 
Because of this, it may be useful to ensure that a fresh RTCP SR packet 
is sent when streaming restarts.

Here is a code fragment from rtpenc.c, round line 500:

     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) &&
                             (ff_ntp_time() - s->last_rtcp_ntp_time > 
5000000))) &&
         !(s->flags & FF_RTP_FLAG_SKIP_RTCP)) {
         rtcp_send_sr(s1, ff_ntp_time(), 0);
         s->last_octet_count = s->octet_count;
         s->first_packet = 0;
     }

Notice the AND between the byte-ratio and time-elapsed conditions. Would 
it make more sense to make this an OR? IE: shouldn't we send a fresh SR 
message if *either* condition were true, as opposed to both 
simultaneously? As written, there could be a pause for 10 minutes, but 
if not enough bytes have been sent yet, it may be several packets before 
a fresh SR message is sent.

Am I missing something here? I suppose the intention is that if the 
overall bandwidth use is very low, then don't fill it up with SR 
messages. I would argue that in that case, you won't add much to 
bandwidth usage anyway.



More information about the ffmpeg-devel mailing list