Commit 8b9537f7 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

More boundary cleanup

parent 4db2dc94
...@@ -524,12 +524,6 @@ static void Close( vlc_object_t * p_this ) ...@@ -524,12 +524,6 @@ static void Close( vlc_object_t * p_this )
if( p_sys->p_httpd_host ) if( p_sys->p_httpd_host )
httpd_HostDelete( p_sys->p_httpd_host ); httpd_HostDelete( p_sys->p_httpd_host );
if( p_sys->p_rtsp_url )
httpd_UrlDelete( p_sys->p_rtsp_url );
if( p_sys->p_rtsp_host )
httpd_HostDelete( p_sys->p_rtsp_host );
if( p_sys->psz_session_name ) if( p_sys->psz_session_name )
free( p_sys->psz_session_name ); free( p_sys->psz_session_name );
...@@ -882,9 +876,10 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -882,9 +876,10 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
id->psz_destination = p_sys->psz_destination ? strdup( p_sys->psz_destination ) : NULL; id->psz_destination = p_sys->psz_destination ? strdup( p_sys->psz_destination ) : NULL;
id->i_port = i_port; id->i_port = i_port;
id->p_rtsp_url = NULL; id->p_rtsp_url = NULL;
vlc_mutex_init( p_stream, &id->lock_rtsp );
id->i_rtsp_access = 0; vlc_mutex_init( p_stream, &id->lock_sink );
id->rtsp_access = NULL; id->i_sink = 0;
id->sink = NULL;
switch( p_fmt->i_codec ) switch( p_fmt->i_codec )
{ {
...@@ -1111,7 +1106,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -1111,7 +1106,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
msg_Dbg( p_stream, "maximum RTP packet size: %d bytes", id->i_mtu ); msg_Dbg( p_stream, "maximum RTP packet size: %d bytes", id->i_mtu );
if( p_sys->p_rtsp_url ) if( p_sys->p_rtsp_url )
RtspSetupId( p_stream, id ); RtspAddId( p_stream, id );
/* Update p_sys context */ /* Update p_sys context */
vlc_mutex_lock( &p_sys->lock_es ); vlc_mutex_lock( &p_sys->lock_es );
...@@ -1172,11 +1167,10 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id ) ...@@ -1172,11 +1167,10 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
sout_MuxDeleteStream( p_sys->p_mux, id->p_input ); sout_MuxDeleteStream( p_sys->p_mux, id->p_input );
} }
if( id->p_rtsp_url ) if( id->p_rtsp_url )
{ RtspDelId( p_stream, id );
httpd_UrlDelete( id->p_rtsp_url );
} vlc_mutex_destroy( &id->lock_sink );
vlc_mutex_destroy( &id->lock_rtsp ); free( id->sink );
if( id->rtsp_access ) free( id->rtsp_access );
/* Update SDP (sap/file) */ /* Update SDP (sap/file) */
if( p_sys->b_export_sap && !p_sys->p_mux ) SapSetup( p_stream ); if( p_sys->b_export_sap && !p_sys->p_mux ) SapSetup( p_stream );
...@@ -1427,12 +1421,12 @@ static void rtp_packetize_common( sout_stream_id_t *id, block_t *out, ...@@ -1427,12 +1421,12 @@ static void rtp_packetize_common( sout_stream_id_t *id, block_t *out,
static void rtp_packetize_send( sout_stream_id_t *id, block_t *out ) static void rtp_packetize_send( sout_stream_id_t *id, block_t *out )
{ {
int i; int i;
vlc_mutex_lock( &id->lock_rtsp ); vlc_mutex_lock( &id->lock_sink );
for( i = 0; i < id->i_rtsp_access; i++ ) for( i = 0; i < id->i_sink; i++ )
{ {
sout_AccessOutWrite( id->rtsp_access[i], block_Duplicate( out ) ); sout_AccessOutWrite( id->sink[i], block_Duplicate( out ) );
} }
vlc_mutex_unlock( &id->lock_rtsp ); vlc_mutex_unlock( &id->lock_sink );
if( id->p_access ) if( id->p_access )
{ {
...@@ -1446,16 +1440,16 @@ static void rtp_packetize_send( sout_stream_id_t *id, block_t *out ) ...@@ -1446,16 +1440,16 @@ 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 ) int rtp_add_sink( sout_stream_id_t *id, sout_access_out_t *access )
{ {
vlc_mutex_lock( &id->lock_rtsp ); vlc_mutex_lock( &id->lock_sink );
TAB_APPEND( id->i_rtsp_access, id->rtsp_access, access ); TAB_APPEND( id->i_sink, id->sink, access );
vlc_mutex_unlock( &id->lock_rtsp ); vlc_mutex_unlock( &id->lock_sink );
} }
void rtp_del_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 )
{ {
vlc_mutex_lock( &id->lock_rtsp ); vlc_mutex_lock( &id->lock_sink );
TAB_REMOVE( id->i_rtsp_access, id->rtsp_access, access ); TAB_REMOVE( id->i_sink, id->sink, access );
vlc_mutex_unlock( &id->lock_rtsp ); vlc_mutex_unlock( &id->lock_sink );
} }
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,
......
...@@ -25,8 +25,9 @@ ...@@ -25,8 +25,9 @@
typedef struct rtsp_client_t rtsp_client_t; typedef struct rtsp_client_t rtsp_client_t;
int RtspSetup( sout_stream_t *p_stream, const vlc_url_t *url ); int RtspSetup( sout_stream_t *p_stream, const vlc_url_t *url );
int RtspSetupId( sout_stream_t *p_stream, sout_stream_id_t *id );
void RtspUnsetup( sout_stream_t *p_stream ); void RtspUnsetup( sout_stream_t *p_stream );
int RtspAddId( sout_stream_t *p_stream, sout_stream_id_t *id );
void RtspDelId( sout_stream_t *p_stream, sout_stream_id_t *id );
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 );
...@@ -62,9 +63,9 @@ struct sout_stream_id_t ...@@ -62,9 +63,9 @@ struct sout_stream_id_t
/* for sending the packets */ /* for sending the packets */
sout_access_out_t *p_access; sout_access_out_t *p_access;
vlc_mutex_t lock_rtsp; vlc_mutex_t lock_sink;
int i_rtsp_access; int i_sink;
sout_access_out_t **rtsp_access; sout_access_out_t **sink;
/* */ /* */
sout_input_t *p_input; sout_input_t *p_input;
......
...@@ -89,7 +89,21 @@ int RtspSetup( sout_stream_t *p_stream, const vlc_url_t *url ) ...@@ -89,7 +89,21 @@ int RtspSetup( sout_stream_t *p_stream, const vlc_url_t *url )
} }
int RtspSetupId( sout_stream_t *p_stream, sout_stream_id_t *id ) void RtspUnsetup( sout_stream_t *p_stream )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
while( p_sys->i_rtsp > 0 )
RtspClientDel( p_stream, p_sys->rtsp[0] );
if( p_sys->p_rtsp_url )
httpd_UrlDelete( p_sys->p_rtsp_url );
if( p_sys->p_rtsp_host )
httpd_HostDelete( p_sys->p_rtsp_host );
}
int RtspAddId( sout_stream_t *p_stream, sout_stream_id_t *id )
{ {
sout_stream_sys_t *p_sys = p_stream->p_sys; sout_stream_sys_t *p_sys = p_stream->p_sys;
char psz_urlc[strlen( p_sys->psz_rtsp_control ) + 1 + 10]; char psz_urlc[strlen( p_sys->psz_rtsp_control ) + 1 + 10];
...@@ -111,11 +125,9 @@ int RtspSetupId( sout_stream_t *p_stream, sout_stream_id_t *id ) ...@@ -111,11 +125,9 @@ int RtspSetupId( sout_stream_t *p_stream, sout_stream_id_t *id )
} }
void RtspUnsetup( sout_stream_t *p_stream ) void RtspDelId( sout_stream_t *p_stream, sout_stream_id_t *id )
{ {
sout_stream_sys_t *p_sys = p_stream->p_sys; httpd_UrlDelete( id->p_rtsp_url );
while( p_sys->i_rtsp > 0 )
RtspClientDel( p_stream, p_sys->rtsp[0] );
} }
......
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