Commit 20aa3c15 authored by Laurent Aimar's avatar Laurent Aimar

Implemented audio flushing.

It is not perfect as the aout mixer buffers some data too but it is too
late...
parent f57bfd97
...@@ -141,6 +141,7 @@ void aout_DecDeleteBuffer( aout_instance_t *, aout_input_t *, aout_buffer_t * ); ...@@ -141,6 +141,7 @@ void aout_DecDeleteBuffer( aout_instance_t *, aout_input_t *, aout_buffer_t * );
int aout_DecPlay( aout_instance_t *, aout_input_t *, aout_buffer_t *, int i_input_rate ); int aout_DecPlay( aout_instance_t *, aout_input_t *, aout_buffer_t *, int i_input_rate );
int aout_DecGetResetLost( aout_instance_t *, aout_input_t * ); int aout_DecGetResetLost( aout_instance_t *, aout_input_t * );
void aout_DecChangePause( aout_instance_t *, aout_input_t *, bool b_paused, mtime_t i_date ); void aout_DecChangePause( aout_instance_t *, aout_input_t *, bool b_paused, mtime_t i_date );
void aout_DecFlush( aout_instance_t *, aout_input_t * );
/* Helpers */ /* Helpers */
......
...@@ -386,3 +386,13 @@ void aout_DecChangePause( aout_instance_t *p_aout, aout_input_t *p_input, bool b ...@@ -386,3 +386,13 @@ void aout_DecChangePause( aout_instance_t *p_aout, aout_input_t *p_input, bool b
} }
} }
void aout_DecFlush( aout_instance_t *p_aout, aout_input_t *p_input )
{
aout_lock_input_fifos( p_aout );
aout_FifoSet( p_aout, &p_input->fifo, 0 );
p_input->p_first_byte_to_mix = NULL;
aout_unlock_input_fifos( p_aout );
}
...@@ -292,10 +292,8 @@ void input_DecoderDelete( decoder_t *p_dec ) ...@@ -292,10 +292,8 @@ void input_DecoderDelete( decoder_t *p_dec )
} }
vlc_mutex_unlock( &p_owner->lock ); vlc_mutex_unlock( &p_owner->lock );
/* Make sure the thread leaves the function by /* Make sure the thread leaves the function */
* sending it an empty block. */ block_FifoWake( p_owner->p_fifo );
block_t *p_block = block_New( p_dec, 0 );
input_DecoderDecode( p_dec, p_block );
vlc_thread_join( p_dec ); vlc_thread_join( p_dec );
...@@ -696,10 +694,7 @@ static void *DecoderThread( vlc_object_t *p_this ) ...@@ -696,10 +694,7 @@ static void *DecoderThread( vlc_object_t *p_this )
while( vlc_object_alive( p_dec ) && !p_dec->b_error ) while( vlc_object_alive( p_dec ) && !p_dec->b_error )
{ {
if( ( p_block = block_FifoGet( p_owner->p_fifo ) ) == NULL ) if( ( p_block = block_FifoGet( p_owner->p_fifo ) ) == NULL )
{ continue;
p_dec->b_error = true;
break;
}
if( DecoderProcess( p_dec, p_block ) != VLC_SUCCESS ) if( DecoderProcess( p_dec, p_block ) != VLC_SUCCESS )
break; break;
...@@ -946,8 +941,10 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block ) ...@@ -946,8 +941,10 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block )
if( p_owner->i_preroll_end > 0 ) if( p_owner->i_preroll_end > 0 )
{ {
/* FIXME TODO flush audio output (don't know how to do that) */
msg_Dbg( p_dec, "End of audio preroll" ); msg_Dbg( p_dec, "End of audio preroll" );
if( p_owner->p_aout && p_owner->p_aout_input )
aout_DecFlush( p_owner->p_aout, p_owner->p_aout_input );
/* */
p_owner->i_preroll_end = -1; p_owner->i_preroll_end = -1;
} }
...@@ -1433,11 +1430,6 @@ static void DecoderProcessAudio( decoder_t *p_dec, block_t *p_block, bool b_flus ...@@ -1433,11 +1430,6 @@ static void DecoderProcessAudio( decoder_t *p_dec, block_t *p_block, bool b_flus
{ {
decoder_owner_sys_t *p_owner = (decoder_owner_sys_t *)p_dec->p_owner; decoder_owner_sys_t *p_owner = (decoder_owner_sys_t *)p_dec->p_owner;
if( b_flush && p_owner->p_aout && p_owner->p_aout_input )
{
// TODO flush
}
if( p_owner->p_packetizer ) if( p_owner->p_packetizer )
{ {
block_t *p_packetized_block; block_t *p_packetized_block;
...@@ -1467,6 +1459,9 @@ static void DecoderProcessAudio( decoder_t *p_dec, block_t *p_block, bool b_flus ...@@ -1467,6 +1459,9 @@ static void DecoderProcessAudio( decoder_t *p_dec, block_t *p_block, bool b_flus
{ {
DecoderDecodeAudio( p_dec, p_block ); DecoderDecodeAudio( p_dec, p_block );
} }
if( b_flush && p_owner->p_aout && p_owner->p_aout_input )
aout_DecFlush( p_owner->p_aout, p_owner->p_aout_input );
} }
/* This function process a subtitle block /* This function process a subtitle block
......
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