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

Alexandre Janniaux ajanni at videolabs.io
Mon Nov 18 18:13:03 CET 2019


Hi,

On Mon, Nov 18, 2019 at 05:56:43PM +0200, 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.

The concept of a playback pipeline being paused is fairly simple
considering the user point of view, but from the internal point of
view I would have expected that pause is just relative to audio/video
playback itself, not everything before which would be paced by the
pool of available resources.

This is a naive view, obviously, but the reasons behind this seem
rather not trivial at all, since the comments about that exist since
2008 (96588cbc1429ae8ef78b2d5c1685a856b8a35d0c).

Do you have any hints regarding why it should be like that?

Regards,
--
Alexandre Janniaux
Videolabs

> 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é.

> _______________________________________________
> 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