Commit 15b6bc54 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

RTP out: use clz

parent 3c6a0755
......@@ -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 );
......
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