[vlc-devel] [RFC PATCH 6/6] decoder: use asynchronous aout_DecDrain
Thomas Guillem
thomas at gllm.fr
Thu Mar 16 16:43:25 CET 2017
--
Will be squashed with 5/6
---
src/input/decoder.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index d1d14ae3cb..6dffd1bd09 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -127,7 +127,6 @@ struct decoder_owner_sys_t
/* Flushing */
bool flushing;
bool b_draining;
- atomic_bool drained;
bool b_idle;
/* CC */
@@ -1538,14 +1537,10 @@ static void *DecoderThread( void *p_data )
{ /* Draining: the decoder is drained and all decoded buffers are
* queued to the output at this point. Now drain the output. */
if( p_owner->p_aout != NULL )
- aout_DecFlush( p_owner->p_aout );
+ aout_DecDrain( p_owner->p_aout );
}
vlc_restorecancel( canc );
- /* Given that the drained flag is only polled, an atomic variable is
- * sufficient. TODO? Wait for draining instead of polling. */
- atomic_store( &p_owner->drained, (p_block == NULL) );
-
vlc_mutex_lock( &p_owner->lock );
vlc_fifo_Lock( p_owner->p_fifo );
vlc_cond_signal( &p_owner->wait_acknowledge );
@@ -1611,7 +1606,6 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
p_owner->flushing = false;
p_owner->b_draining = false;
- atomic_init( &p_owner->drained, false );
atomic_init( &p_owner->reload, RELOAD_NO_REQUEST );
p_owner->b_idle = false;
@@ -1983,6 +1977,7 @@ bool input_DecoderIsEmpty( decoder_t * p_dec )
{
decoder_owner_sys_t *p_owner = p_dec->p_owner;
+ /* TODO? Wait for draining instead of polling. */
assert( !p_owner->b_waiting );
vlc_fifo_Lock( p_owner->p_fifo );
@@ -2003,8 +1998,8 @@ bool input_DecoderIsEmpty( decoder_t * p_dec )
#endif
if( p_owner->fmt.i_cat == VIDEO_ES && p_owner->p_vout != NULL )
b_empty = vout_IsEmpty( p_owner->p_vout );
- else if( p_owner->fmt.i_cat == AUDIO_ES )
- b_empty = atomic_load( &p_owner->drained );
+ else if( p_owner->fmt.i_cat == AUDIO_ES && p_owner->p_aout != NULL )
+ b_empty = aout_DecDrained( p_owner->p_aout );
else
b_empty = true; /* TODO subtitles support */
vlc_mutex_unlock( &p_owner->lock );
--
2.11.0
More information about the vlc-devel
mailing list