Commit a9498add authored by Avishay Spitzer's avatar Avishay Spitzer Committed by Ilkka Ollakka
Browse files

In case of live streams, the reload thread did not wake up the download thread...


In case of live streams, the reload thread did not wake up the download thread and so new segments were not downloaded. Problem was fixed by sginalling the download thread with the condition variable.
Signed-off-by: Ilkka Ollakka's avatarIlkka Ollakka <ileoo@videolan.org>
parent b5c8fd26
......@@ -1341,7 +1341,7 @@ static int get_HTTPLiveMetaPlaylist(stream_t *s, vlc_array_t **streams)
/* Update hls_old (an existing member of p_sys->hls_stream) to match hls_new
(which represents a downloaded, perhaps newer version of the same playlist) */
static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t *hls_old)
static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t *hls_old, bool *stream_appended)
{
int count = vlc_array_count(hls_new->segments);
......@@ -1418,6 +1418,9 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t *
}
vlc_array_append(hls_old->segments, p);
msg_Info(s, "- segment %d appended", p->sequence);
// Signal download thread otherwise the segment will not get downloaded
*stream_appended = true;
}
}
......@@ -1434,6 +1437,9 @@ static int hls_ReloadPlaylist(stream_t *s)
{
stream_sys_t *p_sys = s->p_sys;
// Flag to indicate if we should signal download thread
bool stream_appended = false;
vlc_array_t *hls_streams = vlc_array_new();
if (hls_streams == NULL)
return VLC_ENOMEM;
......@@ -1469,12 +1475,24 @@ static int hls_ReloadPlaylist(stream_t *s)
vlc_array_append(p_sys->hls_stream, hls_new);
msg_Info(s, "new HLS stream appended (id=%d, bandwidth=%"PRIu64")",
hls_new->id, hls_new->bandwidth);
// New segment available - signal download thread
stream_appended = true;
}
else if (hls_UpdatePlaylist(s, hls_new, hls_old) != VLC_SUCCESS)
else if (hls_UpdatePlaylist(s, hls_new, hls_old, &stream_appended) != VLC_SUCCESS)
msg_Info(s, "failed updating HLS stream (id=%d, bandwidth=%"PRIu64")",
hls_new->id, hls_new->bandwidth);
}
vlc_array_destroy(hls_streams);
// Must signal the download thread otherwise new segments will not be downloaded at all!
if (stream_appended == true)
{
vlc_mutex_lock(&p_sys->download.lock_wait);
vlc_cond_signal(&p_sys->download.wait);
vlc_mutex_unlock(&p_sys->download.lock_wait);
}
return VLC_SUCCESS;
}
......
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