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

Commit 4e92c0b5 authored by Pavlin Radoslavov's avatar Pavlin Radoslavov Committed by android-build-merger
Browse files

Merge "Ignore AAC bitrate from the A2DP Sink device if below a threshold" am:...

Merge "Ignore AAC bitrate from the A2DP Sink device if below a threshold" am: e7346fa4 am: b2fc6254
am: 883be9b4

Change-Id: I864927d830b020b240818911fb05d702589bfd3f
parents 78c41f5a 883be9b4
Loading
Loading
Loading
Loading
+11 −6
Original line number Original line Diff line number Diff line
@@ -960,16 +960,21 @@ bool A2dpCodecConfigAac::setCodecConfig(const uint8_t* p_peer_codec_info,
  result_config_cie.variableBitRateSupport =
  result_config_cie.variableBitRateSupport =
      a2dp_aac_caps.variableBitRateSupport;
      a2dp_aac_caps.variableBitRateSupport;


  // Set the bit rate to the smaller of the local and peer bit rate
  // Set the bit rate as follows:
  // However, make sure the bit rate doesn't go beyond a certain threshold
  // 1. If the Sink device reports a bogus bit rate
  if (sink_info_cie.bitRate == 0) {
  //    (bitRate < A2DP_AAC_MIN_BITRATE), then use the bit rate from our
    // NOTE: Some devices report bitRate of zero - in that case use our bitRate
  //    configuration. Examples of observed bogus bit rates are zero
  //    and 24576.
  // 2. If the Sink device reports valid bit rate
  //    (bitRate >= A2DP_AAC_MIN_BITRATE), then use the smaller
  //    of the Sink device's bit rate and the bit rate from our configuration.
  // In either case, the actual streaming bit rate will also consider the MTU.
  if (sink_info_cie.bitRate < A2DP_AAC_MIN_BITRATE) {
    // Bogus bit rate
    result_config_cie.bitRate = a2dp_aac_caps.bitRate;
    result_config_cie.bitRate = a2dp_aac_caps.bitRate;
  } else {
  } else {
    result_config_cie.bitRate =
    result_config_cie.bitRate =
        std::min(a2dp_aac_caps.bitRate, sink_info_cie.bitRate);
        std::min(a2dp_aac_caps.bitRate, sink_info_cie.bitRate);
    result_config_cie.bitRate = std::max(
        result_config_cie.bitRate, static_cast<uint32_t>(A2DP_AAC_MIN_BITRATE));
  }
  }


  //
  //