[vlc-devel] [PATCHv2 3/3] mmdevice: sys->dev need to be read locked

Thomas Guillem thomas at gllm.fr
Thu Jul 6 12:29:00 CEST 2017




On Thu, Jul 6, 2017, at 12:25, Rémi Denis-Courmont wrote:
> Le 6 juillet 2017 12:25:01 GMT+03:00, Thomas Guillem <thomas at gllm.fr> a écrit :>> ---
>> 
>>  modules/audio_output/mmdevice.c | 12 +++++++++---
>> 
>>  1 file changed, 9 insertions(+), 3 deletions(-)
>> 
>> 
>> 
>> diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
>> >> index 194a8bf91b..772fb48565 100644
>> 
>> --- a/modules/audio_output/mmdevice.c
>> 
>> +++ b/modules/audio_output/mmdevice.c
>> 
>> @@ -1087,9 +1087,6 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
>> >>  {
>> 
>>      aout_sys_t *sys = aout->sys;
>> 
>>  
>> 
>> -    if (sys->dev == NULL)
>> 
>> -        return -1;
>> 
>> -
>> 
>>      aout_stream_t *s = vlc_object_create(aout, sizeof (*s));
>> 
>>      if (unlikely(s == NULL))
>> 
>>          return -1;
>> 
>> @@ -1098,6 +1095,15 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
>> >>  
>> 
>>      EnterMTA();
>> 
>>      EnterCriticalSection(&sys->lock);
>> 
>> +
>> 
>> +    if (sys->dev == NULL)
>> 
>> +    {
>> 
>> +        vlc_object_release(s);
>> 
>> +        LeaveCriticalSection(&sys->lock);
>> 
>> +        LeaveMTA();
>> 
>> +        return -1;
>> 
>> +    }
>> 
>> +
>> 
>>      for (;;)
>> 
>>      {
>> 
>>          HRESULT hr;
>> 
> 
> No, I don't think so. I can't see how sys->dev can change there. And if it did, this patch would not be sufficient AFAICT.
Ah yes, sys->dev is set from Open() and won't change if DeviceSelect() is not called.
>  -- 
>  Rémi Denis-Courmont
>  Typed on an inconvenient virtual keyboard 
> _________________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170706/9a79afc1/attachment.html>


More information about the vlc-devel mailing list