[vlc-commits] prefetch: fix EOF handling
Rémi Denis-Courmont
git at videolan.org
Tue Oct 11 18:20:50 CEST 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Oct 11 17:56:49 2016 +0300| [71088446bc90fe650cac21734b2a17b8d661dd8a] | committer: Rémi Denis-Courmont
prefetch: fix EOF handling
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=71088446bc90fe650cac21734b2a17b8d661dd8a
---
modules/stream_filter/prefetch.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/modules/stream_filter/prefetch.c b/modules/stream_filter/prefetch.c
index 90d806a..6493871 100644
--- a/modules/stream_filter/prefetch.c
+++ b/modules/stream_filter/prefetch.c
@@ -137,8 +137,8 @@ static void *Thread(void *data)
continue;
}
- if (paused || sys->eof || sys->error)
- { /* Wait for not paused, not at EOF and not failed state */
+ if (paused || sys->error)
+ { /* Wait for not paused and not failed */
vlc_cond_wait(&sys->wait_space, &sys->lock);
continue;
}
@@ -154,6 +154,14 @@ static void *Thread(void *data)
sys->buffer_offset = sys->stream_offset;
sys->buffer_length = 0;
+ assert(!sys->error);
+ sys->eof = false;
+ continue;
+ }
+
+ if (sys->eof)
+ { /* Do not attempt to read at EOF - would busy loop */
+ vlc_cond_wait(&sys->wait_space, &sys->lock);
continue;
}
@@ -175,6 +183,8 @@ static void *Thread(void *data)
{
sys->buffer_offset = sys->stream_offset;
sys->buffer_length = 0;
+ assert(!sys->error);
+ assert(!sys->eof);
continue;
}
@@ -241,7 +251,6 @@ static int Seek(stream_t *stream, uint64_t offset)
vlc_mutex_lock(&sys->lock);
sys->stream_offset = offset;
- sys->eof = false;
sys->error = false;
vlc_cond_signal(&sys->wait_space);
vlc_mutex_unlock(&sys->lock);
More information about the vlc-commits
mailing list