[vlc-devel] [PATCH 2/4] decoder: reset the replaced vout on lock and release it outside of variable lock
Steve Lhomme
robux4 at ycbcr.xyz
Tue Sep 3 11:59:32 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 | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index d66d0311ff..21da23d23c 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -633,20 +633,25 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec,
if( p_owner->p_vout != p_vout )
{
- if (p_owner->p_vout) /* notify the previous vout deletion unlocked */
- decoder_Notify(p_owner, on_vout_deleted, 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;
+ vlc_mutex_unlock( &p_owner->lock );
- if (p_owner->p_vout)
+ if (p_old_vout)
{
+ /* notify the previous vout deletion unlocked */
+ decoder_Notify(p_owner, on_vout_deleted, p_old_vout);
+
/* Unregister the SPU channel of the previous vout */
- assert(p_owner->i_spu_channel != VOUT_SPU_CHANNEL_INVALID);
- vout_UnregisterSubpictureChannel(p_owner->p_vout,
- p_owner->i_spu_channel);
- vout_Release(p_owner->p_vout);
+ assert(i_deleted_spu_channel != VOUT_SPU_CHANNEL_INVALID);
+ vout_UnregisterSubpictureChannel(p_old_vout,
+ i_deleted_spu_channel);
+ vout_Release(p_old_vout);
}
+ vlc_mutex_lock(&p_owner->lock);
+
enum vlc_vout_order channel_order;
p_owner->i_spu_channel =
vout_RegisterSubpictureChannelInternal(p_vout, p_owner->p_clock,
--
2.17.1
More information about the vlc-devel
mailing list