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

Commit b26f5ca3 authored by Yun-Hao Chung's avatar Yun-Hao Chung
Browse files

Fix AVDTP reconfig not setting L2CAP flushable

We set the L2CAP for AVDTP to flushable when opening AVDTP at the first
time, but if the reconfiguration happens, the AVDTP could be run on a
different L2CAP channel which needs to set flushable again.

Bug: 361714491
Test: mma -j
Flag: com::android::bluetooth::flags::fix_avdt_rconfig_not_setting_l2cap
Change-Id: If4e791045a3f9f3010e8402137170dec589e0582
parent 5e71e36e
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -1176,7 +1176,8 @@ void bta_av_str_opened(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {

  /* Set the media channel as high priority */
  if (!L2CA_SetTxPriority(p_scb->l2c_cid, L2CAP_CHNL_PRIORITY_HIGH)) {
    log::warn("Unable to set L2CAP flush peer:{} cid:{}", p_scb->PeerAddress(), p_scb->l2c_cid);
    log::warn("Unable to set L2CAP Tx priority peer:{} cid:{}", p_scb->PeerAddress(),
              p_scb->l2c_cid);
  }
  if (!L2CA_SetChnlFlushability(p_scb->l2c_cid, true)) {
    log::warn("Unable to set L2CAP flush peer:{} cid:{}", p_scb->PeerAddress(), p_scb->l2c_cid);
@@ -2584,6 +2585,20 @@ void bta_av_rcfg_str_ok(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
    p_scb->p_cos->update_mtu(p_scb->hndl, p_scb->PeerAddress(), p_scb->stream_mtu);
  }

  if (com::android::bluetooth::flags::fix_avdt_rconfig_not_setting_l2cap()) {
    /* Set the media channel as high priority */
    if (!L2CA_SetTxPriority(p_scb->l2c_cid, L2CAP_CHNL_PRIORITY_HIGH)) {
      log::warn("Unable to set L2CAP Tx priority peer:{} cid:{}", p_scb->PeerAddress(),
                p_scb->l2c_cid);
    }

    if (!L2CA_SetChnlFlushability(p_scb->l2c_cid, true)) {
      log::warn("Unable to set L2CAP flush peer:{} cid:{}", p_scb->PeerAddress(), p_scb->l2c_cid);
    }

    L2CA_SetMediaStreamChannel(p_scb->l2c_cid, true);
  }

  /* rc listen */
  bta_av_st_rc_timer(p_scb, NULL);