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

stream_filter/httplive.c: Terminate NextSegment() properly

fixup: 9b3bed2c
parent eaa82d6a
......@@ -1316,36 +1316,39 @@ static segment_t *NextSegment(stream_t *s)
{
/* Is the next segment ready */
hls_stream_t *hls = hls_Get(p_sys->hls_stream, i_stream);
if (hls == NULL) return NULL;
if (hls == NULL)
return NULL;
vlc_mutex_lock(&hls->lock);
segment = segment_GetSegment(hls, p_sys->segment);
if (segment == NULL)
goto fail;
{
vlc_mutex_unlock(&hls->lock);
break;
}
/* This segment is ready? */
if ((segment->data != NULL) &&
(p_sys->segment < p_sys->thread->segment))
goto segment_ok;
if (!p_sys->b_meta) goto fail;
vlc_mutex_unlock(&hls->lock);
if (!p_sys->b_meta)
break;
/* Was the stream changed to another bitrate? */
i_stream++;
if (i_stream >= vlc_array_count(p_sys->hls_stream))
goto fail;
vlc_mutex_unlock(&hls->lock);
break;
}
/* */
return NULL;
segment_ok:
p_sys->current = i_stream;
vlc_mutex_unlock(&hls->lock);
return segment;
fail:
vlc_mutex_unlock(&hls->lock);
return NULL;
}
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