2 * Copyright (C) 2011 Collabora Ltd.
4 * The code contained in this file is free software; you can redistribute
5 * it and/or modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either version
7 * 2.1 of the License, or (at your option) any later version.
9 * This file is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this code; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 * Authors: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
22 #include "empathy-audio-utils.h"
24 #include <pulse/pulseaudio.h>
26 #include "empathy-gsettings.h"
28 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
29 #include "empathy-debug.h"
32 empathy_audio_set_stream_properties (GstElement
*element
,
33 gboolean echo_cancellation
)
36 GSettings
*gsettings_call
;
37 gboolean echo_cancellation_setting
;
39 gsettings_call
= g_settings_new (EMPATHY_PREFS_CALL_SCHEMA
);
41 echo_cancellation_setting
= g_settings_get_boolean (gsettings_call
,
42 EMPATHY_PREFS_CALL_ECHO_CANCELLATION
);
44 DEBUG ("Echo cancellation: element allowed: %s, user enabled: %s",
45 echo_cancellation
? " yes" : "no",
46 echo_cancellation_setting
? " yes" : "no");
49 props
= gst_structure_new ("props",
50 PA_PROP_MEDIA_ROLE
, G_TYPE_STRING
, "phone",
53 if (echo_cancellation
&& echo_cancellation_setting
)
55 gst_structure_set (props
,
56 "filter.want", G_TYPE_STRING
, "echo-cancel",
60 g_object_set (element
, "stream-properties", props
, NULL
);
61 gst_structure_free (props
);
63 g_object_unref (gsettings_call
);