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 628938 - audio performance issue
audio performance issue
Status: RESOLVED DUPLICATE of bug 558250
Product: empathy
Classification: Core
Component: VoIP
unspecified
Other Linux
: Normal normal
: ---
Assigned To: empathy-maint
Depends on: 558250
Blocks:
 
 
Reported: 2010-09-07 06:46 UTC by Oleksij Rempel
Modified: 2010-09-17 16:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
error handling patch v1 (3.08 KB, patch)
2010-09-15 09:17 UTC, Oleksij Rempel
none Details | Review

Description Oleksij Rempel 2010-09-07 06:46:37 UTC
Hallo,

it was discussed on irc, but i will make it us bug report too, to make it formal.
By starting gstreamer pipeline audioresample and audioconvert prefer to set other format to pulsesrc, different from what encoder (speexenc) need.

research with "perf record empathy-av" show high load by audioresample (30%) what is higher than speexenc (17%) need.


To workaround this problem, i set capsfilter direct after pulsesrc.
This make audioresample sit silent.

Here is my workaround patch. The target is to fix gstreamer.


diff --git a/libempathy-gtk/empathy-audio-src.c b/libempathy-gtk/empathy-audio-src.c
index a3416f2..516fa27 100644
--- a/libempathy-gtk/empathy-audio-src.c
+++ b/libempathy-gtk/empathy-audio-src.c
@@ -92,6 +92,8 @@ empathy_audio_src_init (EmpathyGstAudioSrc *obj)
 {
   EmpathyGstAudioSrcPrivate *priv = EMPATHY_GST_AUDIO_SRC_GET_PRIVATE (obj);
   GstPad *ghost, *src;
+  GstElement *capsfilter;
+  GstCaps *caps;

   priv->peak_level = -G_MAXDOUBLE;
   priv->lock = g_mutex_new ();
@@ -105,11 +107,22 @@ empathy_audio_src_init (EmpathyGstAudioSrc *obj)

   fs_element_added_notifier_add (priv->notifier, GST_BIN (priv->src));

+  capsfilter = gst_element_factory_make ("capsfilter", NULL);
+  caps = gst_caps_new_simple ("audio/x-raw-int",
+    "rate", G_TYPE_INT, 8000,
+    "width", G_TYPE_INT, 16,
+    "depth", G_TYPE_INT, 16,
+    NULL);
+
+  g_object_set (G_OBJECT (capsfilter), "caps", caps, NULL);
+  gst_bin_add (GST_BIN (obj), capsfilter);
+  gst_element_link (priv->src, capsfilter);
+
   priv->volume = gst_element_factory_make ("volume", NULL);
   g_object_ref (priv->volume);

   gst_bin_add (GST_BIN (obj), priv->volume);
-  gst_element_link (priv->src, priv->volume);
+  gst_element_link (capsfilter, priv->volume);

   priv->level = gst_element_factory_make ("level", NULL);
   gst_bin_add (GST_BIN (obj), priv->level);
Comment 1 Olivier Crête 2010-09-07 09:02:27 UTC
Please check the return value of gst_element_link (and gst_bin_add while you're at it), these could fail..

Also, adding mnauw in CC since we see a similar bug on another platform.
Comment 2 Oleksij Rempel 2010-09-07 09:09:42 UTC
(In reply to comment #1)
> Please check the return value of gst_element_link (and gst_bin_add while you're
> at it), these could fail..
> 
> Also, adding mnauw in CC since we see a similar bug on another platform.

This is workaround patch, it should be fixed in gstreamer. If not and we wont to add this workaround to empathy, I'd prefer to add general function for for element_link and bin_add with error handling first, see my patch in Bug 628786
Comment 3 Oleksij Rempel 2010-09-15 09:17:34 UTC
Created attachment 170321 [details] [review]
error handling patch v1

I#dd lyke to apply this patch before capsfilter patch. 

I'm not sure about this part:

-  priv->volume = gst_element_factory_make ("volume", NULL);
-  g_object_ref (priv->volume);
-
-  gst_bin_add (GST_BIN (obj), priv->volume);

why do I need "g_object_ref (priv->volume)" here?
Comment 4 Olivier Crête 2010-09-17 13:27:16 UTC
This will break 16khz codecs.. Working around it is a bad idea.. Lets fix GStreamer instead.
Comment 5 Olivier Crête 2010-09-17 13:41:05 UTC
The bug we really want to fix is #558250
Comment 6 Guillaume Desmottes 2010-09-17 15:11:22 UTC
WONTFIX then?
Comment 7 Olivier Crête 2010-09-17 15:57:23 UTC
We'll fix it, just not here. Lets make it a duplicate.

*** This bug has been marked as a duplicate of bug 558250 ***
Comment 8 Oleksij Rempel 2010-09-17 16:18:33 UTC
(In reply to comment #4)
> This will break 16khz codecs.. Working around it is a bad idea.. Lets fix
> GStreamer instead.

If we set ... ! capsfilter caps="audio/x-raw-int,rate=[8000,16000]" it wont brake.
Comment 9 Oleksij Rempel 2010-09-17 16:19:54 UTC
Any way haw about error handling? Current code will just silently fail.
Comment 10 Olivier Crête 2010-09-17 16:32:40 UTC
doesnt the current code just work ?
Comment 11 Oleksij Rempel 2010-09-17 16:37:23 UTC
hech ... it is. no more questions.