[FFmpeg-devel] Correctly fill the SSRC field in RTP packets

Reimar Döffinger Reimar.Doeffinger
Tue Mar 25 14:52:08 CET 2008


On Tue, Mar 25, 2008 at 02:29:16PM +0100, Luca Abeni wrote:
> Luca Barbato wrote:
> [...]
> >> The attached patch fills the SSRC field using the address
> >> of the AVFormatContext, so that different streams in the
> >> same session will have different SSRCs.
> > 
> > Would be better using the mersenne twister for the first and then 
> > increment it.

What is the point of using a random number anyway though?

> I think this would require some kind of "global context" (shared
> between all the AVFormatContexts) for the counter, right? Wouldn't
> this break multithreaded applications?

I think it might be better to have a kind of "muxer user data" field in
AVFormatContext and use that to set all this kind of stuff, or at least
something like that...

> > In feng we use a strong random for most of the random 
> > filled fields to make even the most paranoid happy ^^;
> I see that libavformat used to fill some fields (including SSRC)
> with random(), but that was changed to 0 for some reason. So, I
> am not sure if introducing random values again would be welcome
> or not.

If it really was random, that was bad because it modifies global state,
and a library should not do that. Also (being pedantic) a random number
in no way guarantees uniqueness, I still consider this a misuse of
random numbers.

Greetings,
Reimar D?ffinger




More information about the ffmpeg-devel mailing list