[vlc-devel] [PATCH] prefetch: reading while paused is valable
Thomas Guillem
thomas at gllm.fr
Mon Nov 18 15:00:49 CET 2019
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
More information about the vlc-devel
mailing list