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

Commit a4500eb4 authored by Etienne Ruffieux's avatar Etienne Ruffieux Committed by Gerrit Code Review
Browse files

Merge "BT NE when codec dynamic switch" into main

parents bf342c43 73d42aff
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -389,6 +389,13 @@ class BtaAvCo {
   */
  bool SetActivePeer(const RawAddress& peer_address);

  /**
   * Save the reconfig codec
   *
   * @param new_codec_config the new codec config
   */
   void SaveCodec(const uint8_t* new_codec_config);

  /**
   * Get the encoder parameters for a peer.
   *
@@ -1465,6 +1472,10 @@ bool BtaAvCo::SetActivePeer(const RawAddress& peer_address) {
  return true;
}

void BtaAvCo::SaveCodec(const uint8_t* new_codec_config) {
  memcpy(codec_config_, new_codec_config, sizeof(codec_config_));
}

void BtaAvCo::GetPeerEncoderParameters(
    const RawAddress& peer_address,
    tA2DP_ENCODER_INIT_PEER_PARAMS* p_peer_params) {
@@ -2241,6 +2252,10 @@ bool bta_av_co_set_active_peer(const RawAddress& peer_address) {
  return bta_av_co_cb.SetActivePeer(peer_address);
}

void bta_av_co_save_codec(const uint8_t* new_codec_config) {
  return bta_av_co_cb.SaveCodec(new_codec_config);
}

void bta_av_co_get_peer_params(const RawAddress& peer_address,
                               tA2DP_ENCODER_INIT_PEER_PARAMS* p_peer_params) {
  bta_av_co_cb.GetPeerEncoderParameters(peer_address, p_peer_params);
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@
// Returns true on success, otherwise false.
bool bta_av_co_set_active_peer(const RawAddress& peer_addr);

void bta_av_co_save_codec(const uint8_t* new_codec_config);

// Gets the A2DP peer parameters that are used to initialize the encoder.
// The peer address is |peer_addr|.
// The parameters are stored in |p_peer_params|.
+3 −0
Original line number Diff line number Diff line
@@ -631,8 +631,11 @@ static void btif_a2dp_sink_decoder_update_event(
  btif_a2dp_sink_cb.rx_flush = false;
  APPL_TRACE_DEBUG("%s: reset to Sink role", __func__);

  bta_av_co_save_codec(p_buf->codec_info);

  btif_a2dp_sink_cb.decoder_interface =
      A2DP_GetDecoderInterface(p_buf->codec_info);

  if (btif_a2dp_sink_cb.decoder_interface == nullptr) {
    LOG_ERROR("%s: cannot stream audio: no source decoder interface", __func__);
    return;