diff --git a/gst/hls/gsthlsdemux.c b/gst/hls/gsthlsdemux.c index 45d3e766b1..6dd779ac2b 100644 --- a/gst/hls/gsthlsdemux.c +++ b/gst/hls/gsthlsdemux.c @@ -557,15 +557,14 @@ gst_hls_demux_loop (GstHLSDemux * demux) } if (g_queue_is_empty (demux->queue)) { - if (demux->end_of_playlist) { + if (demux->end_of_playlist) goto end_of_playlist; - } - GST_TASK_WAIT (demux->task); - } - /* Check again if it's the end of the playlist in case we we reached */ - if (demux->end_of_playlist) { - goto end_of_playlist; + GST_TASK_WAIT (demux->task); + /* If the queue is still empty check again if it's the end of the + * playlist in case we reached it after beeing woken up */ + if (g_queue_is_empty (demux->queue) && demux->end_of_playlist) + goto end_of_playlist; } buf = g_queue_pop_head (demux->queue);