GNOME Bugzilla – Bug 628938
audio performance issue
Last modified: 2010-09-17 16:37:23 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);
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.
(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
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?
This will break 16khz codecs.. Working around it is a bad idea.. Lets fix GStreamer instead.
The bug we really want to fix is #558250
WONTFIX then?
We'll fix it, just not here. Lets make it a duplicate. *** This bug has been marked as a duplicate of bug 558250 ***
(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.
Any way haw about error handling? Current code will just silently fail.
doesnt the current code just work ?
hech ... it is. no more questions.