[vlc-devel] [PATCH 2/2] decoder: fix data race

Steve Lhomme robux4 at ycbcr.xyz
Wed Jan 20 11:34:05 UTC 2021


On 2021-01-20 12:32, Steve Lhomme wrote:
> The p_owner->fmt.i_cat value is used a few lines above. Maybe it would 
> be more appropriate to keep that value after the FIFO is unlocked ? I 
> don't suppose the format category can change at that point.

PS: because it seems out of place to use p_owner->dec here.

It's also used below this code, but with the owner lock, rather than the 
FIFO lock for p_owner->fmt.

> On 2021-01-20 12:00, Thomas Guillem wrote:
>> owner->fmt need to be read with owner->lock held or from the module
>> thread.
>> ---
>>   src/input/decoder.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/input/decoder.c b/src/input/decoder.c
>> index 3f03f36b091..48d41003562 100644
>> --- a/src/input/decoder.c
>> +++ b/src/input/decoder.c
>> @@ -2317,7 +2317,7 @@ void vlc_input_decoder_Flush( 
>> vlc_input_decoder_t *p_owner )
>>       vlc_fifo_Unlock( p_owner->p_fifo );
>> -    if ( p_owner->fmt.i_cat == VIDEO_ES )
>> +    if ( p_owner->dec.fmt_in.i_cat == VIDEO_ES )
>>       {
>>           /* Set the pool cancel state. This will unblock the module 
>> if it is
>>            * waiting for new pictures (likely). This state will be 
>> reset back
>> -- 
>> 2.29.2
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list