[vlc-commits] prefetch: do not defer pause
Rémi Denis-Courmont
git at videolan.org
Tue Oct 4 16:40:49 CEST 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Oct 2 23:38:31 2016 +0300| [67aa83dd1b6a136ce90c01bc5babd21fb8a24263] | committer: Rémi Denis-Courmont
prefetch: do not defer pause
Do not wait for full buffers to pause the underlying stream. This
improves responsiveness (upon resumption) for live streams. This also
ensures that no I/O is done while the input thread is paused; some apps
might reasonably expect such behaviour.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=67aa83dd1b6a136ce90c01bc5babd21fb8a24263
---
modules/stream_filter/prefetch.c | 33 +++++++++++----------------------
1 file changed, 11 insertions(+), 22 deletions(-)
diff --git a/modules/stream_filter/prefetch.c b/modules/stream_filter/prefetch.c
index 38d7937..6832801 100644
--- a/modules/stream_filter/prefetch.c
+++ b/modules/stream_filter/prefetch.c
@@ -156,18 +156,17 @@ static void *Thread(void *data)
mutex_cleanup_push(&sys->lock);
for (;;)
{
- if (paused)
- {
- if (sys->paused)
- { /* Wait for resumption */
- vlc_cond_wait(&sys->wait_space, &sys->lock);
- continue;
- }
+ if (sys->paused != paused)
+ { /* Update pause state */
+ msg_Dbg(stream, paused ? "resuming" : "pausing");
+ paused = sys->paused;
+ ThreadControl(stream, STREAM_SET_PAUSE_STATE, paused);
+ continue;
+ }
- /* Resume the underlying stream */
- msg_Dbg(stream, "resuming");
- ThreadControl(stream, STREAM_SET_PAUSE_STATE, false);
- paused = false;
+ if (paused)
+ { /* Wait for resumption */
+ vlc_cond_wait(&sys->wait_space, &sys->lock);
continue;
}
@@ -205,17 +204,7 @@ static void *Thread(void *data)
if (unused == 0)
{ /* Buffer is full */
if (history == 0)
- {
- if (sys->paused)
- { /* Pause the stream once the buffer is full
- * (and assuming pause was actually requested) */
- msg_Dbg(stream, "pausing");
- ThreadControl(stream, STREAM_SET_PAUSE_STATE, true);
- paused = true;
- continue;
- }
-
- /* Wait for data to be read */
+ { /* Wait for data to be read */
vlc_cond_wait(&sys->wait_space, &sys->lock);
continue;
}
More information about the vlc-commits
mailing list