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

stream_filter/httplive.c: sanity checking in GetSegment()

Print a warning if the download segment counter and playback segment counter are
less then 3 segments apart. Print and error if they are the same.
parent 9dffe0cb
...@@ -1660,7 +1660,7 @@ static segment_t *GetSegment(stream_t *s) ...@@ -1660,7 +1660,7 @@ static segment_t *GetSegment(stream_t *s)
{ {
p_sys->b_cache = hls->b_cache; p_sys->b_cache = hls->b_cache;
vlc_mutex_unlock(&hls->lock); vlc_mutex_unlock(&hls->lock);
return segment; goto check;
} }
} }
vlc_mutex_unlock(&hls->lock); vlc_mutex_unlock(&hls->lock);
...@@ -1695,7 +1695,7 @@ static segment_t *GetSegment(stream_t *s) ...@@ -1695,7 +1695,7 @@ static segment_t *GetSegment(stream_t *s)
p_sys->playback.current = i_stream; p_sys->playback.current = i_stream;
p_sys->b_cache = hls->b_cache; p_sys->b_cache = hls->b_cache;
vlc_mutex_unlock(&hls->lock); vlc_mutex_unlock(&hls->lock);
return segment; goto check;
} }
vlc_mutex_unlock(&hls->lock); vlc_mutex_unlock(&hls->lock);
...@@ -1709,6 +1709,14 @@ static segment_t *GetSegment(stream_t *s) ...@@ -1709,6 +1709,14 @@ static segment_t *GetSegment(stream_t *s)
} }
/* */ /* */
return NULL; return NULL;
check:
/* sanity check */
if (p_sys->thread->segment - p_sys->playback.segment == 0)
msg_Err(s, "playback will stall");
else if (p_sys->thread->segment - p_sys->playback.segment < 3)
msg_Warn(s, "playback in danger of stalling");
return segment;
} }
static ssize_t hls_Read(stream_t *s, uint8_t *p_read, unsigned int i_read) static ssize_t hls_Read(stream_t *s, uint8_t *p_read, unsigned int i_read)
......
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