mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
hlsdemux: Directly convert GErrors to error messages
This will make sure that we don't leak debug information into the actual error message string and keep it behind the debug string.
This commit is contained in:
parent
bf003caf9d
commit
213883eb51
1 changed files with 14 additions and 20 deletions
|
@ -44,6 +44,15 @@
|
||||||
#include <gst/base/gsttypefindhelper.h>
|
#include <gst/base/gsttypefindhelper.h>
|
||||||
#include "gsthlsdemux.h"
|
#include "gsthlsdemux.h"
|
||||||
|
|
||||||
|
#define GST_ELEMENT_ERROR_FROM_ERROR(el, err) G_STMT_START { \
|
||||||
|
gchar *__dbg = g_strdup (err->message); \
|
||||||
|
GST_WARNING_OBJECT (el, "error: %s", __dbg); \
|
||||||
|
gst_element_message_full (GST_ELEMENT(el), GST_MESSAGE_ERROR, \
|
||||||
|
err->domain, err->code, \
|
||||||
|
NULL, __dbg, __FILE__, GST_FUNCTION, __LINE__); \
|
||||||
|
g_clear_error (&err); \
|
||||||
|
} G_STMT_END
|
||||||
|
|
||||||
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src_%u",
|
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src_%u",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_SOMETIMES,
|
GST_PAD_SOMETIMES,
|
||||||
|
@ -459,10 +468,7 @@ gst_hls_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
gst_uri_downloader_reset (demux->downloader);
|
gst_uri_downloader_reset (demux->downloader);
|
||||||
if (!gst_hls_demux_update_playlist (demux, FALSE, &err)) {
|
if (!gst_hls_demux_update_playlist (demux, FALSE, &err)) {
|
||||||
g_rec_mutex_unlock (&demux->stream_lock);
|
g_rec_mutex_unlock (&demux->stream_lock);
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (demux),
|
GST_ELEMENT_ERROR_FROM_ERROR (demux, err);
|
||||||
gst_message_new_error (GST_OBJECT_CAST (demux), err,
|
|
||||||
"Could not switch playlist"));
|
|
||||||
g_clear_error (&err);
|
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -488,10 +494,7 @@ gst_hls_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
if (!gst_hls_demux_update_playlist (demux, FALSE, &err)) {
|
if (!gst_hls_demux_update_playlist (demux, FALSE, &err)) {
|
||||||
g_rec_mutex_unlock (&demux->stream_lock);
|
g_rec_mutex_unlock (&demux->stream_lock);
|
||||||
|
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (demux),
|
GST_ELEMENT_ERROR_FROM_ERROR (demux, err);
|
||||||
gst_message_new_error (GST_OBJECT_CAST (demux), err,
|
|
||||||
"Could not switch playlist"));
|
|
||||||
g_clear_error (&err);
|
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1210,10 +1213,7 @@ gst_hls_demux_stream_loop (GstHLSDemux * demux)
|
||||||
GST_DEBUG_OBJECT (demux, "Retrying now");
|
GST_DEBUG_OBJECT (demux, "Retrying now");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (demux),
|
GST_ELEMENT_ERROR_FROM_ERROR (demux, err);
|
||||||
gst_message_new_error (GST_OBJECT_CAST (demux), err,
|
|
||||||
"Could not fetch the next fragment"));
|
|
||||||
g_clear_error (&err);
|
|
||||||
goto pause_task;
|
goto pause_task;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1366,10 +1366,7 @@ gst_hls_demux_updates_loop (GstHLSDemux * demux)
|
||||||
|
|
||||||
gst_m3u8_client_set_current (demux->client, child);
|
gst_m3u8_client_set_current (demux->client, child);
|
||||||
if (!gst_hls_demux_update_playlist (demux, FALSE, &err)) {
|
if (!gst_hls_demux_update_playlist (demux, FALSE, &err)) {
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (demux),
|
GST_ELEMENT_ERROR_FROM_ERROR (demux, err);
|
||||||
gst_message_new_error (GST_OBJECT_CAST (demux), err,
|
|
||||||
"Could not fetch the child playlist"));
|
|
||||||
g_error_free (err);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1423,10 +1420,7 @@ gst_hls_demux_updates_loop (GstHLSDemux * demux)
|
||||||
gst_util_uint64_scale (gst_m3u8_client_get_target_duration
|
gst_util_uint64_scale (gst_m3u8_client_get_target_duration
|
||||||
(demux->client), G_USEC_PER_SEC, 2 * GST_SECOND);
|
(demux->client), G_USEC_PER_SEC, 2 * GST_SECOND);
|
||||||
} else {
|
} else {
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (demux),
|
GST_ELEMENT_ERROR_FROM_ERROR (demux, err);
|
||||||
gst_message_new_error (GST_OBJECT_CAST (demux), err,
|
|
||||||
"Could not update the playlist"));
|
|
||||||
g_error_free (err);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue