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

Commit 98e22e28 authored by Henri Chataing's avatar Henri Chataing
Browse files

system/stack: Modify A2dpCodecConfig::IsSinkCodecSupported to return tA2DP_STATUS

The exact status code will be required to respond accurately
to remote AVDTP SetConfiguration requests

Bug: 336232163
Test: m com.android.btservices
Flag: EXEMPT, no logical change
Change-Id: Id9478398a98f2c55c709dd5d80b3be62533be81c
parent ed75a70b
Loading
Loading
Loading
Loading
+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
+2 −3
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
+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) {
+2 −2
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ bool A2DP_IsVendorPeerSinkCodecValid(const uint8_t* p_codec_info) {
  return false;
}

bool A2DP_IsVendorSinkCodecSupported(const uint8_t* p_codec_info) {
tA2DP_STATUS A2DP_IsVendorSinkCodecSupported(const uint8_t* p_codec_info) {
  uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info);
  uint16_t codec_id = A2DP_VendorCodecGetCodecId(p_codec_info);

@@ -128,7 +128,7 @@ bool A2DP_IsVendorSinkCodecSupported(const uint8_t* p_codec_info) {
    return A2DP_IsVendorSinkCodecSupportedOpus(p_codec_info);
  }

  return false;
  return A2DP_NOT_SUPPORTED_CODEC_TYPE;
}

uint32_t A2DP_VendorCodecGetVendorId(const uint8_t* p_codec_info) {
Loading