OSDN Git Service

HFP: Don't use mSBC for HF devices not supporting Codec Negotiation
authorweichinweng <weichinweng@google.com>
Thu, 21 Jun 2018 06:28:25 +0000 (14:28 +0800)
committerJack He <siyuanh@google.com>
Thu, 21 Jun 2018 21:47:48 +0000 (14:47 -0700)
* Some misbehaving HF devices (e.g. Sony XAV AX100 carkit, Sony MW600)
  indicate their support on WBS but not support on Codec Negotiation.
  In this condition, if Fluoride chooses mSBC will result in big noise or SCO
  no sound.
* This CL adds a workaround for checking if HF device indicate codec negotiation is
  not supported, Fluoride will assume CVSD codec by default.

Bug: 101592600
Test: make, connect SCO and check voice on carkit and headset.
Change-Id: If0d8779bcfd55b87852f56f0448fd1b585ee45ad
(cherry picked from commit e4b9dead3c6be05f111fb710f9e4d7c436b65ed4)

bta/ag/bta_ag_sco.cc

index f28b3c2..083108b 100644 (file)
@@ -553,6 +553,14 @@ void bta_ag_codec_negotiate(tBTA_AG_SCB* p_scb) {
   APPL_TRACE_DEBUG("%s", __func__);
   bta_ag_cb.sco.p_curr_scb = p_scb;
 
+  // Workaround for misbehaving HFs such as Sony XAV AX100 car kit and Sony
+  // MW600 Headset, which indicate WBS support in SDP, but no codec
+  // negotiation support in BRSF. In this case, using mSBC codec can result
+  // background noise or no audio. Thus, defaulting to CVSD instead.
+  if (!(p_scb->peer_features & BTA_AG_PEER_FEAT_CODEC)) {
+    p_scb->sco_codec = UUID_CODEC_CVSD;
+  }
+
   if ((p_scb->codec_updated || p_scb->codec_fallback) &&
       (p_scb->peer_features & BTA_AG_PEER_FEAT_CODEC)) {
     /* Change the power mode to Active until SCO open is completed. */