Commit 2b37a6fe authored by Sébastien Escudier's avatar Sébastien Escudier

rtp : safety check.

There was a small window of opportunity between RtspSetup and RtspAddId where this can happen.
(cherry picked from commit b445a6a9)
Signed-off-by: default avatarSébastien Escudier <sebastien-devel@celeos.eu>
parent 97a42c15
...@@ -680,9 +680,12 @@ static void SDPHandleUrl( sout_stream_t *p_stream, const char *psz_url ) ...@@ -680,9 +680,12 @@ static void SDPHandleUrl( sout_stream_t *p_stream, const char *psz_url )
if( p_sys->p_mux != NULL ) if( p_sys->p_mux != NULL )
{ {
sout_stream_id_t *id = p_sys->es[0]; sout_stream_id_t *id = p_sys->es[0];
id->rtsp_id = RtspAddId( p_sys->rtsp, id, GetDWBE( id->ssrc ), rtsp_stream_id_t *rtsp_id = RtspAddId( p_sys->rtsp, id, GetDWBE( id->ssrc ),
p_sys->psz_destination, p_sys->i_ttl, p_sys->psz_destination, p_sys->i_ttl,
id->i_port, id->i_port + 1 ); id->i_port, id->i_port + 1 );
vlc_mutex_lock( &p_sys->lock_es );
id->rtsp_id = rtsp_id;
vlc_mutex_unlock( &p_sys->lock_es );
} }
} }
else if( ( url.psz_protocol && !strcasecmp( url.psz_protocol, "sap" ) ) || else if( ( url.psz_protocol && !strcasecmp( url.psz_protocol, "sap" ) ) ||
...@@ -742,7 +745,7 @@ char *SDPGenerate( sout_stream_t *p_stream, const char *rtsp_url ) ...@@ -742,7 +745,7 @@ char *SDPGenerate( sout_stream_t *p_stream, const char *rtsp_url )
int inclport; int inclport;
vlc_mutex_lock( &p_sys->lock_es ); vlc_mutex_lock( &p_sys->lock_es );
if( unlikely(p_sys->i_es == 0) ) if( unlikely(p_sys->i_es == 0 || (rtsp_url != NULL && !p_sys->es[0]->rtsp_id)) )
goto out; /* hmm... */ goto out; /* hmm... */
if( p_sys->psz_destination != NULL ) if( p_sys->psz_destination != 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