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

- Loosen dependency of RTSP code on stream ID

- Do not refer to bogus TTL values
parent 317ce5cf
...@@ -849,7 +849,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -849,7 +849,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
char url[NI_MAXHOST + 8]; char url[NI_MAXHOST + 8];
/* first try to create the access out */ /* first try to create the access out */
if( p_sys->i_ttl ) if( p_sys->i_ttl > 0 )
{ {
snprintf( access, sizeof( access ), "udp{raw,rtcp,ttl=%d}", snprintf( access, sizeof( access ), "udp{raw,rtcp,ttl=%d}",
p_sys->i_ttl ); p_sys->i_ttl );
...@@ -1461,6 +1461,20 @@ static void rtp_packetize_send( sout_stream_id_t *id, block_t *out ) ...@@ -1461,6 +1461,20 @@ static void rtp_packetize_send( sout_stream_id_t *id, block_t *out )
} }
} }
int rtp_add_sink( sout_stream_id_t *id, sout_access_out_t *access )
{
vlc_mutex_lock( &id->lock_rtsp );
TAB_APPEND( id->i_rtsp_access, id->rtsp_access, access );
vlc_mutex_unlock( &id->lock_rtsp );
}
void rtp_del_sink( sout_stream_id_t *id, sout_access_out_t *access )
{
vlc_mutex_lock( &id->lock_rtsp );
TAB_REMOVE( id->i_rtsp_access, id->rtsp_access, access );
vlc_mutex_unlock( &id->lock_rtsp );
}
static int rtp_packetize_mpa( sout_stream_t *p_stream, sout_stream_id_t *id, static int rtp_packetize_mpa( sout_stream_t *p_stream, sout_stream_id_t *id,
block_t *in ) block_t *in )
{ {
......
...@@ -34,6 +34,9 @@ void RtspClientDel( sout_stream_t *, rtsp_client_t * ); ...@@ -34,6 +34,9 @@ void RtspClientDel( sout_stream_t *, rtsp_client_t * );
char *SDPGenerate( const sout_stream_t *p_stream, char *SDPGenerate( const sout_stream_t *p_stream,
const char *psz_destination, vlc_bool_t b_rtsp ); const char *psz_destination, vlc_bool_t b_rtsp );
int rtp_add_sink( sout_stream_id_t *id, sout_access_out_t *access );
void rtp_del_sink( sout_stream_id_t *id, sout_access_out_t *access );
typedef int (*pf_rtp_packetizer_t)( sout_stream_t *, sout_stream_id_t *, typedef int (*pf_rtp_packetizer_t)( sout_stream_t *, sout_stream_id_t *,
block_t * ); block_t * );
......
...@@ -213,9 +213,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args, ...@@ -213,9 +213,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args,
} }
if( i >= p_sys->i_es ) continue; if( i >= p_sys->i_es ) continue;
vlc_mutex_lock( &id->lock_rtsp ); rtp_add_sink( id, rtsp->access[i_id] );
TAB_APPEND( id->i_rtsp_access, id->rtsp_access, rtsp->access[i_id] );
vlc_mutex_unlock( &id->lock_rtsp );
} }
vlc_mutex_unlock( &p_sys->lock_es ); vlc_mutex_unlock( &p_sys->lock_es );
} }
...@@ -253,9 +251,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args, ...@@ -253,9 +251,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args,
} }
if( i >= p_sys->i_es ) continue; if( i >= p_sys->i_es ) continue;
vlc_mutex_lock( &id->lock_rtsp ); rtp_del_sink( id, rtsp->access[i_id] );
TAB_REMOVE( id->i_rtsp_access, id->rtsp_access, rtsp->access[i_id] );
vlc_mutex_unlock( &id->lock_rtsp );
} }
vlc_mutex_unlock( &p_sys->lock_es ); vlc_mutex_unlock( &p_sys->lock_es );
...@@ -313,7 +309,7 @@ static inline const char *parameter_next( const char *str ) ...@@ -313,7 +309,7 @@ static inline const char *parameter_next( const char *str )
httpd_message_t *answer, httpd_message_t *query ) httpd_message_t *answer, httpd_message_t *query )
{ {
sout_stream_id_t *id = (sout_stream_id_t*)p_args; sout_stream_id_t *id = (sout_stream_id_t*)p_args;
sout_stream_t *p_stream = id->p_stream; sout_stream_t *p_stream = idd->p_stream;
sout_stream_sys_t *p_sys = p_stream->p_sys; sout_stream_sys_t *p_sys = p_stream->p_sys;
char psz_session_init[21]; char psz_session_init[21];
const char *psz_session; const char *psz_session;
...@@ -418,7 +414,7 @@ static inline const char *parameter_next( const char *str ) ...@@ -418,7 +414,7 @@ static inline const char *parameter_next( const char *str )
if( b_multicast ) if( b_multicast )
{ {
if( id->psz_destination == NULL ) if( p_sys->psz_destination == NULL )
continue; continue;
answer->i_status = 200; answer->i_status = 200;
...@@ -426,7 +422,7 @@ static inline const char *parameter_next( const char *str ) ...@@ -426,7 +422,7 @@ static inline const char *parameter_next( const char *str )
httpd_MsgAdd( answer, "Transport", httpd_MsgAdd( answer, "Transport",
"RTP/AVP/UDP;destination=%s;port=%d-%d;" "RTP/AVP/UDP;destination=%s;port=%d-%d;"
"ttl=%d;mode=play", "ttl=%d;mode=play",
id->psz_destination, id->i_port, id->i_port+1, p_sys->psz_destination, idd->i_port, idd->i_port+1,
( p_sys->i_ttl > 0 ) ? p_sys->i_ttl : 1 ); ( p_sys->i_ttl > 0 ) ? p_sys->i_ttl : 1 );
} }
else else
...@@ -462,7 +458,7 @@ static inline const char *parameter_next( const char *str ) ...@@ -462,7 +458,7 @@ static inline const char *parameter_next( const char *str )
continue; continue;
} }
if( p_sys->i_ttl ) if( p_sys->i_ttl > 0 )
snprintf( psz_access, sizeof( psz_access ), snprintf( psz_access, sizeof( psz_access ),
"udp{raw,rtcp,ttl=%d}", p_sys->i_ttl ); "udp{raw,rtcp,ttl=%d}", p_sys->i_ttl );
else else
......
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