Commit cc8181c8 authored by Jean-Paul Saman's avatar 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.
parent 16591673
...@@ -1574,14 +1574,20 @@ static int segment_Seek(stream_t *s, uint64_t pos) ...@@ -1574,14 +1574,20 @@ static int segment_Seek(stream_t *s, uint64_t pos)
vlc_mutex_lock(&segment->lock); vlc_mutex_lock(&segment->lock);
length += segment->duration * (hls->bandwidth/8); length += segment->duration * (hls->bandwidth/8);
vlc_mutex_unlock(&segment->lock);
if (!b_found && (pos <= length)) if (!b_found && (pos <= length))
{ {
count = p_sys->segment; if (count - n >= 3)
p_sys->segment = n; {
b_found = true; 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) ...@@ -1626,9 +1632,12 @@ static int segment_Seek(stream_t *s, uint64_t pos)
while ((p_sys->thread->seek != -1) || while ((p_sys->thread->seek != -1) ||
(p_sys->thread->segment - p_sys->segment < 3)) (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); vlc_cond_wait(&p_sys->thread->wait, &p_sys->thread->lock_wait);
if (!vlc_object_alive (s) || if (!vlc_object_alive(s) || s->b_error) break;
s->b_error) break;
} }
vlc_mutex_unlock(&p_sys->thread->lock_wait); vlc_mutex_unlock(&p_sys->thread->lock_wait);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment