Commit fa41328c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

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).
parent 069a7cde
......@@ -39,6 +39,7 @@
#include <vlc_network.h>
#include <vlc_charset.h>
#include <vlc_strings.h>
#include <vlc_rand.h>
#include <srtp.h>
#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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment