[FFmpeg-user] Query about dealing with duplicate multicast packets

Moritz Barsnick barsnick at gmx.net
Sat Apr 2 15:42:45 CEST 2016

Hi Ben,

On Sat, Apr 02, 2016 at 00:22:22 +0100, Ben Barker wrote:
> Obviously the "correct" solution is to fix the network, but this can take
> some time whilst the problem is identified.

Indeed. :)

> http://ffmpeg.org/doxygen/3.0/rtpdec_8c_source.html
> In particular on line 246

You mean this line, right? (link trying to avoid quoting line numbers
which might change over time):

> It seemed that setting the return value on this line to -1 might accomplish
> what I was aiming for - but whilst it compiled, the effect was not obvious,
> so I must be missing something.

You misinterpreted how that function is used. The comment above it
hints that it is boolean, i.e. zero or one. Indeed, there is only one
usage in ffmpeg:

Returning -1 would have the same effect as returning 1: The packet
would be handled. Your intent would probably have been to return 0
instead of the "default" 1 in the code right below. Thereby you
probably didn't actually change the behavior.

> Is it correct to say that if the sequence numbers are identical,
> "s->queue->seq - s->seq - 1" will be negative, which for an unsigned int
> displays as a high number - hence the very high displayed values?

>          av_log(s->st ? s->st->codec : NULL, AV_LOG_WARNING,
>                 "RTP: missed %d packets\n", s->queue->seq - s->seq - 1);

Indeed. What value was printed? UINT32_MAX = 4294967295?

> Can anyone offer any advice on whether my understanding of why duplicates
> cause the missed RTP figures to be so high is correct - and also if there
> is a way to simply skip duplicates when they occur - so far my attempts
> haven't worked!

>From what I understand in the code, your intent is correct. That empty
case for dupicated packets shouldn't be doing nothing (thereby
returning 1). Do try to fix it as I suggested, and tell us whether that


More information about the ffmpeg-user mailing list