[vlc-devel] [PATCH] prefetch: reading while paused is valable

Thomas Guillem thomas at gllm.fr
Mon Nov 18 17:47:55 CET 2019


On Mon, Nov 18, 2019, at 16:56, Rémi Denis-Courmont wrote:
> I don't see how the error message is wrong. It is not permissible to read from a paused stream, by definition. This patch looks wrong to me.

Some demuxers are reading while paused, here are the reproduce steps:

 - Open a distant MKV (http/smb/...)
 - Pause via the UI
 - Seek

So, maybe it's only the MKV that read() from demux seeks controls.

I didn't find any documentation that forbid that behavior. What should we do then ?

> 
> Le 18 novembre 2019 16:00:49 GMT+02:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>> This commit remove the wrong error message and put back the thread to sleep at
>> the end of the read. modules/stream_filter/prefetch.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/modules/stream_filter/prefetch.c b/modules/stream_filter/prefetch.c
>> index 2991c002bd2..7edb374e77e 100644
>> --- a/modules/stream_filter/prefetch.c
>> +++ b/modules/stream_filter/prefetch.c
>> @@ -309,9 +309,11 @@ static ssize_t Read(stream_t *stream, void *buf, size_t buflen)
>>          return buflen;
>>  
>>      vlc_mutex_lock(&sys->lock);
>> +    bool was_paused = sys->paused;
>>      if (sys->paused)
>>      {
>> -        msg_Err(stream, "reading while paused (buggy demux?)");
>> +        /* Reading while paused. Notify the thread to resume and put it back to
>> +         * sleep once the read is complete. */
>>          sys->paused = false;
>>          vlc_cond_signal(&sys->wait_space);
>>      }
>> @@ -340,6 +342,7 @@ static ssize_t Read(stream_t *stream, void *buf, size_t buflen)
>>  
>>      memcpy(buf, sys->buffer + offset, copy);
>>      sys->stream_offset += copy;
>> +    sys->paused = was_paused;
>>      vlc_cond_signal(&sys->wait_space);
>>      vlc_mutex_unlock(&sys->lock);
>>      return copy;
> 
> -- 
> 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/20191118/b3b1dd01/attachment.html>


More information about the vlc-devel mailing list