[vlc-devel] commit: RTP out: use clz ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Feb 7 10:41:55 CET 2010
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 7 11:40:12 2010 +0200| [15b6bc540ddc74f977f37abacede550c0380df6a] | committer: Rémi Denis-Courmont
RTP out: use clz
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=15b6bc540ddc74f977f37abacede550c0380df6a
---
modules/stream_out/rtp.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index b19c02b..3091049 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -473,7 +473,7 @@ static int Open( vlc_object_t *p_this )
p_sys->i_npt_zero = VLC_TS_INVALID;
p_sys->i_pts_zero = mdate(); /* arbitrary value, could probably be
* random */
- p_sys->payload_bitmap = 0;
+ p_sys->payload_bitmap = 0xFFFFFFFF;
p_sys->i_es = 0;
p_sys->es = NULL;
p_sys->rtsp = NULL;
@@ -908,7 +908,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
sout_stream_id_t *id;
char *psz_sdp;
- if (0xffffffff == p_sys->payload_bitmap)
+ if (0 == p_sys->payload_bitmap)
{
msg_Err (p_stream, "too many RTP elementary streams");
return NULL;
@@ -952,9 +952,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
id->p_stream = p_stream;
/* 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++;
+ id->i_payload_type = 96 + clz32 (p_sys->payload_bitmap);
assert (id->i_payload_type < 128);
vlc_rand_bytes (&id->i_sequence, sizeof (id->i_sequence));
@@ -1325,7 +1323,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
}
if (id->i_payload_type >= 96)
/* Mark dynamic payload type in use */
- p_sys->payload_bitmap |= 1 << (id->i_payload_type - 96);
+ p_sys->payload_bitmap &= ~(1 << (127 - id->i_payload_type));
#if 0 /* No payload formats sets this at the moment */
int cscov = -1;
@@ -1394,7 +1392,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
/* Release dynamic payload type */
if (id->i_payload_type >= 96)
- p_sys->payload_bitmap &= ~(1 << (id->i_payload_type - 96));
+ p_sys->payload_bitmap |= 1 << (127 - id->i_payload_type);
free( id->psz_fmtp );
More information about the vlc-devel
mailing list