Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73a8950f authored by Ayan Ghosh's avatar Ayan Ghosh Committed by Andre Eisenbach
Browse files

Do not initiate SDP for incoming AVDTP connection

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
parent 2921aa8a
Loading
Loading
Loading
Loading
+37 −24
Original line number Diff line number Diff line
@@ -998,15 +998,26 @@ 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);
    }

    /* only one A2D find service is active at a time */
    bta_av_cb.handle = p_scb->hndl;

    if(p_scb->p_disc_db)
    {
        /* set up parameters */
        db_params.db_len = BTA_AV_DISC_BUF_SIZE;
        db_params.num_attr = 3;
@@ -1018,17 +1029,17 @@ void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data)
        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);
        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) {
                        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);
    }
}

/*******************************************************************************
**
@@ -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);
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -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)