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

Commit de938ffa authored by Henri Chataing's avatar Henri Chataing Committed by Gerrit Code Review
Browse files

Merge changes Ia0e9f6f6,I79eed6b1,Id9478398 into main

* changes:
  system/stack: Return correct error codes in A2DP_CodecInfoMatchesCapabilityAac
  system/bta: Use correct avdt handle for bta_av_setconfig_rej
  system/stack: Modify A2dpCodecConfig::IsSinkCodecSupported to return tA2DP_STATUS
parents 6a31c29d d0707426
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1740,12 +1740,11 @@ void bta_av_setconfig_rej(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
  uint8_t avdt_handle = p_data->ci_setconfig.avdt_handle;
  uint8_t err_code = p_data->ci_setconfig.err_code;

  bta_av_adjust_seps_idx(p_scb, avdt_handle);

  log::info("sep_idx={} avdt_handle={} bta_handle=0x{:x} err_code=0x{:x}", p_scb->sep_idx,
            p_scb->avdt_handle, p_scb->hndl, err_code);

  if (!com::android::bluetooth::flags::avdtp_error_codes()) {
    bta_av_adjust_seps_idx(p_scb, avdt_handle);
    err_code = AVDT_ERR_UNSUP_CFG;
  }

@@ -1753,7 +1752,7 @@ void bta_av_setconfig_rej(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
  // AVDT_ConfigRsp will interpret the event as RSP instead of REJ.
  log::assert_that(err_code != 0, "err_code != 0");

  AVDT_ConfigRsp(p_scb->avdt_handle, p_scb->avdt_label, err_code, 0);
  AVDT_ConfigRsp(avdt_handle, p_scb->avdt_label, err_code, 0);

  tBTA_AV bta_av_data = {
      .reject =
+1 −1
Original line number Diff line number Diff line
@@ -479,7 +479,7 @@ void BtaAvCo::ProcessSetConfig(tBTA_AV_HNDL bta_av_handle, const RawAddress& pee

    if (t_local_sep == AVDT_TSEP_SNK) {
      log::verbose("peer {} is A2DP Source", p_peer->addr);
      status = A2DP_IsSinkCodecSupported(p_codec_info) ? A2DP_SUCCESS : A2DP_INVALID_CODEC_TYPE;
      status = A2DP_IsSinkCodecSupported(p_codec_info);

      if (status == A2DP_SUCCESS) {
        // If Peer is Source, and our config subset matches with what is
+4 −5
Original line number Diff line number Diff line
@@ -260,9 +260,8 @@ bool A2DP_IsCodecValidAac(const uint8_t* p_codec_info) {
         (A2DP_ParseInfoAac(&cfg_cie, p_codec_info, true) == A2DP_SUCCESS);
}

bool A2DP_IsSinkCodecSupportedAac(const uint8_t* p_codec_info) {
  return A2DP_CodecInfoMatchesCapabilityAac(&a2dp_aac_sink_caps, p_codec_info, false) ==
         A2DP_SUCCESS;
tA2DP_STATUS A2DP_IsSinkCodecSupportedAac(const uint8_t* p_codec_info) {
  return A2DP_CodecInfoMatchesCapabilityAac(&a2dp_aac_sink_caps, p_codec_info, false);
}

// Checks whether A2DP AAC codec configuration matches with a device's codec
@@ -297,12 +296,12 @@ static tA2DP_STATUS A2DP_CodecInfoMatchesCapabilityAac(const tA2DP_AAC_CIE* p_ca

  /* Object Type */
  if ((cfg_cie.objectType & p_cap->objectType) == 0) {
    return A2DP_INVALID_OBJECT_TYPE;
    return A2DP_NOT_SUPPORTED_OBJECT_TYPE;
  }

  /* Sample Rate */
  if ((cfg_cie.sampleRate & p_cap->sampleRate) == 0) {
    return A2DP_INVALID_SAMPLING_FREQUENCY;
    return A2DP_NOT_SUPPORTED_SAMPLING_FREQUENCY;
  }

  /* Channel Mode */
+2 −3
Original line number Diff line number Diff line
@@ -1133,7 +1133,7 @@ bool A2DP_IsPeerSinkCodecValid(const uint8_t* p_codec_info) {
  return false;
}

bool A2DP_IsSinkCodecSupported(const uint8_t* p_codec_info) {
tA2DP_STATUS A2DP_IsSinkCodecSupported(const uint8_t* p_codec_info) {
  tA2DP_CODEC_TYPE codec_type = A2DP_GetCodecType(p_codec_info);

  switch (codec_type) {
@@ -1149,8 +1149,7 @@ bool A2DP_IsSinkCodecSupported(const uint8_t* p_codec_info) {
      break;
  }

  log::error("unsupported codec type 0x{:x}", codec_type);
  return false;
  return A2DP_NOT_SUPPORTED_CODEC_TYPE;
}

void A2DP_InitDefaultCodec(uint8_t* p_codec_info) { A2DP_InitDefaultCodecSbc(p_codec_info); }
+2 −3
Original line number Diff line number Diff line
@@ -273,9 +273,8 @@ bool A2DP_IsCodecValidSbc(const uint8_t* p_codec_info) {
         (A2DP_ParseInfoSbc(&cfg_cie, p_codec_info, true) == A2DP_SUCCESS);
}

bool A2DP_IsSinkCodecSupportedSbc(const uint8_t* p_codec_info) {
  return A2DP_CodecInfoMatchesCapabilitySbc(&a2dp_sbc_sink_caps, p_codec_info, false) ==
         A2DP_SUCCESS;
tA2DP_STATUS A2DP_IsSinkCodecSupportedSbc(const uint8_t* p_codec_info) {
  return A2DP_CodecInfoMatchesCapabilitySbc(&a2dp_sbc_sink_caps, p_codec_info, false);
}

void A2DP_InitDefaultCodecSbc(uint8_t* p_codec_info) {
Loading