From dde854142cfcf9b75ca2d81a32a027c7f3d48e63 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Tue, 12 Aug 2008 20:19:00 +0300 Subject: [PATCH] UDP access_out: get rid of block_FifoWake and blocking mwait() --- modules/access_output/udp.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/modules/access_output/udp.c b/modules/access_output/udp.c index e439bf9e45..7d3b5c7e29 100644 --- a/modules/access_output/udp.c +++ b/modules/access_output/udp.c @@ -280,7 +280,6 @@ static void Close( vlc_object_t * p_this ) int i; vlc_object_kill( p_sys->p_thread ); - block_FifoWake( p_sys->p_thread->p_fifo ); for( i = 0; i < 10; i++ ) { @@ -443,9 +442,8 @@ static void* ThreadWrite( vlc_object_t *p_this ) mtime_t i_date_last = -1; mtime_t i_to_send = p_thread->i_group; int i_dropped_packets = 0; - int canc = vlc_savecancel (); - while( vlc_object_alive (p_thread) ) + for (;;) { block_t *p_pk; mtime_t i_date, i_sent; @@ -462,8 +460,6 @@ static void* ThreadWrite( vlc_object_t *p_this ) } #endif p_pk = block_FifoGet( p_thread->p_fifo ); - if( p_pk == NULL ) - continue; /* forced wake-up */ i_date = p_thread->i_caching + p_pk->i_dts; if( i_date_last > 0 ) @@ -488,18 +484,17 @@ static void* ThreadWrite( vlc_object_t *p_this ) } } + block_cleanup_push( p_pk ); i_to_send--; if( !i_to_send || (p_pk->i_flags & BLOCK_FLAG_CLOCK) ) { mwait( i_date ); i_to_send = p_thread->i_group; } - ssize_t val = send( p_thread->i_handle, p_pk->p_buffer, - p_pk->i_buffer, 0 ); - if (val == -1) - { + if ( send( p_thread->i_handle, p_pk->p_buffer, + p_pk->i_buffer, 0 ) == -1 ) msg_Warn( p_thread, "send error: %m" ); - } + vlc_cleanup_pop(); if( i_dropped_packets ) { @@ -520,6 +515,5 @@ static void* ThreadWrite( vlc_object_t *p_this ) i_date_last = i_date; } - vlc_restorecancel (canc); return NULL; } -- 2.39.5