On some live HLS streams, gst_hls_demux_switch_playlist causes
assertion failures because it tried to dereference a NULL fragment.
This is because g_queue_peek_tail sometimes was returning NULL and
this case was not being checked.
This patch does two things:
* move the g_queue_peek_tail inside the semaphore protection
* check if q_queue_peek_tail returns NULL
https://bugzilla.gnome.org/show_bug.cgi?id=708849
GstClockTime diff;
gsize size;
gint bitrate;
- GstFragment *fragment = g_queue_peek_tail (demux->queue);
+ GstFragment *fragment;
GstBuffer *buffer;
GST_M3U8_CLIENT_LOCK (demux->client);
- if (!demux->client->main->lists) {
+ fragment = g_queue_peek_tail (demux->queue);
+ if (!demux->client->main->lists || !fragment) {
GST_M3U8_CLIENT_UNLOCK (demux->client);
return TRUE;
}