[vlc-devel] [PATCH] lib: media: reset parsed_status on new parse request

Thomas Guillem thomas at gllm.fr
Tue Oct 22 17:03:37 CEST 2019


On Tue, Oct 22, 2019, at 13:28, Rémi Denis-Courmont wrote:
> Hi,
> 
> Just a few days ago, Hugo made the case that media can be used in multiple threads. Now, this seems to be doing the exact opposite, propose a design that won't work if multiple threads use the same media (and try to parse it).

If a second thread try to parse the media that is already parsing, it will return an error.
The media can be read from any threads, but only one thread can parse it now.

We could easily allow parsing from multiple threads by just returning success if already parsing. But we need to make sure that the second thread will receive the parse_ended event in all case.

> This does not add up. I'm not sure which way is right, but it can't be both.
> 
> Le 22 octobre 2019 13:45:14 GMT+03:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>> Otherwise, events are not propagated after the first request.
>> 
>> cf. f37171e57b0d0af922215ffed19111a4f317fb29 lib/media.c | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/lib/media.c b/lib/media.c
>> index dd0513633f6..f0f1adb1bcf 100644
>> --- a/lib/media.c
>> +++ b/lib/media.c
>> @@ -781,7 +781,10 @@ static int media_parse(libvlc_media_t *media, bool b_async,
>>      needed = !media->has_asked_preparse;
>>      media->has_asked_preparse = true;
>>      if (needed)
>> +    {
>>          media->is_parsed = false;
>> +        media->parsed_status = 0;
>> +    }
>>      vlc_mutex_unlock(&media->parsed_lock);
>>  
>>      if (needed)
> 
> -- 
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté. 
> _______________________________________________
> 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/20191022/aae78965/attachment.html>


More information about the vlc-devel mailing list