aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy-gtk/empathy-call-utils.c11
-rw-r--r--src/empathy-audio-sink.c19
-rw-r--r--src/empathy-audio-sink.h2
-rw-r--r--src/empathy-audio-src.c1
-rw-r--r--src/empathy-call-handler.c7
-rw-r--r--src/empathy-call-window.c17
6 files changed, 43 insertions, 14 deletions
diff --git a/libempathy-gtk/empathy-call-utils.c b/libempathy-gtk/empathy-call-utils.c
index b6fe48d80..16526d354 100644
--- a/libempathy-gtk/empathy-call-utils.c
+++ b/libempathy-gtk/empathy-call-utils.c
@@ -255,18 +255,23 @@ empathy_call_set_stream_properties (GstElement *element,
{
GstStructure *props;
GSettings *gsettings_call;
+ gboolean echo_cancellation_setting;
gsettings_call = g_settings_new (EMPATHY_PREFS_CALL_SCHEMA);
- echo_cancellation = echo_cancellation &&
- g_settings_get_boolean (gsettings_call,
+ echo_cancellation_setting = g_settings_get_boolean (gsettings_call,
EMPATHY_PREFS_CALL_ECHO_CANCELLATION);
+ DEBUG ("Echo cancellation: element allowed: %s, user enabled: %s",
+ echo_cancellation ? " yes" : "no",
+ echo_cancellation_setting ? " yes" : "no");
+
+
props = gst_structure_new ("props",
PA_PROP_MEDIA_ROLE, G_TYPE_STRING, "phone",
NULL);
- if (echo_cancellation)
+ if (echo_cancellation && echo_cancellation_setting)
{
gst_structure_set (props,
"filter.want", G_TYPE_STRING, "echo-cancel",
diff --git a/src/empathy-audio-sink.c b/src/empathy-audio-sink.c
index 7a8d42bfc..b35edb331 100644
--- a/src/empathy-audio-sink.c
+++ b/src/empathy-audio-sink.c
@@ -61,6 +61,7 @@ enum {
struct _EmpathyGstAudioSinkPrivate
{
GstElement *sink;
+ gboolean echo_cancel;
};
#define EMPATHY_GST_AUDIO_SINK_GET_PRIVATE(o) \
@@ -71,6 +72,7 @@ static void
empathy_audio_sink_init (EmpathyGstAudioSink *self)
{
self->priv = EMPATHY_GST_AUDIO_SINK_GET_PRIVATE (self);
+ self->priv->echo_cancel = TRUE;
}
static GstPad * empathy_audio_sink_request_new_pad (GstElement *self,
@@ -191,7 +193,7 @@ empathy_audio_sink_get_volume (EmpathyGstAudioSink *sink)
}
static GstElement *
-create_sink (void)
+create_sink (EmpathyGstAudioSink *self)
{
GstElement *sink;
const gchar *description;
@@ -217,7 +219,7 @@ create_sink (void)
if (sink == NULL)
return NULL;
- empathy_call_set_stream_properties (sink, TRUE);
+ empathy_call_set_stream_properties (sink, self->priv->echo_cancel);
return sink;
}
@@ -258,7 +260,7 @@ empathy_audio_sink_request_new_pad (GstElement *element,
gst_bin_add (GST_BIN (bin), volume);
- self->priv->sink = create_sink ();
+ self->priv->sink = create_sink (self);
if (self->priv->sink == NULL)
goto error;
@@ -311,3 +313,14 @@ empathy_audio_sink_release_pad (GstElement *element,
gst_pad_set_active (pad, FALSE);
gst_element_remove_pad (element, pad);
}
+
+void
+empathy_audio_sink_set_echo_cancel (EmpathyGstAudioSink *sink,
+ gboolean echo_cancel)
+{
+ DEBUG ("Sink echo cancellation setting: %s", echo_cancel ? "on" : "off");
+ sink->priv->echo_cancel = echo_cancel;
+ if (sink->priv->sink != NULL)
+ empathy_call_set_stream_properties (sink->priv->sink,
+ sink->priv->echo_cancel);
+}
diff --git a/src/empathy-audio-sink.h b/src/empathy-audio-sink.h
index cc21fc467..ceb0bbe36 100644
--- a/src/empathy-audio-sink.h
+++ b/src/empathy-audio-sink.h
@@ -63,6 +63,8 @@ GstElement *empathy_audio_sink_new (void);
void empathy_audio_sink_set_volume (EmpathyGstAudioSink *sink, gdouble volume);
gdouble empathy_audio_sink_get_volume (EmpathyGstAudioSink *sink);
+void empathy_audio_sink_set_echo_cancel (EmpathyGstAudioSink *sink,
+ gboolean echo_cancel);
G_END_DECLS
diff --git a/src/empathy-audio-src.c b/src/empathy-audio-src.c
index 24a2e8ed4..19af8877a 100644
--- a/src/empathy-audio-src.c
+++ b/src/empathy-audio-src.c
@@ -519,6 +519,7 @@ void
empathy_audio_src_set_echo_cancel (EmpathyGstAudioSrc *src,
gboolean enable)
{
+ DEBUG ("Src echo cancellation setting: %s", enable ? "on" : "off");
empathy_call_set_stream_properties (src->priv->src, enable);
}
diff --git a/src/empathy-call-handler.c b/src/empathy-call-handler.c
index 0477cd7c0..4014ad6c6 100644
--- a/src/empathy-call-handler.c
+++ b/src/empathy-call-handler.c
@@ -479,7 +479,7 @@ empathy_call_handler_class_init (EmpathyCallHandlerClass *klass)
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
g_cclosure_marshal_generic,
G_TYPE_BOOLEAN,
- 2, GST_TYPE_PAD, G_TYPE_UINT);
+ 2, TF_TYPE_CONTENT, GST_TYPE_PAD);
signals[CONTENT_ADDED] =
g_signal_new ("content-added", G_TYPE_FROM_CLASS (klass),
@@ -763,13 +763,10 @@ on_tf_content_src_pad_added_cb (TfContent *content,
FsCodec *codec,
EmpathyCallHandler *handler)
{
- guint media_type;
gboolean retval;
- g_object_get (content, "media-type", &media_type, NULL);
-
g_signal_emit (G_OBJECT (handler), signals[SRC_PAD_ADDED], 0,
- pad, media_type, &retval);
+ content, pad, &retval);
if (!retval)
g_idle_add (src_pad_added_error_idle, g_object_ref (content));
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index de29f15c0..9ecc47ba2 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -2868,7 +2868,8 @@ empathy_call_window_get_video_sink_pad (EmpathyCallWindow *self)
/* Called with global lock held */
static GstPad *
-empathy_call_window_get_audio_sink_pad (EmpathyCallWindow *self)
+empathy_call_window_get_audio_sink_pad (EmpathyCallWindow *self,
+ TfContent *content)
{
EmpathyCallWindowPriv *priv = GET_PRIV (self);
GstPad *pad;
@@ -2893,6 +2894,13 @@ empathy_call_window_get_audio_sink_pad (EmpathyCallWindow *self)
}
}
+ /* For raw audio conferences assume that the producer of the raw data
+ * has already processed it, so turn off any echo cancellation and any
+ * other audio improvements that come with it */
+ empathy_audio_sink_set_echo_cancel (
+ EMPATHY_GST_AUDIO_SINK (priv->audio_output),
+ !empathy_call_window_content_is_raw (content));
+
template = gst_element_class_get_pad_template (
GST_ELEMENT_GET_CLASS (priv->audio_output), "sink%d");
@@ -3343,20 +3351,23 @@ empathy_call_window_video_probe_cb (GstPad *pad,
/* Called from the streaming thread */
static gboolean
empathy_call_window_src_added_cb (EmpathyCallHandler *handler,
- GstPad *src, guint media_type, gpointer user_data)
+ TfContent *content, GstPad *src, gpointer user_data)
{
EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data);
EmpathyCallWindowPriv *priv = GET_PRIV (self);
gboolean retval = FALSE;
+ guint media_type;
GstPad *pad;
g_mutex_lock (priv->lock);
+ g_object_get (content, "media-type", &media_type, NULL);
+
switch (media_type)
{
case TP_MEDIA_STREAM_TYPE_AUDIO:
- pad = empathy_call_window_get_audio_sink_pad (self);
+ pad = empathy_call_window_get_audio_sink_pad (self, content);
break;
case TP_MEDIA_STREAM_TYPE_VIDEO:
g_idle_add (empathy_call_window_show_video_output_cb, self);