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

stream_filter/httplive.c: cleanup

Cleanup NextSegment().
parent edf94bcb
...@@ -853,7 +853,7 @@ static int Download(stream_t *s, hls_stream_t *hls, segment_t *segment, int *cur ...@@ -853,7 +853,7 @@ static int Download(stream_t *s, hls_stream_t *hls, segment_t *segment, int *cur
if (hls->segment - s->p_sys->segment < 3) if (hls->segment - s->p_sys->segment < 3)
return VLC_SUCCESS; return VLC_SUCCESS;
/* check for devision by zero */ /* check for division by zero */
double ms = (double)duration / 1000.0; /* ms */ double ms = (double)duration / 1000.0; /* ms */
if (ms <= 0.0) if (ms <= 0.0)
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -1217,9 +1217,9 @@ static void Close(vlc_object_t *p_this) ...@@ -1217,9 +1217,9 @@ static void Close(vlc_object_t *p_this)
static segment_t *NextSegment(stream_t *s) static segment_t *NextSegment(stream_t *s)
{ {
stream_sys_t *p_sys = s->p_sys; stream_sys_t *p_sys = s->p_sys;
segment_t *segment; segment_t *segment = NULL;
do while(vlc_object_alive(s))
{ {
/* Is the next segment ready */ /* Is the next segment ready */
hls_stream_t *hls = hls_Get(p_sys->hls_stream, p_sys->current); hls_stream_t *hls = hls_Get(p_sys->hls_stream, p_sys->current);
...@@ -1232,18 +1232,18 @@ static segment_t *NextSegment(stream_t *s) ...@@ -1232,18 +1232,18 @@ static segment_t *NextSegment(stream_t *s)
if (segment->data != NULL) if (segment->data != NULL)
return segment; return segment;
/* Was the stream changed to another bitrate? */
if (!p_sys->b_meta) return NULL; if (!p_sys->b_meta) return NULL;
/* Was the stream changed to another bitrate? */
if (p_sys->current != p_sys->thread->current) if (p_sys->current != p_sys->thread->current)
{ {
/* YES it was */ /* YES it was */
msg_Info(s, "playback is switching from stream %d to %d", msg_Info(s, "playback is switching from stream %d to %d",
p_sys->current, p_sys->thread->current); p_sys->current, p_sys->thread->current);
p_sys->current = p_sys->thread->current; p_sys->current = p_sys->thread->current;
continue;
} }
else
{
#if 0 #if 0
/* Not downloaded yet, do it here */ /* Not downloaded yet, do it here */
if (Download(s, hls, segment, &p_sys->current) != VLC_SUCCESS) if (Download(s, hls, segment, &p_sys->current) != VLC_SUCCESS)
...@@ -1252,8 +1252,6 @@ static segment_t *NextSegment(stream_t *s) ...@@ -1252,8 +1252,6 @@ static segment_t *NextSegment(stream_t *s)
#endif #endif
return NULL; return NULL;
} }
}
while(vlc_object_alive(s));
return segment; return segment;
} }
...@@ -1341,7 +1339,7 @@ again: ...@@ -1341,7 +1339,7 @@ again:
segment = NextSegment(s); segment = NextSegment(s);
if (segment == NULL) if (segment == NULL)
{ {
msg_Err(s, "segment should have been availabe"); msg_Err(s, "segment should have been available");
return 0; /* eof? */ return 0; /* eof? */
} }
......
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