OSDN Git Service

Initialize sco codecs supported with CVSD
authorSatish Kodishala <skodisha@codeaurora.org>
Thu, 27 Aug 2015 05:21:45 +0000 (10:51 +0530)
committerAndre Eisenbach <eisenbach@google.com>
Thu, 3 Mar 2016 18:18:37 +0000 (18:18 +0000)
Usecase:
1. Connect headset/carkit supporting codec negotiation
   but does not send AT+BAC with available codecs.
2. Make a call and create SCO connection.
3. Transfer audio to AG from headset/carkit.
4. Transfer audio back to carkit.

Failure:
AG will not establish SCO connection with remote.

Rootcause:
We initialize codecs supported by remote as 0 and update
it with codecs received as part of AT+BAC. When AG sends
+BCS to start codec negotiation, it received AT+BCS=1 from
remote. Since 1 is not in the list of remote supported codecs
(0), AG will not create SCO connection in step#4.

Fix:
Initialize sco codecs supported by remote with mandatory
codec, CVSD.

Change-Id: Ibe0e1a7bd3e59e8618568d320acfbde88f3fc11e

bta/ag/bta_ag_act.c
bta/ag/bta_ag_cmd.c
bta/ag/bta_ag_main.c

index bc16357..3d52cef 100644 (file)
@@ -382,8 +382,8 @@ void bta_ag_rfc_fail(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
     p_scb->conn_service = 0;
     p_scb->peer_features = 0;
 #if (BTM_WBS_INCLUDED == TRUE )
-    p_scb->peer_codecs = BTA_AG_CODEC_NONE;
-    p_scb->sco_codec = BTA_AG_CODEC_NONE;
+    p_scb->peer_codecs = BTA_AG_CODEC_CVSD;
+    p_scb->sco_codec = BTA_AG_CODEC_CVSD;
 #endif
     p_scb->role = 0;
     p_scb->svc_conn = FALSE;
@@ -419,8 +419,8 @@ void bta_ag_rfc_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
     p_scb->conn_service = 0;
     p_scb->peer_features = 0;
 #if (BTM_WBS_INCLUDED == TRUE )
-    p_scb->peer_codecs = BTA_AG_CODEC_NONE;
-    p_scb->sco_codec = BTA_AG_CODEC_NONE;
+    p_scb->peer_codecs = BTA_AG_CODEC_CVSD;
+    p_scb->sco_codec = BTA_AG_CODEC_CVSD;
     /* Clear these flags upon SLC teardown */
     p_scb->codec_updated = FALSE;
     p_scb->codec_fallback = FALSE;
index afb919c..f54d687 100644 (file)
@@ -1240,7 +1240,7 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
             }
             else
             {
-                p_scb->peer_codecs = BTA_AG_CODEC_NONE;
+                p_scb->peer_codecs = BTA_AG_CODEC_CVSD;
                 APPL_TRACE_ERROR("Unexpected CMD:AT+BAC, Codec Negotiation is not supported");
             }
             break;
index 606b531..3abd1ef 100644 (file)
@@ -298,6 +298,8 @@ static tBTA_AG_SCB *bta_ag_scb_alloc(void)
             p_scb->sco_idx = BTM_INVALID_SCO_INDEX;
 #if (BTM_WBS_INCLUDED == TRUE )
             p_scb->codec_updated = FALSE;
+            p_scb->peer_codecs = BTA_AG_CODEC_CVSD;
+            p_scb->sco_codec = BTA_AG_CODEC_CVSD;
 #endif
             /* set up timers */
             p_scb->ring_timer = alarm_new("bta_ag.scb_ring_timer");