OSDN Git Service

Do not initiate SDP for incoming AVDTP connection
authorAyan Ghosh <abghosh@codeaurora.org>
Thu, 11 Dec 2014 12:26:02 +0000 (17:56 +0530)
committerAndre Eisenbach <eisenbach@google.com>
Wed, 23 Mar 2016 17:09:39 +0000 (17:09 +0000)
There are few instances when remote initiates L2CAP
channel for AVDTP signaling but keeps quite after that,
and later on timeout DUT goes for rest of the signalling
procedure but does sdp prior to the same.Few peer
devices deletes a2dp sink sdp record when there is an
ongoing connection, as a result sdp request fails and
DUT fails to proceed with signalling procedure and
connection setup fails.

This patch makes sure that DUT does not go for redundant
sdp request for AVDTP, provided remote has already
established L2cap connection for the same. SDP is done
explicitly only incase of outgoing AV connection.

This issue is seen with Nokia Es headset.

Change-Id: Id44368687d5b3f97bf0258f8d4ff75f185db23af

bta/av/bta_av_aact.c
bta/av/bta_av_int.h
bta/av/bta_av_main.c

index 66d8127..1b55540 100644 (file)
@@ -998,36 +998,47 @@ void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data)
 
     bta_sys_app_open(BTA_ID_AV, p_scb->app_id, p_scb->peer_addr);
 
+    if (p_scb->skip_sdp == TRUE)
+    {
+        tA2D_Service a2d_ser;
+        a2d_ser.avdt_version = AVDT_VERSION;
+        p_scb->skip_sdp = FALSE;
+        p_scb->uuid_int = p_data->api_open.uuid;
+        /* only one A2D find service is active at a time */
+        bta_av_cb.handle = p_scb->hndl;
+        APPL_TRACE_WARNING("%s: Skip Sdp for incoming A2dp connection", __func__);
+        bta_av_a2d_sdp_cback(TRUE, &a2d_ser);
+        return;
+    }
     /* allocate discovery database */
     if (p_scb->p_disc_db == NULL)
-    {
-        p_scb->p_disc_db = (tSDP_DISCOVERY_DB *)osi_malloc(BTA_AV_DISC_BUF_SIZE);
-    }
-
+        p_scb->p_disc_db = (tSDP_DISCOVERY_DB *) osi_malloc (BTA_AV_DISC_BUF_SIZE);
     /* only one A2D find service is active at a time */
     bta_av_cb.handle = p_scb->hndl;
 
-    /* set up parameters */
-    db_params.db_len = BTA_AV_DISC_BUF_SIZE;
-    db_params.num_attr = 3;
-    db_params.p_db = p_scb->p_disc_db;
-    db_params.p_attrs = attr_list;
-    p_scb->uuid_int = p_data->api_open.uuid;
-    if (p_scb->uuid_int == UUID_SERVCLASS_AUDIO_SINK)
-        sdp_uuid = UUID_SERVCLASS_AUDIO_SOURCE;
-    else if (p_scb->uuid_int == UUID_SERVCLASS_AUDIO_SOURCE)
-        sdp_uuid = UUID_SERVCLASS_AUDIO_SINK;
-
-    APPL_TRACE_DEBUG("uuid_int 0x%x, Doing SDP For 0x%x", p_scb->uuid_int,
-                     sdp_uuid);
-    if (A2D_FindService(sdp_uuid, p_scb->peer_addr, &db_params,
-                        bta_av_a2d_sdp_cback) == A2D_SUCCESS) {
-        return;
-    }
+    if(p_scb->p_disc_db)
+    {
+        /* set up parameters */
+        db_params.db_len = BTA_AV_DISC_BUF_SIZE;
+        db_params.num_attr = 3;
+        db_params.p_db = p_scb->p_disc_db;
+        db_params.p_attrs = attr_list;
+        p_scb->uuid_int = p_data->api_open.uuid;
+        if (p_scb->uuid_int == UUID_SERVCLASS_AUDIO_SINK)
+            sdp_uuid = UUID_SERVCLASS_AUDIO_SOURCE;
+        else if (p_scb->uuid_int == UUID_SERVCLASS_AUDIO_SOURCE)
+            sdp_uuid = UUID_SERVCLASS_AUDIO_SINK;
+
+        APPL_TRACE_DEBUG("%s: uuid_int 0x%x, Doing SDP For 0x%x", __func__,
+                        p_scb->uuid_int, sdp_uuid);
+        if(A2D_FindService(sdp_uuid, p_scb->peer_addr, &db_params,
+                        bta_av_a2d_sdp_cback) == A2D_SUCCESS)
+            return;
 
-    /* when the code reaches here, either the DB is NULL
-     * or A2D_FindService is not successful */
-    bta_av_a2d_sdp_cback(FALSE, NULL);
+        /* when the code reaches here, either the DB is NULL
+         * or A2D_FindService is not successful */
+        bta_av_a2d_sdp_cback(FALSE, NULL);
+    }
 }
 
 /*******************************************************************************
@@ -1073,6 +1084,7 @@ void bta_av_cleanup(tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data)
     }
     p_scb->offload_start_pending = FALSE;
 
+    p_scb->skip_sdp = FALSE;
     if (p_scb->deregistring)
     {
         /* remove stream */
@@ -3108,6 +3120,7 @@ void bta_av_open_at_inc (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data)
         tBTA_AV_API_OPEN *p_buf =
             (tBTA_AV_API_OPEN *)osi_malloc(sizeof(tBTA_AV_API_OPEN));
         memcpy(p_buf, &(p_scb->open_api), sizeof(tBTA_AV_API_OPEN));
+        p_scb->skip_sdp = TRUE;
         bta_sys_sendmsg(p_buf);
     }
 }
index 9d3a7d0..b3d06f0 100644 (file)
@@ -528,6 +528,7 @@ typedef struct
     BOOLEAN             no_rtp_hdr;     /* TRUE if add no RTP header*/
     UINT16              uuid_int;       /*intended UUID of Initiator to connect to */
     BOOLEAN             offload_start_pending;
+    BOOLEAN             skip_sdp;       /* Decides if sdp to be done prior to profile connection */
 } tBTA_AV_SCB;
 
 #define BTA_AV_RC_ROLE_MASK     0x10
index 22cc8d1..2da85c3 100644 (file)
@@ -595,6 +595,7 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
 
         p_scb->suspend_sup  = TRUE;
         p_scb->recfg_sup    = TRUE;
+        p_scb->skip_sdp     = FALSE;
 
         cs.p_ctrl_cback  = bta_av_dt_cback[p_scb->hdi];
         if(registr.chnl == BTA_AV_CHNL_AUDIO)