After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 685888 - Add a debug option to show the GStreamer pipeline
Add a debug option to show the GStreamer pipeline
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: VoIP
3.6.x
Other All
: Normal enhancement
: ---
Assigned To: empathy-maint
empathy-maint
Depends on:
Blocks:
 
 
Reported: 2012-10-10 13:53 UTC by Debarshi Ray
Modified: 2012-10-12 13:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
empathy-call: Add a debug option to dump the GStreamer pipeline (3.51 KB, patch)
2012-10-10 15:22 UTC, Debarshi Ray
none Details | Review
empathy-call: Add a debug option to dump the GStreamer pipeline (4.78 KB, patch)
2012-10-10 16:35 UTC, Debarshi Ray
reviewed Details | Review
empathy-call: Add a debug option to dump the GStreamer pipeline (4.84 KB, patch)
2012-10-12 12:47 UTC, Debarshi Ray
none Details | Review

Description Debarshi Ray 2012-10-10 13:53:19 UTC
Dumping the GStreamer pipeline to a DOT file can be useful while debugging VOIP issues.
Comment 1 Debarshi Ray 2012-10-10 15:22:15 UTC
Created attachment 226180 [details] [review]
empathy-call: Add a debug option to dump the GStreamer pipeline

This is what I have been using recently. With this you have:
Help -> Debug -> Gstreamer
                 Telepathy

Not sure what is the cleanest way to present this option.

Maybe I should set the GST_DEBUG_DUMP_DOT_DIR in the code itself? If yes, what would the default location be? pwd?
Comment 2 Debarshi Ray 2012-10-10 16:35:35 UTC
Created attachment 226187 [details] [review]
empathy-call: Add a debug option to dump the GStreamer pipeline

- Set GST_DEBUG_DUMP_DOT_DIR to g_get_tmp_dir (), if not already set.

- Run dot on the generated file and gtk_show_uri the png. If dot is not installed, this step will silently fail.
Comment 3 Guillaume Desmottes 2012-10-11 13:58:46 UTC
Review of attachment 226187 [details] [review]:

That doesn't seem to work here, I get "Error: dot: can't open lt-empathy-call-1349963767.dot" and I don't have any .dot file in /tmp.

::: src/empathy-call-window.c
@@ +1400,3 @@
+  dot_cmd = g_strdup_printf ("dot -Tpng -o %s.png %s.dot",
+      filename,
+  gchar *filename;

shouldn't you append dot_dir here to have the full path of the dot file?
Comment 4 Debarshi Ray 2012-10-12 12:17:38 UTC
(In reply to comment #3)
> Review of attachment 226187 [details] [review]:
> 
> That doesn't seem to work here, I get "Error: dot: can't open
> lt-empathy-call-1349963767.dot" and I don't have any .dot file in /tmp.

What does g_get_tmp_dir return on your setup?

> ::: src/empathy-call-window.c
> @@ +1400,3 @@
> +  dot_cmd = g_strdup_printf ("dot -Tpng -o %s.png %s.dot",
> +      filename,
> +  gchar *filename;
> 
> shouldn't you append dot_dir here to have the full path of the dot file?

Earlier, that is what I was doing. Then I thought that I will "clean it up" and switched to passing dot_dir as the working directory to g_spawn_async. It works for me. I am not running empathy from the source tree. I make install it to /opt and then run /opt/libexec/empathy-call manually.
Comment 5 Guillaume Desmottes 2012-10-12 12:28:29 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Review of attachment 226187 [details] [review] [details]:
> > 
> > That doesn't seem to work here, I get "Error: dot: can't open
> > lt-empathy-call-1349963767.dot" and I don't have any .dot file in /tmp.
> 
> What does g_get_tmp_dir return on your setup?

/tmp

> > ::: src/empathy-call-window.c
> > @@ +1400,3 @@
> > +  dot_cmd = g_strdup_printf ("dot -Tpng -o %s.png %s.dot",
> > +      filename,
> > +  gchar *filename;
> > 
> > shouldn't you append dot_dir here to have the full path of the dot file?
> 
> Earlier, that is what I was doing. Then I thought that I will "clean it up" and
> switched to passing dot_dir as the working directory to g_spawn_async. It works
> for me. I am not running empathy from the source tree. I make install it to
> /opt and then run /opt/libexec/empathy-call manually.

Oh I see.
Comment 6 Guillaume Desmottes 2012-10-12 12:40:10 UTC
gst_debug_bin_to_dot_file() is a no-op because priv_gst_dump_dot_dir is NULL.

It looks like gst.c:init_pre() (setting priv_gst_dump_dot_dir) is called before we set the env variable in Empathy.

If I manually set GST_DEBUG_DUMP_DOT_DIR it works fine.
Comment 7 Guillaume Desmottes 2012-10-12 12:42:05 UTC
Couldn't we just call g_setenv() before calling gst_debug_bin_to_dot_file() ?
Comment 8 Debarshi Ray 2012-10-12 12:47:38 UTC
Created attachment 226320 [details] [review]
empathy-call: Add a debug option to dump the GStreamer pipeline

Sorry about that. I had the environment variable set in my .bash_profile too, which is why it was working for me.

I have moved the g_setenv call to be done earlier in main.
Comment 9 Debarshi Ray 2012-10-12 12:49:13 UTC
(In reply to comment #7)
> Couldn't we just call g_setenv() before calling gst_debug_bin_to_dot_file() ?

Yes, we could too. But then I thought that calling it every time someone clicks the menuitem is not needed, right. We can just do it once per process.

I don't really care. :-)
Comment 10 Guillaume Desmottes 2012-10-12 12:56:58 UTC
Thanks it works now. I'd find it cleaner to set the env variable before calling gst_debug_bin_to_dot_file() and only if the variable is not set yet (so user can still override it if he wants to). That's an extra call each time we select the menu but I doubt people will spend their life generating this graph over and over again. :)
Comment 11 Debarshi Ray 2012-10-12 13:04:01 UTC
(In reply to comment #10)
> Thanks it works now. I'd find it cleaner to set the env variable before calling
> gst_debug_bin_to_dot_file() and only if the variable is not set yet (so user
> can still override it if he wants to).

The "only if the variable is not set" should work now because we call g_setenv with the 3rd parameter (gboolean overwrite) set to FALSE. So, if it is already set, it should be a no-op.

That said, I can move the call away from main just before gst_debug_bin_to_dot_file as you are saying.
Comment 12 Guillaume Desmottes 2012-10-12 13:07:49 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > Thanks it works now. I'd find it cleaner to set the env variable before calling
> > gst_debug_bin_to_dot_file() and only if the variable is not set yet (so user
> > can still override it if he wants to).
> 
> The "only if the variable is not set" should work now because we call g_setenv
> with the 3rd parameter (gboolean overwrite) set to FALSE. So, if it is already
> set, it should be a no-op.

Oh right.

> That said, I can move the call away from main just before
> gst_debug_bin_to_dot_file as you are saying.

Please do and then I think this patch is good to go.
Comment 13 Debarshi Ray 2012-10-12 13:23:51 UTC
(In reply to comment #12)
>> That said, I can move the call away from main just before
>> gst_debug_bin_to_dot_file as you are saying.
> 
> Please do and then I think this patch is good to go.

I just tried that and it is not working, and looking at your comment 6, it seems that the environment variable has to be set before GStreamer is initialized. I just checked Transmageddon and it also sets the environment variable before everything thing else.
Comment 14 Guillaume Desmottes 2012-10-12 13:51:40 UTC
Oh yeah of course. I'll merge thanks for your patch!
Comment 15 Guillaume Desmottes 2012-10-12 13:52:35 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.