[vlc-commits] decoder: reduce owner lock scope for aout (fixes #10422)
Rémi Denis-Courmont
git at videolan.org
Sun Nov 1 17:06:19 CET 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Oct 21 21:55:03 2015 +0300| [6ae2905ef7fbc7de3a3a4a1bdf8ad6df46ce570a] | committer: Rémi Denis-Courmont
decoder: reduce owner lock scope for aout (fixes #10422)
The decoder thread no longer needs the lock to use the aout, only to
modify the aout pointer.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6ae2905ef7fbc7de3a3a4a1bdf8ad6df46ce570a
---
src/input/decoder.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 83aa5bf..fe3cd42 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -265,11 +265,10 @@ static int aout_update_format( decoder_t *p_dec )
/* Parameters changed, restart the aout */
vlc_mutex_lock( &p_owner->lock );
-
- aout_DecDelete( p_owner->p_aout );
p_owner->p_aout = NULL;
-
vlc_mutex_unlock( &p_owner->lock );
+ aout_DecDelete( p_owner->p_aout );
+
input_resource_PutAout( p_owner->p_resource, p_aout );
}
@@ -316,7 +315,6 @@ static int aout_update_format( decoder_t *p_dec )
}
vlc_mutex_lock( &p_owner->lock );
-
p_owner->p_aout = p_aout;
DecoderUpdateFormatLocked( p_dec );
@@ -1104,6 +1102,7 @@ static void DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
DecoderWaitDate( p_dec, &b_reject,
p_audio->i_pts - AOUT_MAX_PREPARE_TIME );
+ vlc_mutex_unlock( &p_owner->lock );
audio_output_t *p_aout = p_owner->p_aout;
if( p_aout == NULL )
@@ -1121,7 +1120,6 @@ static void DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
*pi_lost_sum += 1;
block_Release( p_audio );
}
- vlc_mutex_unlock( &p_owner->lock );
}
static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block )
@@ -1484,7 +1482,6 @@ static void *DecoderThread( void *p_data )
int canc = vlc_savecancel();
DecoderProcess( p_dec, p_block );
- vlc_mutex_lock( &p_owner->lock );
if( p_block == NULL )
{ /* Draining: the decoder is drained and all decoded buffers are
* queued to the output at this point. Now drain the output. */
@@ -1493,6 +1490,7 @@ static void *DecoderThread( void *p_data )
}
vlc_restorecancel( canc );
+ vlc_mutex_lock( &p_owner->lock );
p_owner->b_drained = (p_block == NULL);
vlc_fifo_Lock( p_owner->p_fifo );
vlc_cond_signal( &p_owner->wait_acknowledge );
More information about the vlc-commits
mailing list