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

Commit 97dd8bc5 authored by Cheney Ni's avatar Cheney Ni
Browse files

Refresh the encoder configuration of software while updating the MTU

In order to have better compatibility, peer parameters like the MTU are
necessary for packing AVDTP media frames. When reconfiguring the codec,
the encoder was updated before negotiated with remote, and needed to
update again after data channel opened. There was set audio config from
UIPC to help, and now we add the request after reconfigured.

Bug: 134125165
Test: manual
Change-Id: Ia823057b13cebde63d72f2a41aa744f1966eb20d
parent dbda8935
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1385,7 +1385,20 @@ void BtaAvCo::UpdateMtu(tBTA_AV_HNDL bta_av_handle,
        __func__, bta_av_handle, peer_address.ToString().c_str());
    return;
  }

  if (p_peer->mtu == mtu) return;

  p_peer->mtu = mtu;
  if (active_peer_ == p_peer) {
    LOG(INFO) << __func__ << ": update the codec encoder with peer "
              << peer_address << " bta_av_handle: " << loghex(bta_av_handle)
              << ", new MTU: " << mtu;
    // Send a request with NONE config values to update only the MTU.
    SetCodecAudioConfig(
        {.sample_rate = BTAV_A2DP_CODEC_SAMPLE_RATE_NONE,
         .bits_per_sample = BTAV_A2DP_CODEC_BITS_PER_SAMPLE_NONE,
         .channel_mode = BTAV_A2DP_CODEC_CHANNEL_MODE_NONE});
  }
}

bool BtaAvCo::SetActivePeer(const RawAddress& peer_address) {