hlsdemux: make sure every bad update_playlist return sets an error

Otherwise it segfaults when reporting the error in the bus
This commit is contained in:
Thiago Santos 2015-12-22 10:15:39 -03:00
parent 11729cde80
commit a072101441

View file

@ -829,20 +829,20 @@ retry:
if (download == NULL) { if (download == NULL) {
gchar *base_uri; gchar *base_uri;
g_clear_error (err);
if (!update || main_checked if (!update || main_checked
|| !gst_m3u8_client_has_variant_playlist (demux->client)) { || !gst_m3u8_client_has_variant_playlist (demux->client)) {
g_free (uri); g_free (uri);
return FALSE; return FALSE;
} }
g_clear_error (err);
main_uri = gst_m3u8_client_get_uri (demux->client); main_uri = gst_m3u8_client_get_uri (demux->client);
GST_INFO_OBJECT (demux, GST_INFO_OBJECT (demux,
"Updating playlist %s failed, attempt to refresh variant playlist %s", "Updating playlist %s failed, attempt to refresh variant playlist %s",
uri, main_uri); uri, main_uri);
download = download =
gst_uri_downloader_fetch_uri (adaptive_demux->downloader, gst_uri_downloader_fetch_uri (adaptive_demux->downloader,
main_uri, NULL, TRUE, TRUE, TRUE, NULL); main_uri, NULL, TRUE, TRUE, TRUE, err);
g_free (main_uri); g_free (main_uri);
if (download == NULL) { if (download == NULL) {
g_free (uri); g_free (uri);
@ -858,6 +858,8 @@ retry:
"Failed to validate variant playlist encoding"); "Failed to validate variant playlist encoding");
g_free (uri); g_free (uri);
g_object_unref (download); g_object_unref (download);
g_set_error (err, GST_STREAM_ERROR, GST_STREAM_ERROR_WRONG_TYPE,
"Couldn't validate playlist encoding");
return FALSE; return FALSE;
} }
@ -874,6 +876,8 @@ retry:
uri, base_uri)) { uri, base_uri)) {
GST_WARNING_OBJECT (demux, "Failed to update the variant playlist"); GST_WARNING_OBJECT (demux, "Failed to update the variant playlist");
g_object_unref (download); g_object_unref (download);
g_set_error (err, GST_STREAM_ERROR, GST_STREAM_ERROR_FAILED,
"Couldn't update playlist");
return FALSE; return FALSE;
} }