Commit 5574f54d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

SAP announce: rewrite, use one thread per SAP group (fixes #1839)

parent 4129590e
...@@ -263,8 +263,6 @@ typedef struct sout_stream_t sout_stream_t; ...@@ -263,8 +263,6 @@ typedef struct sout_stream_t sout_stream_t;
typedef struct sout_stream_sys_t sout_stream_sys_t; typedef struct sout_stream_sys_t sout_stream_sys_t;
typedef struct config_chain_t config_chain_t; typedef struct config_chain_t config_chain_t;
typedef struct sap_session_t sap_session_t;
typedef struct sap_address_t sap_address_t;
typedef struct session_descriptor_t session_descriptor_t; typedef struct session_descriptor_t session_descriptor_t;
typedef struct announce_method_t announce_method_t; typedef struct announce_method_t announce_method_t;
typedef struct announce_handler_t announce_handler_t; typedef struct announce_handler_t announce_handler_t;
......
...@@ -1832,8 +1832,7 @@ vlc_module_begin(); ...@@ -1832,8 +1832,7 @@ vlc_module_begin();
PACKETIZER_TEXT, PACKETIZER_LONGTEXT, true ); PACKETIZER_TEXT, PACKETIZER_LONGTEXT, true );
set_subcategory( SUBCAT_SOUT_SAP ); set_subcategory( SUBCAT_SOUT_SAP );
add_bool( "sap-flow-control", false, NULL, ANN_SAPCTRL_TEXT, add_obsolete_bool( "sap-flow-control" );
ANN_SAPCTRL_LONGTEXT, true );
add_integer( "sap-interval", 5, NULL, ANN_SAPINTV_TEXT, add_integer( "sap-interval", 5, NULL, ANN_SAPINTV_TEXT,
ANN_SAPINTV_LONGTEXT, true ); ANN_SAPINTV_LONGTEXT, true );
......
...@@ -176,10 +176,7 @@ static announce_handler_t *announce_HandlerCreate( vlc_object_t *p_this ) ...@@ -176,10 +176,7 @@ static announce_handler_t *announce_HandlerCreate( vlc_object_t *p_this )
int announce_HandlerDestroy( announce_handler_t *p_announce ) int announce_HandlerDestroy( announce_handler_t *p_announce )
{ {
if( p_announce->p_sap ) if( p_announce->p_sap )
{ SAP_Destroy( p_announce->p_sap );
/* Exit the SAP */
vlc_object_release( p_announce->p_sap );
}
/* Free the structure */ /* Free the structure */
vlc_object_release( p_announce ); vlc_object_release( p_announce );
...@@ -201,7 +198,7 @@ static int announce_Register( announce_handler_t *p_announce, ...@@ -201,7 +198,7 @@ static int announce_Register( announce_handler_t *p_announce,
/* Do we already have a SAP announce handler ? */ /* Do we already have a SAP announce handler ? */
if( !p_announce->p_sap ) if( !p_announce->p_sap )
{ {
sap_handler_t *p_sap = announce_SAPHandlerCreate( p_announce ); sap_handler_t *p_sap = SAP_Create (VLC_OBJECT(p_announce));
msg_Dbg( p_announce, "creating SAP announce handler"); msg_Dbg( p_announce, "creating SAP announce handler");
if( !p_sap ) if( !p_sap )
{ {
...@@ -212,7 +209,7 @@ static int announce_Register( announce_handler_t *p_announce, ...@@ -212,7 +209,7 @@ static int announce_Register( announce_handler_t *p_announce,
} }
/* this will set p_session->p_sap for later deletion */ /* this will set p_session->p_sap for later deletion */
msg_Dbg( p_announce, "adding SAP session"); msg_Dbg( p_announce, "adding SAP session");
p_announce->p_sap->pf_add( p_announce->p_sap, p_session ); SAP_Add( p_announce->p_sap, p_session );
} }
else else
{ {
...@@ -228,7 +225,6 @@ static int announce_UnRegister( announce_handler_t *p_announce, ...@@ -228,7 +225,6 @@ static int announce_UnRegister( announce_handler_t *p_announce,
session_descriptor_t *p_session ) session_descriptor_t *p_session )
{ {
msg_Dbg( p_announce, "unregistering announce" ); msg_Dbg( p_announce, "unregistering announce" );
if( p_announce->p_sap ) SAP_Del( p_announce->p_sap, p_session );
p_announce->p_sap->pf_del( p_announce->p_sap, p_session );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
This diff is collapsed.
...@@ -47,36 +47,15 @@ struct sout_packetizer_input_t ...@@ -47,36 +47,15 @@ struct sout_packetizer_input_t
}; };
#define sout_NewInstance(a,b) __sout_NewInstance(VLC_OBJECT(a),b) #define sout_NewInstance(a,b) __sout_NewInstance(VLC_OBJECT(a),b)
VLC_EXPORT( sout_instance_t *, __sout_NewInstance, ( vlc_object_t *, const char * ) ); sout_instance_t * __sout_NewInstance( vlc_object_t *, const char * );
VLC_EXPORT( void, sout_DeleteInstance, ( sout_instance_t * ) ); void sout_DeleteInstance( sout_instance_t * );
VLC_EXPORT( sout_packetizer_input_t *, sout_InputNew,( sout_instance_t *, es_format_t * ) ); sout_packetizer_input_t *sout_InputNew( sout_instance_t *, es_format_t * );
VLC_EXPORT( int, sout_InputDelete, ( sout_packetizer_input_t * ) ); int sout_InputDelete( sout_packetizer_input_t * );
VLC_EXPORT( int, sout_InputSendBuffer, ( sout_packetizer_input_t *, block_t* ) ); int sout_InputSendBuffer( sout_packetizer_input_t *, block_t* );
/* Announce system */ /* Announce system */
/* The SAP handler, running in a separate thread */
struct sap_handler_t
{
VLC_COMMON_MEMBERS /* needed to create a thread */
sap_session_t **pp_sessions;
sap_address_t **pp_addresses;
bool b_control;
int i_sessions;
int i_addresses;
int i_current_session;
int (*pf_add) ( sap_handler_t*, session_descriptor_t *);
int (*pf_del) ( sap_handler_t*, session_descriptor_t *);
/* private data, not in p_sys as there is one kind of sap_handler_t */
};
struct session_descriptor_t struct session_descriptor_t
{ {
struct sockaddr_storage orig; struct sockaddr_storage orig;
...@@ -98,7 +77,9 @@ struct announce_handler_t ...@@ -98,7 +77,9 @@ struct announce_handler_t
int announce_HandlerDestroy( announce_handler_t * ); int announce_HandlerDestroy( announce_handler_t * );
/* Release it with vlc_object_release() */ sap_handler_t *SAP_Create (vlc_object_t *);
sap_handler_t *announce_SAPHandlerCreate( announce_handler_t *p_announce ); void SAP_Destroy (sap_handler_t *);
int SAP_Add (sap_handler_t *, session_descriptor_t *);
void SAP_Del (sap_handler_t *, const session_descriptor_t *);
#endif #endif
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