[vlc-commits] commit: stream_filter/httplive.c: do not seek in last 3 segments of HLS stream (Jean-Paul Saman )
git at videolan.org
git at videolan.org
Wed Dec 22 09:59:13 CET 2010
vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Fri Dec 17 15:44:42 2010 +0100| [cc8181c8095d5344b5013bb3418f21781f6a9831] | committer: Jean-Paul Saman
stream_filter/httplive.c: do not seek in last 3 segments of HLS stream
Seeking into the last 3 segments keeps this condition in false state. In this
case it should turn into true because the last 3 segments have already been downloaded.
Or the condition should just not be applied.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cc8181c8095d5344b5013bb3418f21781f6a9831
---
modules/stream_filter/httplive.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 1815d9e..bb62be4 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1574,14 +1574,20 @@ static int segment_Seek(stream_t *s, uint64_t pos)
vlc_mutex_lock(&segment->lock);
length += segment->duration * (hls->bandwidth/8);
+ vlc_mutex_unlock(&segment->lock);
if (!b_found && (pos <= length))
{
- count = p_sys->segment;
- p_sys->segment = n;
- b_found = true;
+ if (count - n >= 3)
+ {
+ p_sys->segment = n;
+ b_found = true;
+ break;
+ }
+ /* Do not search in last 3 segments */
+ vlc_mutex_unlock(&hls->lock);
+ return VLC_EGENERIC;
}
- vlc_mutex_unlock(&segment->lock);
}
/* */
@@ -1626,9 +1632,12 @@ static int segment_Seek(stream_t *s, uint64_t pos)
while ((p_sys->thread->seek != -1) ||
(p_sys->thread->segment - p_sys->segment < 3))
{
+ /* FIXME: This never finishes when the download thread is
+ * at its end and the user searches to a segment within the
+ * last three segments. In that case it should just count the
+ * segment as being available. */
vlc_cond_wait(&p_sys->thread->wait, &p_sys->thread->lock_wait);
- if (!vlc_object_alive (s) ||
- s->b_error) break;
+ if (!vlc_object_alive(s) || s->b_error) break;
}
vlc_mutex_unlock(&p_sys->thread->lock_wait);
More information about the vlc-commits
mailing list