[vlc-devel] [PATCH 1/4] decoder: reset the deleted vout on lock and release it outside of variable lock
Steve Lhomme
robux4 at ycbcr.xyz
Tue Sep 3 11:59:31 CEST 2019
- on_vout_deleted() was and is not called under lock
- vout_UnregisterSubpictureChannel() is not called under lock anymore (in some
cases it's called without the variable lock)
- vout_Release() is not called under lock anymore (in many cases it's called
without the variable lock)
---
src/input/decoder.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 5bd59fc6b0..d66d0311ff 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -610,19 +610,23 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec,
if( !p_vout )
{
msg_Warn( p_dec, "no vout found, dropping subpicture" );
- if( p_owner->p_vout )
+ vlc_mutex_lock( &p_owner->lock );
+ vout_thread_t *p_old_vout = p_owner->p_vout;
+ ssize_t i_deleted_spu_channel = p_owner->i_spu_channel;
+
+ p_owner->p_vout = NULL;
+ p_owner->i_spu_channel = VOUT_SPU_CHANNEL_INVALID;
+ vlc_mutex_unlock( &p_owner->lock );
+
+ if( p_old_vout )
{
- assert(p_owner->i_spu_channel != VOUT_SPU_CHANNEL_INVALID);
- decoder_Notify(p_owner, on_vout_deleted, p_owner->p_vout);
+ assert(i_deleted_spu_channel != VOUT_SPU_CHANNEL_INVALID);
+ decoder_Notify(p_owner, on_vout_deleted, p_old_vout);
- vlc_mutex_lock( &p_owner->lock );
- vout_UnregisterSubpictureChannel(p_owner->p_vout,
- p_owner->i_spu_channel);
- p_owner->i_spu_channel = VOUT_SPU_CHANNEL_INVALID;
+ vout_UnregisterSubpictureChannel(p_old_vout,
+ i_deleted_spu_channel);
- vout_Release(p_owner->p_vout);
- p_owner->p_vout = NULL;
- vlc_mutex_unlock( &p_owner->lock );
+ vout_Release(p_old_vout);
}
return NULL;
}
--
2.17.1
More information about the vlc-devel
mailing list