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

Rémi Denis-Courmont remi at remlab.net
Mon Nov 18 16:56:43 CET 2019


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.

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;
>-- 
>2.20.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20191118/3a41f344/attachment.html>


More information about the vlc-devel mailing list