OSDN Git Service

Media profile drop on ending the outgoing video call and music is heard locally
authorZhihai Xu <zhihaixu@google.com>
Thu, 16 May 2013 00:29:44 +0000 (17:29 -0700)
committerZhihai Xu <zhihaixu@google.com>
Tue, 21 May 2013 00:19:52 +0000 (17:19 -0700)
receive AVDTP_Suspend response rejection which cause the A2DP disocnnected.
There is collision of AVDTP_Suspend request:
We send AVDTP_Suspend request and the headset send AVDTP_Suspend request also at the same time.
then We send AVDTP_Suspend response, but the headset send AVDTP_Suspend response rejection
with error code bad state after it receive the AVDTP_Suspend response from us.
we call bta_av_suspend_cfm twice in this case:
the first time we will call bta_av_suspend_cfm without error after receive AVDTP_Suspend request from headset.
the second time we will call bta_av_suspend_cfm with error bad state after receive AVDTP_Suspend response rejection from headset.
To fix this problem, we should ignore the AVDTP_Suspend response rejection from headset
after receive AVDTP_Suspend request from headset.
After we receive AVDTP_Suspend request from headset, the scb state will be changed to AVDT_SCB_OPEN_ST from AVDT_SCB_STREAM_ST.
but when we receive AVDTP_Suspend response rejection from headset, we should ignore it when we are in AVDT_SCB_OPEN_ST.
and also currently we already ignore AVDTP_Suspend response when we are in AVDT_SCB_OPEN_ST,
I don't know why we didn't do it for AVDTP Suspend rejection.

issue 8735903

Change-Id: I8db3ea6e7e4edfea41f255e7e29b8c7255cf3d96

bta/av/bta_av_aact.c
stack/avdt/avdt_scb.c

index 6a407e0..0f92677 100644 (file)
@@ -2346,8 +2346,18 @@ void bta_av_suspend_cfm (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data)
     APPL_TRACE_DEBUG2 ("bta_av_suspend_cfm:audio_open_cnt = %d, err_code = %d",
         bta_av_cb.audio_open_cnt, err_code);
 
+    if (p_scb->started == FALSE)
+    {
+        /* handle the condition where there is a collision of SUSPEND req from either side
+        ** Second SUSPEND req could be rejected. Do not treat this as a failure
+        */
+        APPL_TRACE_WARNING1("bta_av_suspend_cfm: already suspended, ignore, err_code %d",
+                            err_code);
+        return;
+    }
+
     suspend_rsp.status = BTA_AV_SUCCESS;
-    if (err_code)
+    if (err_code && (err_code != AVDT_ERR_BAD_STATE))
     {
          /* Disable suspend feature only with explicit rejection(not with timeout) */
         if (err_code != AVDT_ERR_TIMEOUT)
index b44af06..07c141f 100644 (file)
@@ -369,7 +369,7 @@ const UINT8 avdt_scb_st_open[][AVDT_SCB_NUM_COLS] = {
 /* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_GETCONFIG_RSP,    AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
 /* MSG_OPEN_RSP_EVT */      {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
 /* MSG_START_RSP_EVT */     {AVDT_SCB_HDL_START_RSP,        AVDT_SCB_IGNORE,            AVDT_SCB_STREAM_ST},
-/* MSG_SUSPEND_RSP_EVT */   {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
+/* MSG_SUSPEND_RSP_EVT */   {AVDT_SCB_HDL_SUSPEND_RSP,      AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
 /* MSG_CLOSE_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},
 /* MSG_ABORT_RSP_EVT */     {AVDT_SCB_IGNORE,               AVDT_SCB_IGNORE,            AVDT_SCB_IDLE_ST},
 /* MSG_RECONFIG_RSP_EVT */  {AVDT_SCB_HDL_RECONFIG_RSP,     AVDT_SCB_IGNORE,            AVDT_SCB_OPEN_ST},