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

Commit 5b5c68b0 authored by Jakub Rotkiewicz's avatar Jakub Rotkiewicz
Browse files

bta_av_aact: Remove unused code

p_data->ci_setconfig.num_seid is always 0 according to
invocations of bta_av_ci_setconfig.
Bug: 329809288
Flag: EXEMPT - minor refactor
Test: mmm packages/modules/Bluetooth

Change-Id: If99d6c701288a191461c8be0d1444f048be59185
parent 2bf4c772
Loading
Loading
Loading
Loading
+5 −19
Original line number Diff line number Diff line
@@ -1042,9 +1042,7 @@ void bta_av_security_rsp(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
 *
 ******************************************************************************/
void bta_av_setconfig_rsp(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
  uint8_t num = p_data->ci_setconfig.num_seid + 1;
  uint8_t avdt_handle = p_data->ci_setconfig.avdt_handle;
  uint8_t* p_seid = p_data->ci_setconfig.p_seid;
  int i;
  uint8_t local_sep;

@@ -1074,25 +1072,22 @@ void bta_av_setconfig_rsp(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
    if (p_data->ci_setconfig.recfg_needed) {
      p_scb->role |= BTA_AV_ROLE_SUSPEND_OPT;
    }
    log::verbose("recfg_needed:{} role:0x{:x} num:{}", p_data->ci_setconfig.recfg_needed,
                 p_scb->role, num);
    /* callout module tells BTA the number of "good" SEPs and their SEIDs.
     * getcap on these SEID */
    p_scb->num_seps = num;
    log::verbose("recfg_needed:{} role:0x{:x}", p_data->ci_setconfig.recfg_needed, p_scb->role);
    p_scb->num_seps = 1;

    if (p_scb->cur_psc_mask & AVDT_PSC_DELAY_RPT) {
      p_scb->SetAvdtpVersion(AVDT_VERSION_1_3);
    }

    if (A2DP_GetCodecType(p_scb->cfg.codec_info) == A2DP_MEDIA_CT_SBC || num > 1) {
    if (A2DP_GetCodecType(p_scb->cfg.codec_info) == A2DP_MEDIA_CT_SBC) {
      /* if SBC is used by the SNK as INT, discover req is not sent in
       * bta_av_config_ind.
       * call disc_res now */
      /* this is called in A2DP SRC path only, In case of SINK we don't need it
       */
      if (local_sep == AVDT_TSEP_SRC) {
        p_scb->p_cos->disc_res(p_scb->hndl, p_scb->PeerAddress(), num, num, 0,
                               UUID_SERVCLASS_AUDIO_SOURCE);
        p_scb->p_cos->disc_res(p_scb->hndl, p_scb->PeerAddress(), p_scb->num_seps, p_scb->num_seps,
                               0, UUID_SERVCLASS_AUDIO_SOURCE);
      }
    } else {
      /* we do not know the peer device and it is using non-SBC codec
@@ -1104,15 +1099,6 @@ void bta_av_setconfig_rsp(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
      return;
    }

    for (i = 1; i < num; i++) {
      log::verbose("sep_info[{}] SEID: {}", i, p_seid[i - 1]);
      /* initialize the sep_info[] to get capabilities */
      p_scb->sep_info[i].in_use = false;
      p_scb->sep_info[i].tsep = AVDT_TSEP_SNK;
      p_scb->sep_info[i].media_type = p_scb->media_type;
      p_scb->sep_info[i].seid = p_seid[i - 1];
    }

    /* only in case of local sep as SRC we need to look for other SEPs, In case
     * of SINK we don't */
    if (btif_av_src_sink_coexist_enabled()) {
+3 −13
Original line number Diff line number Diff line
@@ -68,11 +68,9 @@ void bta_av_ci_src_data_ready(tBTA_AV_CHNL chnl) {
 *
 ******************************************************************************/
void bta_av_ci_setconfig(tBTA_AV_HNDL bta_av_handle, uint8_t err_code, uint8_t category,
                         uint8_t num_seid, uint8_t* p_seid, bool recfg_needed,
                         uint8_t avdt_handle) {
  log::info(
          "bta_av_handle=0x{:x} err_code={} category={} num_seid={} recfg_needed={} avdt_handle={}",
          bta_av_handle, err_code, category, num_seid, recfg_needed, avdt_handle);
                         bool recfg_needed, uint8_t avdt_handle) {
  log::info("bta_av_handle=0x{:x} err_code={} category={} recfg_needed={} avdt_handle={}",
            bta_av_handle, err_code, category, recfg_needed, avdt_handle);

  tBTA_AV_CI_SETCONFIG* p_buf = (tBTA_AV_CI_SETCONFIG*)osi_malloc(sizeof(tBTA_AV_CI_SETCONFIG));

@@ -82,15 +80,7 @@ void bta_av_ci_setconfig(tBTA_AV_HNDL bta_av_handle, uint8_t err_code, uint8_t c
  p_buf->err_code = err_code;
  p_buf->category = category;
  p_buf->recfg_needed = recfg_needed;
  p_buf->num_seid = num_seid;
  p_buf->avdt_handle = avdt_handle;
  if (p_seid && num_seid) {
    p_buf->p_seid = (uint8_t*)(p_buf + 1);
    memcpy(p_buf->p_seid, p_seid, num_seid);
  } else {
    p_buf->p_seid = NULL;
    p_buf->num_seid = 0;
  }

  bta_sys_sendmsg(p_buf);
}
+0 −2
Original line number Diff line number Diff line
@@ -345,8 +345,6 @@ typedef struct {
  tBTA_AV_HNDL hndl;
  uint8_t err_code;
  uint8_t category;
  uint8_t num_seid;
  uint8_t* p_seid;
  bool recfg_needed;
  uint8_t avdt_handle; /* local sep type for which this stream will be set up */
} tBTA_AV_CI_SETCONFIG;
+1 −1
Original line number Diff line number Diff line
@@ -58,6 +58,6 @@ void bta_av_ci_src_data_ready(tBTA_AV_CHNL chnl);
 *
 ******************************************************************************/
void bta_av_ci_setconfig(tBTA_AV_HNDL bta_av_handle, uint8_t err_code, uint8_t category,
                         uint8_t num_seid, uint8_t* p_seid, bool recfg_needed, uint8_t avdt_handle);
                         bool recfg_needed, uint8_t avdt_handle);

#endif /* BTA_AV_CI_H */
+3 −4
Original line number Diff line number Diff line
@@ -447,7 +447,7 @@ void BtaAvCo::ProcessSetConfig(tBTA_AV_HNDL bta_av_handle, const RawAddress& pee
    log::error("could not find peer entry for bta_av_handle 0x{:x} peer {}", bta_av_handle,
               peer_address);
    // Call call-in rejecting the configuration
    bta_av_ci_setconfig(bta_av_handle, A2DP_BUSY, AVDT_ASC_CODEC, 0, nullptr, false, avdt_handle);
    bta_av_ci_setconfig(bta_av_handle, A2DP_BUSY, AVDT_ASC_CODEC, false, avdt_handle);
    return;
  }

@@ -515,7 +515,7 @@ void BtaAvCo::ProcessSetConfig(tBTA_AV_HNDL bta_av_handle, const RawAddress& pee
  if (status != A2DP_SUCCESS) {
    log::verbose("peer {} reject s={} c={}", p_peer->addr, status, category);
    // Call call-in rejecting the configuration
    bta_av_ci_setconfig(bta_av_handle, status, category, 0, nullptr, false, avdt_handle);
    bta_av_ci_setconfig(bta_av_handle, status, category, false, avdt_handle);
    return;
  }

@@ -524,8 +524,7 @@ void BtaAvCo::ProcessSetConfig(tBTA_AV_HNDL bta_av_handle, const RawAddress& pee
  p_peer->reconfig_needed = reconfig_needed;
  log::verbose("peer {} accept reconf={}", p_peer->addr, reconfig_needed);
  // Call call-in accepting the configuration
  bta_av_ci_setconfig(bta_av_handle, A2DP_SUCCESS, A2DP_SUCCESS, 0, nullptr, reconfig_needed,
                      avdt_handle);
  bta_av_ci_setconfig(bta_av_handle, A2DP_SUCCESS, A2DP_SUCCESS, reconfig_needed, avdt_handle);
}

void BtaAvCo::ProcessOpen(tBTA_AV_HNDL bta_av_handle, const RawAddress& peer_address,
Loading