]> git.sesse.net Git - vlc/commitdiff
decoder: fix data race in input_DecoderIsEmpty()
authorRémi Denis-Courmont <remi@remlab.net>
Tue, 17 Mar 2015 18:45:51 +0000 (20:45 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 17 Mar 2015 18:50:30 +0000 (20:50 +0200)
p_dec->fmt_out is owned by the decoder plugin, and can only safely be
accessed by the core from within decoder callbacks, notably the format
update callbacks.

Outside that context, p_owner->fmt has to be used. It contains a copy
of p_dec->fmt_out at the last format update.

src/input/decoder.c

index 3ccad9b5ba272639abc2fddcb6f5c88201d6e41b..ad5428824c0229f8969a07bf2849ed5c8daf9287 100644 (file)
@@ -382,9 +382,9 @@ bool input_DecoderIsEmpty( decoder_t * p_dec )
     {
         vlc_mutex_lock( &p_owner->lock );
         /* TODO subtitles support */
-        if( p_dec->fmt_out.i_cat == VIDEO_ES && p_owner->p_vout )
+        if( p_owner->fmt.i_cat == VIDEO_ES && p_owner->p_vout )
             b_empty = vout_IsEmpty( p_owner->p_vout );
-        else if( p_dec->fmt_out.i_cat == AUDIO_ES && p_owner->p_aout )
+        else if( p_owner->fmt.i_cat == AUDIO_ES && p_owner->p_aout )
             b_empty = aout_DecIsEmpty( p_owner->p_aout );
         vlc_mutex_unlock( &p_owner->lock );
     }