[vlc-commits] decoder: thumbnailer: Fix unprotected access to b_first
Hugo Beauzée-Luyssen
git at videolan.org
Wed Oct 9 15:31:22 CEST 2019
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Oct 1 17:52:08 2019 +0200| [861463bba67aa2b99661e663ac6a19b53ec99818] | committer: Hugo Beauzée-Luyssen
decoder: thumbnailer: Fix unprotected access to b_first
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=861463bba67aa2b99661e663ac6a19b53ec99818
---
src/input/decoder.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 9019f5e210..53aca540d8 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1097,19 +1097,28 @@ static picture_t *thumbnailer_buffer_new( decoder_t *p_dec )
struct decoder_owner *p_owner = dec_get_owner( p_dec );
/* Avoid decoding more than one frame when a thumbnail was
* already generated */
+ vlc_mutex_lock( &p_owner->lock );
if( !p_owner->b_first )
+ {
+ vlc_mutex_unlock( &p_owner->lock );
return NULL;
+ }
+ vlc_mutex_unlock( &p_owner->lock );
return picture_NewFromFormat( &p_dec->fmt_out.video );
}
static void ModuleThread_QueueThumbnail( decoder_t *p_dec, picture_t *p_pic )
{
struct decoder_owner *p_owner = dec_get_owner( p_dec );
- if( p_owner->b_first )
- {
+ bool b_first;
+
+ vlc_mutex_lock( &p_owner->lock );
+ b_first = p_owner->b_first;
+ p_owner->b_first = false;
+ vlc_mutex_unlock( &p_owner->lock );
+
+ if( b_first )
decoder_Notify(p_owner, on_thumbnail_ready, p_pic);
- p_owner->b_first = false;
- }
picture_Release( p_pic );
}
More information about the vlc-commits
mailing list