Commit 498f442c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

decoder: simplify audio path

DecoderPlayAudio() has no effects with a NULL block.
parent 34e54fee
...@@ -1073,7 +1073,7 @@ static void DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio, ...@@ -1073,7 +1073,7 @@ static void DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
audio_output_t *p_aout = p_owner->p_aout; audio_output_t *p_aout = p_owner->p_aout;
/* */ /* */
if( p_audio && p_audio->i_pts <= VLC_TS_INVALID ) // FIXME --VLC_TS_INVALID verify audio_output/* if( p_audio->i_pts <= VLC_TS_INVALID ) // FIXME --VLC_TS_INVALID verify audio_output/*
{ {
msg_Warn( p_dec, "non-dated audio buffer received" ); msg_Warn( p_dec, "non-dated audio buffer received" );
*pi_lost_sum += 1; *pi_lost_sum += 1;
...@@ -1083,23 +1083,15 @@ static void DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio, ...@@ -1083,23 +1083,15 @@ static void DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
/* */ /* */
vlc_mutex_lock( &p_owner->lock ); vlc_mutex_lock( &p_owner->lock );
race:
if( p_audio && p_owner->b_waiting ) if( p_owner->b_waiting )
{ {
p_owner->b_has_data = true; p_owner->b_has_data = true;
vlc_cond_signal( &p_owner->wait_acknowledge ); vlc_cond_signal( &p_owner->wait_acknowledge );
} }
for( ;; )
{
bool b_paused;
bool b_reject = DecoderWaitUnblock( p_dec ); bool b_reject = DecoderWaitUnblock( p_dec );
bool b_paused = p_owner->b_paused;
b_paused = p_owner->b_paused;
if (!p_audio)
break;
/* */ /* */
int i_rate = INPUT_RATE_DEFAULT; int i_rate = INPUT_RATE_DEFAULT;
...@@ -1116,7 +1108,7 @@ static void DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio, ...@@ -1116,7 +1108,7 @@ static void DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
p_audio->i_pts - AOUT_MAX_PREPARE_TIME ); p_audio->i_pts - AOUT_MAX_PREPARE_TIME );
if( unlikely(p_owner->b_paused != b_paused) ) if( unlikely(p_owner->b_paused != b_paused) )
continue; /* race with input thread? retry... */ goto race; /* race with input thread? retry... */
if( p_aout == NULL ) if( p_aout == NULL )
b_reject = true; b_reject = true;
...@@ -1133,9 +1125,6 @@ static void DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio, ...@@ -1133,9 +1125,6 @@ static void DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
*pi_lost_sum += 1; *pi_lost_sum += 1;
block_Release( p_audio ); block_Release( p_audio );
} }
break;
}
vlc_mutex_unlock( &p_owner->lock ); vlc_mutex_unlock( &p_owner->lock );
} }
...@@ -1147,11 +1136,10 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block ) ...@@ -1147,11 +1136,10 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block )
int i_lost = 0; int i_lost = 0;
int i_played = 0; int i_played = 0;
if (!p_block) { if( p_block == NULL )
/* Play a NULL block to output buffered frames */ return; /* TODO: remove this check, drain audio decoders properly */
DecoderPlayAudio( p_dec, NULL, &i_played, &i_lost );
} while( (p_aout_buf = p_dec->pf_decode_audio( p_dec, &p_block )) )
else while( (p_aout_buf = p_dec->pf_decode_audio( p_dec, &p_block )) )
{ {
if( DecoderIsFlushing( p_dec ) ) if( DecoderIsFlushing( p_dec ) )
{ {
......
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