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

Commit 091f4627 authored by Henri Chataing's avatar Henri Chataing
Browse files

system/stack: Use correct error codes in A2dpCodecConfigAacBase::setCodecConfig

Bug: 336232163
Test: atest pts-bot
Flag: EXEMPT, minor refactor
Change-Id: Ieb1409cac4364b1169190dd8feff5af2dc5630e7
parent 024d3e4b
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ static tA2DP_STATUS A2DP_ParseInfoAac(tA2DP_AAC_CIE* p_ie, const uint8_t* p_code
      return A2DP_INVALID_SAMPLING_FREQUENCY;
    }
    if (A2DP_BitsSet(p_ie->channelMode) == A2DP_SET_ZERO_BIT) {
      return A2DP_INVALID_CHANNEL_MODE;
      return A2DP_INVALID_CHANNELS;
    }

    return A2DP_SUCCESS;
@@ -246,7 +246,7 @@ static tA2DP_STATUS A2DP_ParseInfoAac(tA2DP_AAC_CIE* p_ie, const uint8_t* p_code
    return A2DP_INVALID_SAMPLING_FREQUENCY;
  }
  if (A2DP_BitsSet(p_ie->channelMode) != A2DP_SET_ONE_BIT) {
    return A2DP_INVALID_CHANNEL_MODE;
    return A2DP_INVALID_CHANNELS;
  }

  return A2DP_SUCCESS;
@@ -307,7 +307,7 @@ static tA2DP_STATUS A2DP_CodecInfoMatchesCapabilityAac(const tA2DP_AAC_CIE* p_ca

  /* Channel Mode */
  if ((cfg_cie.channelMode & p_cap->channelMode) == 0) {
    return A2DP_NOT_SUPPORTED_CHANNEL_MODE;
    return A2DP_NOT_SUPPORTED_CHANNELS;
  }

  return A2DP_SUCCESS;
@@ -966,8 +966,13 @@ tA2DP_STATUS A2dpCodecConfigAacBase::setCodecConfig(const uint8_t* p_peer_codec_
  //
  memset(&result_config_cie, 0, sizeof(result_config_cie));

  if ((peer_info_cie.objectType & p_a2dp_aac_caps->objectType) == 0) {
    return A2DP_NOT_SUPPORTED_OBJECT_TYPE;
  }

  // NOTE: Always assign the Object Type and Variable Bit Rate Support.
  result_config_cie.objectType = p_a2dp_aac_caps->objectType;

  // The Variable Bit Rate Support is disabled if either side disables it
  result_config_cie.variableBitRateSupport =
          p_a2dp_aac_caps->variableBitRateSupport & peer_info_cie.variableBitRateSupport;
@@ -1242,7 +1247,7 @@ tA2DP_STATUS A2dpCodecConfigAacBase::setCodecConfig(const uint8_t* p_peer_codec_
  if (codec_config_.channel_mode == BTAV_A2DP_CODEC_CHANNEL_MODE_NONE) {
    log::error("cannot match channel mode: source caps = 0x{:x} peer info = 0x{:x}",
               p_a2dp_aac_caps->channelMode, peer_info_cie.channelMode);
    status = A2DP_NOT_SUPPORTED_CHANNEL_MODE;
    status = A2DP_NOT_SUPPORTED_CHANNELS;
    goto fail;
  }