Commit ca6d12b6 authored by Jean-Paul Saman's avatar Jean-Paul Saman

stream_filter/httplive.c: seeking in segments not downloaded yet. (WIP)

Allow seeking in segments not downloaded yet. Since the exact file size
for future segments is unknown seeking will be inaccurate.
parent 9c552199
...@@ -1432,19 +1432,28 @@ static int segment_Seek(stream_t *s, uint64_t pos) ...@@ -1432,19 +1432,28 @@ static int segment_Seek(stream_t *s, uint64_t pos)
uint64_t length = 0; uint64_t length = 0;
bool b_found = false; bool b_found = false;
vlc_mutex_lock(&hls->lock);
int count = vlc_array_count(hls->segments); int count = vlc_array_count(hls->segments);
for (int n = 0; n < count; n++) vlc_mutex_unlock(&hls->lock);
for (int n = 0; n < count && !b_found; n++)
{ {
/* FIXME: Seeking in segments not dowloaded is not supported. */ /* FIXME: Seeking in segments not dowloaded is not supported. */
vlc_mutex_lock(&hls->lock);
if (n >= hls->segment) if (n >= hls->segment)
{ {
msg_Err(s, "seeking in segment not downloaded yet."); msg_Err(s, "seeking in segment not downloaded yet.");
vlc_mutex_unlock(&hls->lock);
return VLC_EGENERIC; return VLC_EGENERIC;
} }
segment_t *segment = vlc_array_item_at_index(hls->segments, n); segment_t *segment = vlc_array_item_at_index(hls->segments, n);
if (segment == NULL) if (segment == NULL)
{
vlc_mutex_unlock(&hls->lock);
return VLC_EGENERIC; return VLC_EGENERIC;
}
vlc_mutex_unlock(&hls->lock);
vlc_mutex_lock(&segment->lock); vlc_mutex_lock(&segment->lock);
length += segment->size; length += segment->size;
......
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