Commit 87dbc6c4 authored by Nicolas Dufresne's avatar Nicolas Dufresne

mss: Dump pipeline on errors

I had to debug a not link issue while reworking the pipeline.
parent 2abfc914
...@@ -32,12 +32,15 @@ sigint_handler (gpointer user_data) ...@@ -32,12 +32,15 @@ sigint_handler (gpointer user_data)
static gboolean static gboolean
gst_bus_cb (GstBus * bus, GstMessage * message, gpointer data) gst_bus_cb (GstBus * bus, GstMessage * message, gpointer data)
{ {
GstBin *pipeline = GST_BIN (data);
switch (GST_MESSAGE_TYPE(message)) { switch (GST_MESSAGE_TYPE(message)) {
case GST_MESSAGE_ERROR: case GST_MESSAGE_ERROR:
{ {
GError *gerr; GError *gerr;
gchar *debug_msg; gchar *debug_msg;
gst_message_parse_error (message, &gerr, &debug_msg); gst_message_parse_error (message, &gerr, &debug_msg);
GST_DEBUG_BIN_TO_DOT_FILE (pipeline, GST_DEBUG_GRAPH_SHOW_ALL, "mss-pipeline-ERROR");
g_error ("Error: %s (%s)", gerr->message, debug_msg); g_error ("Error: %s (%s)", gerr->message, debug_msg);
g_error_free (gerr); g_error_free (gerr);
g_free (debug_msg); g_free (debug_msg);
...@@ -160,7 +163,6 @@ webrtc_client_connected_cb (MssHttpServer *server, MssClientId client_id, ...@@ -160,7 +163,6 @@ webrtc_client_connected_cb (MssHttpServer *server, MssClientId client_id,
gst_caps_unref (caps); gst_caps_unref (caps);
g_signal_emit_by_name (webrtcbin, "create-offer", NULL, g_signal_emit_by_name (webrtcbin, "create-offer", NULL,
gst_promise_new_with_change_func ( gst_promise_new_with_change_func (
(GstPromiseChangeFunc) on_offer_created, webrtcbin,NULL)); (GstPromiseChangeFunc) on_offer_created, webrtcbin,NULL));
...@@ -258,18 +260,19 @@ static gboolean ...@@ -258,18 +260,19 @@ static gboolean
restart_source (gpointer user_data) restart_source (gpointer user_data)
{ {
struct RestartData *rd = user_data; struct RestartData *rd = user_data;
GstElement *tsparse; GstElement *e;
GstStateChangeReturn ret; GstStateChangeReturn ret;
gst_element_set_state (rd->src, GST_STATE_NULL); gst_element_set_state (rd->src, GST_STATE_NULL);
gst_element_set_locked_state (rd->src, TRUE); gst_element_set_locked_state (rd->src, TRUE);
tsparse = gst_bin_get_by_name (GST_BIN (rd->pipeline), "tsparse"); e = gst_bin_get_by_name (GST_BIN (rd->pipeline), "srtqueue");
gst_bin_add (GST_BIN (rd->pipeline), rd->src); gst_bin_add (GST_BIN (rd->pipeline), rd->src);
gst_element_link (rd->src, tsparse); if (!gst_element_link (rd->src, e))
g_assert_not_reached ();
gst_element_set_locked_state (rd->src, FALSE); gst_element_set_locked_state (rd->src, FALSE);
ret = gst_element_set_state (rd->src, GST_STATE_PLAYING); ret = gst_element_set_state (rd->src, GST_STATE_PLAYING);
g_assert (ret != GST_STATE_CHANGE_FAILURE); g_assert (ret != GST_STATE_CHANGE_FAILURE);
gst_object_unref (tsparse); gst_object_unref (e);
g_debug ("Restarted source after EOS"); g_debug ("Restarted source after EOS");
...@@ -360,7 +363,7 @@ int main (int argc, char *argv[]) ...@@ -360,7 +363,7 @@ int main (int argc, char *argv[])
g_free (pipeline_str); g_free (pipeline_str);
bus = gst_element_get_bus (pipeline); bus = gst_element_get_bus (pipeline);
gst_bus_add_watch (bus, gst_bus_cb, NULL); gst_bus_add_watch (bus, gst_bus_cb, pipeline);
gst_object_unref (bus); gst_object_unref (bus);
g_signal_connect (http_server, "ws-client-disconnected", g_signal_connect (http_server, "ws-client-disconnected",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment