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;
typedef struct sout_stream_sys_t sout_stream_sys_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 announce_method_t announce_method_t;
typedef struct announce_handler_t announce_handler_t;
......
......@@ -1832,8 +1832,7 @@ vlc_module_begin();
PACKETIZER_TEXT, PACKETIZER_LONGTEXT, true );
set_subcategory( SUBCAT_SOUT_SAP );
add_bool( "sap-flow-control", false, NULL, ANN_SAPCTRL_TEXT,
ANN_SAPCTRL_LONGTEXT, true );
add_obsolete_bool( "sap-flow-control" );
add_integer( "sap-interval", 5, NULL, ANN_SAPINTV_TEXT,
ANN_SAPINTV_LONGTEXT, true );
......
......@@ -176,10 +176,7 @@ static announce_handler_t *announce_HandlerCreate( vlc_object_t *p_this )
int announce_HandlerDestroy( announce_handler_t *p_announce )
{
if( p_announce->p_sap )
{
/* Exit the SAP */
vlc_object_release( p_announce->p_sap );
}
SAP_Destroy( p_announce->p_sap );
/* Free the structure */
vlc_object_release( p_announce );
......@@ -201,7 +198,7 @@ static int announce_Register( announce_handler_t *p_announce,
/* Do we already have a SAP announce handler ? */
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");
if( !p_sap )
{
......@@ -212,7 +209,7 @@ static int announce_Register( announce_handler_t *p_announce,
}
/* this will set p_session->p_sap for later deletion */
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
{
......@@ -228,7 +225,6 @@ static int announce_UnRegister( announce_handler_t *p_announce,
session_descriptor_t *p_session )
{
msg_Dbg( p_announce, "unregistering announce" );
if( p_announce->p_sap )
p_announce->p_sap->pf_del( p_announce->p_sap, p_session );
SAP_Del( p_announce->p_sap, p_session );
return VLC_SUCCESS;
}
This diff is collapsed.
......@@ -47,36 +47,15 @@ struct sout_packetizer_input_t
};
#define sout_NewInstance(a,b) __sout_NewInstance(VLC_OBJECT(a),b)
VLC_EXPORT( sout_instance_t *, __sout_NewInstance, ( vlc_object_t *, const char * ) );
VLC_EXPORT( void, sout_DeleteInstance, ( sout_instance_t * ) );
sout_instance_t * __sout_NewInstance( vlc_object_t *, const char * );
void sout_DeleteInstance( sout_instance_t * );
VLC_EXPORT( sout_packetizer_input_t *, sout_InputNew,( sout_instance_t *, es_format_t * ) );
VLC_EXPORT( int, sout_InputDelete, ( sout_packetizer_input_t * ) );
VLC_EXPORT( int, sout_InputSendBuffer, ( sout_packetizer_input_t *, block_t* ) );
sout_packetizer_input_t *sout_InputNew( sout_instance_t *, es_format_t * );
int sout_InputDelete( sout_packetizer_input_t * );
int sout_InputSendBuffer( sout_packetizer_input_t *, block_t* );
/* 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 sockaddr_storage orig;
......@@ -98,7 +77,9 @@ struct announce_handler_t
int announce_HandlerDestroy( announce_handler_t * );
/* Release it with vlc_object_release() */
sap_handler_t *announce_SAPHandlerCreate( announce_handler_t *p_announce );
sap_handler_t *SAP_Create (vlc_object_t *);
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
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