[PATCH spice-gtk v4 7/7] display-gst: Debug video pipeline on stream-start message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Victor Toso <me@xxxxxxxxxxxxxx>

On GST_MESSAGE_STREAM_START our stream is about to start and it seems
a good moment to debug GStreamer pipeline if requested.

That we can do with GST_DEBUG_BIN_TO_DOT_FILE() which iterates
recursively in the whole pipeline and generates a dot file with all
the information, the filename is 'spice-gtk-gst-pipeline-debug.dot'.

One can generate png image out of this dot file with the command:
  dot -Tpng -oimage.png spice-gtk-gst-pipeline-debug.dot

Not that GST_DEBUG_BIN_TO_DOT_FILE() will only work if Gstreamer was
configured with --gst-enable-gst-debug and the environment variable
GST_DEBUG_DUMP_DOT_DIR was properly set.

Full example:

1) GST_DEBUG_DUMP_DOT_DIR=/tmp remote-viewer ...
2) dot -Tpng -oimage.png spice-gtk-gst-pipeline-debug.dot

Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx>
Signed-off-by: Victor Toso <me@xxxxxxxxxxxxxx>
---
 src/channel-display-gst.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index df58de3..04710e8 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -298,7 +298,8 @@ static gboolean handle_pipeline_message(GstBus *bus, GstMessage *msg, gpointer v
 {
     SpiceGstDecoder *decoder = video_decoder;
 
-    if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_ERROR) {
+    switch(GST_MESSAGE_TYPE(msg)) {
+    case GST_MESSAGE_ERROR: {
         GError *err = NULL;
         gchar *debug_info = NULL;
         gst_message_parse_error(msg, &err, &debug_info);
@@ -312,6 +313,18 @@ static gboolean handle_pipeline_message(GstBus *bus, GstMessage *msg, gpointer v
 
         /* We won't be able to process any more frame anyway */
         free_pipeline(decoder);
+        break;
+    }
+    case GST_MESSAGE_STREAM_START:
+        GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(decoder->pipeline),
+                                  GST_DEBUG_GRAPH_SHOW_ALL
+                                    | GST_DEBUG_GRAPH_SHOW_FULL_PARAMS
+                                    | GST_DEBUG_GRAPH_SHOW_STATES,
+                                  "spice-gtk-gst-pipeline-debug");
+        break;
+    default:
+        /* not being handled */
+        break;
     }
     return TRUE;
 }
-- 
2.13.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]