diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-audio-src.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/empathy-audio-src.c b/src/empathy-audio-src.c index bd3c433fa..350a29a8d 100644 --- a/src/empathy-audio-src.c +++ b/src/empathy-audio-src.c @@ -217,6 +217,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 (); @@ -227,11 +229,27 @@ empathy_audio_src_init (EmpathyGstAudioSrc *obj) gst_bin_add (GST_BIN (obj), priv->src); + /* Explicitly state what format we want from pulsesrc. This pushes resampling + * and format conversion as early as possible, lowering the amount of data + * transferred and thus improving performance. When moving to GStreamer + * 0.11/1.0, this should change so that we actually request what the encoder + * wants downstream. */ + caps = gst_caps_new_simple ("audio/x-raw-int", + "channels", G_TYPE_INT, 1, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", G_TYPE_INT, 32000, + NULL); + capsfilter = gst_element_factory_make ("capsfilter", 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); |