gstplay: add warning message details check before post it

For some warning message which has no detail data, need check to avoid printing critical log.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3382>
This commit is contained in:
Elliot Chen 2022-11-10 14:39:12 +08:00 committed by GStreamer Marge Bot
parent e93f391139
commit b09b246fc8

View file

@ -1061,9 +1061,15 @@ warning_cb (G_GNUC_UNUSED GstBus * bus, GstMessage * msg, gpointer user_data)
GST_WARNING_OBJECT (self, "Warning: %s (%s, %d)", err->message,
g_quark_to_string (err->domain), err->code);
api_bus_post_message (self, GST_PLAY_MESSAGE_WARNING,
GST_PLAY_MESSAGE_DATA_WARNING, G_TYPE_ERROR, play_err,
GST_PLAY_MESSAGE_DATA_WARNING_DETAILS, GST_TYPE_STRUCTURE, details, NULL);
if (details != NULL) {
api_bus_post_message (self, GST_PLAY_MESSAGE_WARNING,
GST_PLAY_MESSAGE_DATA_WARNING, G_TYPE_ERROR, play_err,
GST_PLAY_MESSAGE_DATA_WARNING_DETAILS, GST_TYPE_STRUCTURE, details,
NULL);
} else {
api_bus_post_message (self, GST_PLAY_MESSAGE_WARNING,
GST_PLAY_MESSAGE_DATA_WARNING, G_TYPE_ERROR, play_err, NULL);
}
g_clear_error (&play_err);
g_clear_error (&err);