summaryrefslogtreecommitdiffstats
path: root/src/handsfree-audio.c
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2013-04-15 10:54:53 -0300
committerDenis Kenzior <denkenz@gmail.com>2013-04-15 07:08:26 -0500
commit600539ed2a812223e50994e33eba3d7bc6b57941 (patch)
tree792f25b8e7700d1aadc5f155bcb8f3322f898c7a /src/handsfree-audio.c
parent12df4fca9440e49b60f2b66352cc2cc6b07fa2b1 (diff)
downloadofono-600539ed2a812223e50994e33eba3d7bc6b57941.tar.bz2
handsfree-audio: Toggle wideband support when the agent registers
Each time an agent registers itself, we check if we support deferred setup and if the agent has mSBC as a codec, if both checks are true, we enable wideband speech support.
Diffstat (limited to 'src/handsfree-audio.c')
-rw-r--r--src/handsfree-audio.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
index fc3d15b4..c24e7876 100644
--- a/src/handsfree-audio.c
+++ b/src/handsfree-audio.c
@@ -646,7 +646,7 @@ static DBusMessage *am_agent_register(DBusConnection *conn,
unsigned char *codecs;
DBusMessageIter iter, array;
int length, i;
- gboolean has_cvsd = FALSE;
+ gboolean has_cvsd = FALSE, has_msbc = FALSE;
if (agent)
return __ofono_error_in_use(msg);
@@ -668,10 +668,17 @@ static DBusMessage *am_agent_register(DBusConnection *conn,
for (i = 0; i < length; i++) {
if (codecs[i] == HFP_CODEC_CVSD)
has_cvsd = TRUE;
- else if (codecs[i] != HFP_CODEC_MSBC)
+ else if (codecs[i] == HFP_CODEC_MSBC)
+ has_msbc = TRUE;
+ else
return __ofono_error_invalid_args(msg);
}
+ if (has_msbc && defer_setup == 1)
+ has_wideband = TRUE;
+ else
+ has_wideband = FALSE;
+
if (has_cvsd == FALSE) {
ofono_error("CVSD codec is mandatory");
return __ofono_error_invalid_args(msg);