Commit 31b5a1b5 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

HLS: fix error in d781f87d and simplify

Close #7240
parent bb2d9d9c
...@@ -1280,6 +1280,7 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t * ...@@ -1280,6 +1280,7 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t *
msg_Info(s, "updating hls stream (program-id=%d, bandwidth=%"PRIu64") has %d segments", msg_Info(s, "updating hls stream (program-id=%d, bandwidth=%"PRIu64") has %d segments",
hls_new->id, hls_new->bandwidth, count); hls_new->id, hls_new->bandwidth, count);
vlc_mutex_lock(&hls_old->lock);
for (int n = 0; n < count; n++) for (int n = 0; n < count; n++)
{ {
segment_t *p = segment_GetSegment(hls_new, n); segment_t *p = segment_GetSegment(hls_new, n);
...@@ -1333,7 +1334,10 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t * ...@@ -1333,7 +1334,10 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t *
{ {
int last = vlc_array_count(hls_old->segments) - 1; int last = vlc_array_count(hls_old->segments) - 1;
segment_t *l = segment_GetSegment(hls_old, last); segment_t *l = segment_GetSegment(hls_old, last);
if (l == NULL) assert(0); if (l == NULL) {
vlc_mutex_unlock(&hls_old->lock);
return VLC_EGENERIC;
}
if ((l->sequence + 1) != p->sequence) if ((l->sequence + 1) != p->sequence)
{ {
...@@ -1352,9 +1356,6 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t * ...@@ -1352,9 +1356,6 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t *
vlc_mutex_unlock(&hls_old->lock); vlc_mutex_unlock(&hls_old->lock);
return VLC_SUCCESS; return VLC_SUCCESS;
fail_and_unlock:
vlc_mutex_unlock(&hls_old->lock);
return VLC_EGENERIC;
} }
static int hls_ReloadPlaylist(stream_t *s) static int hls_ReloadPlaylist(stream_t *s)
......
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