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

Commit be4d3bba authored by Zyan Wu's avatar Zyan Wu Committed by Automerger Merge Worker
Browse files

Feature: send delay report once configed am: 17bcf30b

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bt/+/14831525

Change-Id: Ib6c09763d41e505e405f35d8dd58c2db5e117529
parents 0155eb2a 17bcf30b
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -826,6 +826,11 @@
#define AVDT_PROTECT_SIZE 90
#endif

/* Default sink delay value in ms. */
#ifndef AVDT_SINK_DELAY_MS
#define AVDT_SINK_DELAY_MS 300
#endif

/******************************************************************************
 *
 * PAN
+50 −0
Original line number Diff line number Diff line
@@ -507,6 +507,56 @@ cc_test {
    },
}

cc_test {
    name: "net_test_stack_avdtp",
    defaults: ["fluoride_defaults"],
    test_suites: ["device-tests"],
    host_supported: true,
    test_options: {
        unit_test: true,
    },
    include_dirs: [
        "external/libldac/inc",
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/stack/include",
        "packages/modules/Bluetooth/system/utils/include",
    ],
    srcs: [
        "test/stack_avdtp_test.cc",
        "avdt/avdt_ad.cc",
        "avdt/avdt_api.cc",
        "avdt/avdt_ccb.cc",
        "avdt/avdt_ccb_act.cc",
        "avdt/avdt_l2c.cc",
        "avdt/avdt_scb.cc",
        "avdt/avdt_scb_act.cc",
        "test/common/mock_btu_layer.cc",
        "test/common/mock_stack_avdt_msg.cc",
        ":TestMockStackL2cap",
        ":TestMockStackAcl",
        ":TestMockStackA2dp",
        ":TestMockBta",
        ":TestMockDevice",
    ],
    shared_libs: [
        "libcrypto",
        "libcutils",
        "libprotobuf-cpp-lite",
    ],
    static_libs: [
        "libbt-common",
        "libbt-protos-lite",
        "liblog",
        "libosi",
        "libosi-AllocationTestHarness",
    ],
    sanitize: {
        address: true,
        cfi: true,
        misc_undefined: ["bounds"],
    },
}

cc_test {
    name: "net_test_stack_a2dp_native",
    defaults: ["fluoride_defaults"],
+2 −0
Original line number Diff line number Diff line
@@ -234,6 +234,7 @@ enum {
  AVDT_SCB_SND_SETCONFIG_REQ,
  AVDT_SCB_SND_SETCONFIG_REJ,
  AVDT_SCB_SND_SETCONFIG_RSP,
  AVDT_SCB_SND_SNK_DELAY_RPT_REQ,
  AVDT_SCB_SND_TC_CLOSE,
  AVDT_SCB_CB_ERR,
  AVDT_SCB_CONG_STATE,
@@ -911,6 +912,7 @@ extern void avdt_scb_snd_security_rsp(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data);
extern void avdt_scb_snd_setconfig_req(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data);
extern void avdt_scb_snd_setconfig_rej(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data);
extern void avdt_scb_snd_setconfig_rsp(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data);
extern void avdt_scb_snd_snk_delay_rpt_req(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data);
extern void avdt_scb_snd_tc_close(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data);
extern void avdt_scb_cb_err(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data);
extern void avdt_scb_cong_state(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data);
+2 −1
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@ const tAVDT_SCB_ACTION avdt_scb_action[] = {avdt_scb_hdl_abort_cmd,
                                            avdt_scb_snd_setconfig_req,
                                            avdt_scb_snd_setconfig_rej,
                                            avdt_scb_snd_setconfig_rsp,
                                            avdt_scb_snd_snk_delay_rpt_req,
                                            avdt_scb_snd_tc_close,
                                            avdt_scb_cb_err,
                                            avdt_scb_cong_state,
@@ -158,7 +159,7 @@ const uint8_t avdt_scb_st_idle[][AVDT_SCB_NUM_COLS] = {
    /* API_GETCONFIG_RSP_EVT */
    {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
    /* API_SETCONFIG_RSP_EVT */
    {AVDT_SCB_SND_SETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_CONF_ST},
    {AVDT_SCB_SND_SETCONFIG_RSP, AVDT_SCB_SND_SNK_DELAY_RPT_REQ, AVDT_SCB_CONF_ST},
    /* API_SETCONFIG_REJ_EVT */
    {AVDT_SCB_SND_SETCONFIG_REJ, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST},
    /* API_OPEN_RSP_EVT */
+35 −0
Original line number Diff line number Diff line
@@ -642,6 +642,33 @@ void avdt_scb_hdl_setconfig_rej(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data) {
      (tAVDT_CTRL*)&p_data->msg.hdr, p_scb->stream_config.scb_index);
}

/*******************************************************************************
 *
 * Function         avdt_scb_snd_snk_delay_rpt_req
 *
 * Description      This function sends the delay report request once it is sink
 *
 * Returns          Nothing.
 *
 ******************************************************************************/
void avdt_scb_snd_snk_delay_rpt_req(AvdtpScb* p_scb,
                                UNUSED_ATTR tAVDT_SCB_EVT* p_data) {
  if (p_scb->p_ccb == NULL) {
    return;
  }

  // In sink mode, report a fixed delay value when this device is the sink
  // side. Delay value in this function is in unit of 1/10ms.
  if (p_scb->stream_config.tsep != AVDT_TSEP_SNK) {
    return;
  }

  tAVDT_SCB_EVT evt;
  evt.apidelay.hdr.seid = p_scb->peer_seid;
  evt.apidelay.delay = AVDT_SINK_DELAY_MS * 10;
  avdt_scb_event(p_scb, AVDT_SCB_API_DELAY_RPT_REQ_EVT, &evt);
}

/*******************************************************************************
 *
 * Function         avdt_scb_hdl_setconfig_rsp
@@ -649,6 +676,10 @@ void avdt_scb_hdl_setconfig_rej(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data) {
 * Description      This function sends the SCB an AVDT_SCB_API_OPEN_REQ_EVT
 *                  to initiate sending of an open command message.
 *
 *                  This function sends the SCB an AVDT_SCB_API_DELAY_RPT_REQ_EVT
 *                  to initiate sending of delay report command message only
 *                  when the endpoint takes sink role.
 *
 * Returns          Nothing.
 *
 ******************************************************************************/
@@ -660,6 +691,10 @@ void avdt_scb_hdl_setconfig_rsp(AvdtpScb* p_scb,
    /* save configuration */
    p_scb->curr_cfg = p_scb->req_cfg;

    // In sink mode, report delay value when this device initiates the connection.
    // Delay reporting is sent before open request (i.e., in configured state).
    avdt_scb_snd_snk_delay_rpt_req(p_scb, p_data);

    /* initiate open */
    single.seid = p_scb->peer_seid;
    tAVDT_SCB_EVT avdt_scb_evt;
Loading