[FFmpeg-devel] Correctly fill the SSRC field in RTP packets
Tue Mar 25 15:18:35 CET 2008
Reimar D?ffinger wrote:
>> 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 this way, a user would have to fill the field with a proper value,
right? I do not like this idea too much, because I believe a user does
not want to cope with the details of SSRC and similar stuff, but the
library should select a reasonable value.
>>> 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 am not going to propose to use random values (in fact, I do not use
random() in my patch :), but I suspect the point of using random is that
if the random numbers generator is good enough the probability to have
unique SSRCs is very high.
My patch does not ensure uniqueness either, but it ensures that the SSRC
is unique inside a session (which is the reasonable thing to guarantee,
in my opinion).
More information about the ffmpeg-devel