From 7db321932152dd21ac21c1d1d8141bfb6c13d8e4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Thu, 23 Aug 2007 17:44:50 +0000 Subject: [PATCH] - Loosen dependency of RTSP code on stream ID - Do not refer to bogus TTL values --- modules/stream_out/rtp.c | 18 ++++++++++++++++-- modules/stream_out/rtp.h | 3 +++ modules/stream_out/rtsp.c | 20 ++++++++------------ 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c index e058e4020a..297c019164 100644 --- a/modules/stream_out/rtp.c +++ b/modules/stream_out/rtp.c @@ -399,7 +399,7 @@ static int Open( vlc_object_t *p_this ) o= - should be local username (no spaces allowed) o= time should be hashed with some other value to garantee uniqueness o= don't use the localhost address. use fully qualified domain name or IP4 address - a= source-filter: we need our source address + a= source-filter: we need our source address a= x-plgroup: (missing) RTP packets need to get the correct src IP address */ if( ipv == '4' @@ -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]; /* 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}", p_sys->i_ttl ); @@ -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, block_t *in ) { diff --git a/modules/stream_out/rtp.h b/modules/stream_out/rtp.h index e59d3fc4c4..f136838f00 100644 --- a/modules/stream_out/rtp.h +++ b/modules/stream_out/rtp.h @@ -34,6 +34,9 @@ void RtspClientDel( sout_stream_t *, rtsp_client_t * ); char *SDPGenerate( const sout_stream_t *p_stream, 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 *, block_t * ); diff --git a/modules/stream_out/rtsp.c b/modules/stream_out/rtsp.c index 6427f8dae8..9e3b87616d 100644 --- a/modules/stream_out/rtsp.c +++ b/modules/stream_out/rtsp.c @@ -213,9 +213,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args, } if( i >= p_sys->i_es ) continue; - vlc_mutex_lock( &id->lock_rtsp ); - TAB_APPEND( id->i_rtsp_access, id->rtsp_access, rtsp->access[i_id] ); - vlc_mutex_unlock( &id->lock_rtsp ); + rtp_add_sink( id, rtsp->access[i_id] ); } vlc_mutex_unlock( &p_sys->lock_es ); } @@ -253,9 +251,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args, } if( i >= p_sys->i_es ) continue; - vlc_mutex_lock( &id->lock_rtsp ); - TAB_REMOVE( id->i_rtsp_access, id->rtsp_access, rtsp->access[i_id] ); - vlc_mutex_unlock( &id->lock_rtsp ); + rtp_del_sink( id, rtsp->access[i_id] ); } vlc_mutex_unlock( &p_sys->lock_es ); @@ -309,11 +305,11 @@ static inline const char *parameter_next( const char *str ) /** Non-aggregate RTSP callback */ /*static*/ int RtspCallbackId( httpd_callback_sys_t *p_args, - httpd_client_t *cl, - httpd_message_t *answer, httpd_message_t *query ) + httpd_client_t *cl, + httpd_message_t *answer, httpd_message_t *query ) { 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; char psz_session_init[21]; const char *psz_session; @@ -418,7 +414,7 @@ static inline const char *parameter_next( const char *str ) if( b_multicast ) { - if( id->psz_destination == NULL ) + if( p_sys->psz_destination == NULL ) continue; answer->i_status = 200; @@ -426,7 +422,7 @@ static inline const char *parameter_next( const char *str ) httpd_MsgAdd( answer, "Transport", "RTP/AVP/UDP;destination=%s;port=%d-%d;" "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 ); } else @@ -462,7 +458,7 @@ static inline const char *parameter_next( const char *str ) continue; } - if( p_sys->i_ttl ) + if( p_sys->i_ttl > 0 ) snprintf( psz_access, sizeof( psz_access ), "udp{raw,rtcp,ttl=%d}", p_sys->i_ttl ); else -- 2.39.5