From: RĂ©mi Denis-Courmont Date: Wed, 3 Dec 2008 19:53:12 +0000 (+0200) Subject: RTP sout: pick truly random ISN and SSRC X-Git-Tag: 1.0.0-pre1~1950 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=fa41328c4cab8a08ce8fe934f6212afed2fc24cc;p=vlc RTP sout: pick truly random ISN and SSRC We were always picking the same values. This is pretty bad as it breaks fast resynchronization (and is totally lame anyway). --- diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c index 119d15398c..30b34aabed 100644 --- a/modules/stream_out/rtp.c +++ b/modules/stream_out/rtp.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include "rtp.h" @@ -890,17 +891,14 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) id->p_stream = p_stream; - id->i_sequence = rand()&0xffff; /* Look for free dymanic payload type */ id->i_payload_type = 96; while (p_sys->payload_bitmap & (1 << (id->i_payload_type - 96))) id->i_payload_type++; assert (id->i_payload_type < 128); - id->ssrc[0] = rand()&0xff; - id->ssrc[1] = rand()&0xff; - id->ssrc[2] = rand()&0xff; - id->ssrc[3] = rand()&0xff; + vlc_rand_bytes (&id->i_sequence, sizeof (id->i_sequence)); + vlc_rand_bytes (id->ssrc, sizeof (id->ssrc)); id->psz_enc = NULL; id->psz_fmtp = NULL;