[calls] sip: media-pipeline: Debug pipeline graph on SIGUSR2



commit 5d0ae4a6fa499c358bd3f0634fbc8ea74b1222ef
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date:   Thu Apr 7 18:56:24 2022 +0200

    sip: media-pipeline: Debug pipeline graph on SIGUSR2
    
    Ust GST_DEBUG_BIN_TO_DOT_FILE to generate a dot graph of a pipeline for
    debugging purposes when SIGUSR2 is received.
    
    Note the same signal is also used within the dummy plugin to simulate an
    incoming call from an unknown number, so when testing you probably want either
    the sip plugin or the dummy plugin, but not both.

 plugins/sip/calls-sip-media-pipeline.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
---
diff --git a/plugins/sip/calls-sip-media-pipeline.c b/plugins/sip/calls-sip-media-pipeline.c
index 476dda5a..6019f0ee 100644
--- a/plugins/sip/calls-sip-media-pipeline.c
+++ b/plugins/sip/calls-sip-media-pipeline.c
@@ -28,6 +28,7 @@
 #include "calls-sip-media-pipeline.h"
 #include "util.h"
 
+#include <glib-unix.h>
 #include <gst/gst.h>
 #include <gio/gio.h>
 
@@ -842,11 +843,38 @@ calls_sip_media_pipeline_class_init (CallsSipMediaPipelineClass *klass)
 }
 
 
+static gboolean
+usr2_handler (CallsSipMediaPipeline *self)
+{
+  g_print ("playing: %d\n"
+           "paused: %d\n"
+           "stopped: %d\n"
+           "target map: %d\n"
+           "current state: %d\n",
+           self->element_map_playing,
+           self->element_map_paused,
+           self->element_map_stopped,
+           EL_ALL_RTP,
+           self->state);
+
+  GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (self->pipeline),
+                                     GST_DEBUG_GRAPH_SHOW_ALL,
+                                     "usr2-debug");
+
+  return G_SOURCE_CONTINUE;
+}
+
+
 static void
 calls_sip_media_pipeline_init (CallsSipMediaPipeline *self)
 {
   if (!gst_is_initialized ())
     gst_init (NULL, NULL);
+
+  /* Pipeline debugging */
+  g_unix_signal_add (SIGUSR2,
+                     (GSourceFunc) usr2_handler,
+                     self);
 }
 
 


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