/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static void RunThread( vlc_object_t *p_this);
+static void * RunThread( vlc_object_t *p_this);
static int ComputeRate( sap_address_t *p_address );
static int announce_SendSAPAnnounce( sap_handler_t *p_sap,
p_sap = vlc_custom_create( VLC_OBJECT(p_announce), sizeof( sap_handler_t ),
VLC_OBJECT_ANNOUNCE, "announce" );
if( !p_sap )
- {
- msg_Err( p_announce, "out of memory" );
return NULL;
- }
p_sap->psz_object_name = strdup( "sap announcer" );
- vlc_mutex_init( &p_sap->object_lock );
-
p_sap->pf_add = announce_SAPAnnounceAdd;
p_sap->pf_del = announce_SAPAnnounceDel;
* \param p_this the SAP Handler object
* \return nothing
*/
-static void RunThread( vlc_object_t *p_this)
+static void * RunThread( vlc_object_t *p_this)
{
sap_handler_t *p_sap = (sap_handler_t*)p_this;
sap_session_t *p_session;
+ int canc = vlc_savecancel ();
+ /* TODO: Once net_Write() is cancel-safe, so will this whole thread.
+ * However, there is a more serious issues here: msleep(SAP_IDLE).
+ * This thread should really use poll().
+ */
while( !p_sap->b_die )
{
int i;
+ msleep( SAP_IDLE );
+
/* If needed, get the rate info */
if( p_sap->b_control == true )
{
else
{
vlc_object_unlock( p_sap );
- msleep( SAP_IDLE );
continue;
}
p_session = p_sap->pp_sessions[p_sap->i_current_session];
- vlc_object_unlock( p_sap );
/* And announce it */
if( p_session->p_address->b_enabled == true &&
{
announce_SendSAPAnnounce( p_sap, p_session );
}
-
- msleep( SAP_IDLE );
+ vlc_object_unlock( p_sap );
}
+ vlc_restorecancel (canc);
+ return NULL;
}
/* Add a SAP announce */