aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-11-10 03:00:10 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-11-11 22:01:07 +0800
commit8b9ee2a0f048ce6263efe0d0660ed04a53861adf (patch)
tree9ee947393f466ccf04f2154f910a8ac70e8a49cb
parentffaa3afe49651493d0dcb01eba1b6dcd1134eed1 (diff)
downloadgsoc2013-empathy-8b9ee2a0f048ce6263efe0d0660ed04a53861adf.tar
gsoc2013-empathy-8b9ee2a0f048ce6263efe0d0660ed04a53861adf.tar.gz
gsoc2013-empathy-8b9ee2a0f048ce6263efe0d0660ed04a53861adf.tar.bz2
gsoc2013-empathy-8b9ee2a0f048ce6263efe0d0660ed04a53861adf.tar.lz
gsoc2013-empathy-8b9ee2a0f048ce6263efe0d0660ed04a53861adf.tar.xz
gsoc2013-empathy-8b9ee2a0f048ce6263efe0d0660ed04a53861adf.tar.zst
gsoc2013-empathy-8b9ee2a0f048ce6263efe0d0660ed04a53861adf.zip
Don't turn on echo cancellation on the source if it's for raw conferences
https://bugzilla.gnome.org/show_bug.cgi?id=663842
-rw-r--r--libempathy-gtk/empathy-call-utils.c7
-rw-r--r--libempathy-gtk/empathy-call-utils.h3
-rw-r--r--src/empathy-audio-sink.c2
-rw-r--r--src/empathy-audio-src.c12
-rw-r--r--src/empathy-audio-src.h6
-rw-r--r--src/empathy-call-window.c25
6 files changed, 47 insertions, 8 deletions
diff --git a/libempathy-gtk/empathy-call-utils.c b/libempathy-gtk/empathy-call-utils.c
index adf4987ba..b6fe48d80 100644
--- a/libempathy-gtk/empathy-call-utils.c
+++ b/libempathy-gtk/empathy-call-utils.c
@@ -250,15 +250,16 @@ empathy_call_new_with_streams (const gchar *contact,
}
void
-empathy_call_set_stream_properties (GstElement *element)
+empathy_call_set_stream_properties (GstElement *element,
+ gboolean echo_cancellation)
{
GstStructure *props;
GSettings *gsettings_call;
- gboolean echo_cancellation;
gsettings_call = g_settings_new (EMPATHY_PREFS_CALL_SCHEMA);
- echo_cancellation = g_settings_get_boolean (gsettings_call,
+ echo_cancellation = echo_cancellation &&
+ g_settings_get_boolean (gsettings_call,
EMPATHY_PREFS_CALL_ECHO_CANCELLATION);
props = gst_structure_new ("props",
diff --git a/libempathy-gtk/empathy-call-utils.h b/libempathy-gtk/empathy-call-utils.h
index 87676161c..836103100 100644
--- a/libempathy-gtk/empathy-call-utils.h
+++ b/libempathy-gtk/empathy-call-utils.h
@@ -40,7 +40,8 @@ GHashTable * empathy_call_create_streamed_media_request (const gchar *contact,
gboolean initial_audio,
gboolean initial_video);
-void empathy_call_set_stream_properties (GstElement *element);
+void empathy_call_set_stream_properties (GstElement *element,
+ gboolean echo_cancellation);
G_END_DECLS
diff --git a/src/empathy-audio-sink.c b/src/empathy-audio-sink.c
index 3d4496cd1..7a8d42bfc 100644
--- a/src/empathy-audio-sink.c
+++ b/src/empathy-audio-sink.c
@@ -217,7 +217,7 @@ create_sink (void)
if (sink == NULL)
return NULL;
- empathy_call_set_stream_properties (sink);
+ empathy_call_set_stream_properties (sink, TRUE);
return sink;
}
diff --git a/src/empathy-audio-src.c b/src/empathy-audio-src.c
index 350a29a8d..24a2e8ed4 100644
--- a/src/empathy-audio-src.c
+++ b/src/empathy-audio-src.c
@@ -53,8 +53,6 @@ enum {
};
/* private structure */
-typedef struct _EmpathyGstAudioSrcPrivate EmpathyGstAudioSrcPrivate;
-
struct _EmpathyGstAudioSrcPrivate
{
gboolean dispose_has_run;
@@ -207,7 +205,7 @@ create_src (void)
if (src == NULL)
return NULL;
- empathy_call_set_stream_properties (src);
+ empathy_call_set_stream_properties (src, TRUE);
return src;
}
@@ -220,6 +218,7 @@ empathy_audio_src_init (EmpathyGstAudioSrc *obj)
GstElement *capsfilter;
GstCaps *caps;
+ obj->priv = priv;
priv->peak_level = -G_MAXDOUBLE;
priv->lock = g_mutex_new ();
@@ -517,6 +516,13 @@ empathy_audio_src_new (void)
}
void
+empathy_audio_src_set_echo_cancel (EmpathyGstAudioSrc *src,
+ gboolean enable)
+{
+ empathy_call_set_stream_properties (src->priv->src, enable);
+}
+
+void
empathy_audio_src_set_volume (EmpathyGstAudioSrc *src, gdouble volume)
{
EmpathyGstAudioSrcPrivate *priv = EMPATHY_GST_AUDIO_SRC_GET_PRIVATE (src);
diff --git a/src/empathy-audio-src.h b/src/empathy-audio-src.h
index 14813abc1..ff568ce30 100644
--- a/src/empathy-audio-src.h
+++ b/src/empathy-audio-src.h
@@ -29,6 +29,8 @@ G_BEGIN_DECLS
typedef struct _EmpathyGstAudioSrc EmpathyGstAudioSrc;
typedef struct _EmpathyGstAudioSrcClass EmpathyGstAudioSrcClass;
+typedef struct _EmpathyGstAudioSrcPrivate EmpathyGstAudioSrcPrivate;
+
struct _EmpathyGstAudioSrcClass {
GstBinClass parent_class;
@@ -36,6 +38,7 @@ struct _EmpathyGstAudioSrcClass {
struct _EmpathyGstAudioSrc {
GstBin parent;
+ EmpathyGstAudioSrcPrivate *priv;
};
GType empathy_audio_src_get_type (void);
@@ -59,6 +62,9 @@ GType empathy_audio_src_get_type (void);
GstElement *empathy_audio_src_new (void);
+void empathy_audio_src_set_echo_cancel (EmpathyGstAudioSrc *src, gboolean
+ enable);
+
void empathy_audio_src_set_volume (EmpathyGstAudioSrc *src, gdouble volume);
gdouble empathy_audio_src_get_volume (EmpathyGstAudioSrc *src);
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 8a4a3aa29..de29f15c0 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -2691,6 +2691,23 @@ empathy_call_window_channel_closed_cb (EmpathyCallHandler *handler,
}
static gboolean
+empathy_call_window_content_is_raw (TfContent *content)
+{
+ FsConference *conference;
+ gboolean israw;
+
+ g_object_get (content, "fs-conference", &conference, NULL);
+ g_assert (conference != NULL);
+
+ /* FIXME: Ugly hack, update when moving a packetization property into
+ * farstream */
+ israw = g_str_has_prefix (GST_OBJECT_NAME (conference), "fsrawconf");
+ gst_object_unref (conference);
+
+ return israw;
+}
+
+static gboolean
empathy_call_window_content_removed_cb (EmpathyCallHandler *handler,
TfContent *content,
EmpathyCallWindow *self)
@@ -3420,6 +3437,14 @@ empathy_call_window_content_added_cb (EmpathyCallHandler *handler,
switch (media_type)
{
case FS_MEDIA_TYPE_AUDIO:
+
+ /* For raw audio conferences assume that the receiver of the raw data
+ * wants it unprocessed, so turn off any echo cancellation and any
+ * other audio improvements that come with it */
+ empathy_audio_src_set_echo_cancel (
+ EMPATHY_GST_AUDIO_SRC (priv->audio_input),
+ !empathy_call_window_content_is_raw (content));
+
if (!gst_bin_add (GST_BIN (priv->pipeline), priv->audio_input))
{
g_warning ("Could not add audio source to pipeline");