Commit 9039c762 authored by Thomas Guillem's avatar Thomas Guillem
Browse files

decoder: refactor b_has_data handling

Move it to DecoderWaitUnblock(). It is now possible to do this
simplification because of the previous commit: DecoderWaitUnblock() is
now called only when has_data should be changed to true.
parent a99d0604
......@@ -813,6 +813,12 @@ static void DecoderWaitUnblock( vlc_input_decoder_t *p_owner )
{
vlc_mutex_assert( &p_owner->lock );
if( p_owner->b_waiting )
{
p_owner->b_has_data = true;
vlc_cond_signal( &p_owner->wait_acknowledge );
}
while( p_owner->b_waiting && p_owner->b_has_data )
vlc_cond_wait( &p_owner->wait_request, &p_owner->lock );
}
......@@ -838,12 +844,6 @@ static int DecoderThread_PlaySout( vlc_input_decoder_t *p_owner, block_t *p_sout
vlc_mutex_lock( &p_owner->lock );
if( p_owner->b_waiting )
{
p_owner->b_has_data = true;
vlc_cond_signal( &p_owner->wait_acknowledge );
}
DecoderWaitUnblock( p_owner );
vlc_mutex_unlock( &p_owner->lock );
......@@ -1061,15 +1061,7 @@ static int ModuleThread_PlayVideo( vlc_input_decoder_t *p_owner, picture_t *p_pi
p_picture->b_force = true;
}
else
{
if( p_owner->b_waiting )
{
p_owner->b_has_data = true;
vlc_cond_signal( &p_owner->wait_acknowledge );
}
DecoderWaitUnblock( p_owner );
}
vlc_mutex_unlock( &p_owner->lock );
......@@ -1198,11 +1190,6 @@ static int ModuleThread_PlayAudio( vlc_input_decoder_t *p_owner, block_t *p_audi
/* */
/* */
vlc_mutex_lock( &p_owner->lock );
if( p_owner->b_waiting )
{
p_owner->b_has_data = true;
vlc_cond_signal( &p_owner->wait_acknowledge );
}
/* */
DecoderWaitUnblock( p_owner );
......@@ -1272,12 +1259,6 @@ static void ModuleThread_PlaySpu( vlc_input_decoder_t *p_owner, subpicture_t *p_
/* */
vlc_mutex_lock( &p_owner->lock );
if( p_owner->b_waiting )
{
p_owner->b_has_data = true;
vlc_cond_signal( &p_owner->wait_acknowledge );
}
DecoderWaitUnblock( p_owner );
vlc_mutex_unlock( &p_owner->lock );
......
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