[vlc-devel] commit: RTP sout: pick truly random ISN and SSRC ( Rémi Denis-Courmont )
git version control
git at videolan.org
Wed Dec 3 21:21:18 CET 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Wed Dec 3 21:53:12 2008 +0200| [fa41328c4cab8a08ce8fe934f6212afed2fc24cc] | committer: 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).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fa41328c4cab8a08ce8fe934f6212afed2fc24cc
---
modules/stream_out/rtp.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index 119d153..30b34aa 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -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;
More information about the vlc-devel
mailing list