From c928e601bfd187ce69b1d484c4d5fc3496ef708d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Mon, 22 Apr 2024 20:16:08 +0200 Subject: [PATCH] clapper: Add pipeline debug graph dump support --- src/lib/clapper/clapper-playbin-bus.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/lib/clapper/clapper-playbin-bus.c b/src/lib/clapper/clapper-playbin-bus.c index 42e413e1..691cbf19 100644 --- a/src/lib/clapper/clapper-playbin-bus.c +++ b/src/lib/clapper/clapper-playbin-bus.c @@ -114,6 +114,17 @@ _set_object_prop (GQuark field_id, const GValue *value, GstObject *object) } */ +static inline void +dump_dot_file (ClapperPlayer *player, const gchar *name) +{ + gchar full_name[40]; + + g_snprintf (full_name, sizeof (full_name), "clapper.%p.%s", player, name); + + GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN_CAST (player->playbin), + GST_DEBUG_GRAPH_SHOW_ALL, full_name); +} + static void _perform_flush_seek (ClapperPlayer *player) { @@ -177,6 +188,8 @@ _handle_warning_msg (GstMessage *msg, ClapperPlayer *player) gst_message_parse_warning (msg, &error, &debug_info); GST_WARNING_OBJECT (player, "Warning: %s", error->message); + dump_dot_file (player, "WARNING"); + signal_id = g_signal_lookup ("warning", CLAPPER_TYPE_PLAYER); clapper_app_bus_post_error_signal (player->app_bus, @@ -196,6 +209,8 @@ _handle_error_msg (GstMessage *msg, ClapperPlayer *player) gst_message_parse_error (msg, &error, &debug_info); GST_ERROR_OBJECT (player, "Error: %s", error->message); + dump_dot_file (player, "ERROR"); + GST_OBJECT_LOCK (player); player->had_error = TRUE; GST_OBJECT_UNLOCK (player); @@ -560,6 +575,8 @@ _handle_state_changed_msg (GstMessage *msg, ClapperPlayer *player) GST_LOG_OBJECT (player, "State changed, old: %i, current: %i, pending: %i", old_state, player->current_state, pending_state); + dump_dot_file (player, gst_element_state_get_name (player->current_state)); + /* Seek operation is progressing as expected. Return as we do not * want to change ClapperPlayerState when seeking or rate changing. */ if ((player->seeking || player->speed_changing)