docs: tutorial 1: error out if an error occurred in Hello World tutorial

Very confusing if it just exits silently with exit code 0 on error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1185>
This commit is contained in:
Tim-Philipp Müller 2021-10-18 18:20:10 +01:00 committed by GStreamer Marge Bot
parent 064f7bbbfa
commit 3809b9dca4

View file

@ -25,9 +25,14 @@ main (int argc, char *argv[])
gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE,
GST_MESSAGE_ERROR | GST_MESSAGE_EOS);
/* See next tutorial for proper error message handling/parsing */
if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) {
g_error ("An error occurred! Re-run with the GST_DEBUG=*:WARN environment "
"variable set for more details.");
}
/* Free resources */
if (msg != NULL)
gst_message_unref (msg);
gst_message_unref (msg);
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);