[vlc-commits] decoder: fix data race in sout

Rémi Denis-Courmont git at videolan.org
Sat Mar 21 17:52:01 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Mar 21 18:10:38 2015 +0200| [d4489a37385c1c7d2e01c7118c81a56b5ad71ac2] | committer: Rémi Denis-Courmont

decoder: fix data race in sout

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d4489a37385c1c7d2e01c7118c81a56b5ad71ac2
---

 src/input/decoder.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index d01b257..0201e4f 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -62,6 +62,7 @@ static void      *DecoderThread( void * );
 static void       DecoderProcess( decoder_t *, block_t * );
 static void       DecoderFlush( decoder_t * );
 static void       DecoderSignalWait( decoder_t * );
+static void       DecoderUpdateFormatLocked( decoder_t * );
 
 static void       DecoderUnsupportedCodec( decoder_t *, vlc_fourcc_t );
 
@@ -1498,9 +1499,11 @@ static void DecoderProcessSout( decoder_t *p_dec, block_t *p_block )
     {
         if( p_owner->p_sout_input == NULL )
         {
-            assert( !p_owner->b_fmt_description ); // no need for owner lock
+            vlc_mutex_lock( &p_owner->lock );
             es_format_Clean( &p_owner->fmt );
             es_format_Copy( &p_owner->fmt, &p_dec->fmt_out );
+            DecoderUpdateFormatLocked( p_dec );
+            vlc_mutex_unlock( &p_owner->lock );
 
             p_owner->fmt.i_group = p_dec->fmt_in.i_group;
             p_owner->fmt.i_id = p_dec->fmt_in.i_id;



More information about the vlc-commits mailing list