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

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

Don't ignore the A2DP Sink preferred SBC codec config am: 37a5d291

am: 08991d69

Change-Id: I112318372ffefad47337aeb1f18c081552462a8b
parents 8e4c2a1b 08991d69
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -1250,6 +1250,17 @@ bool A2dpCodecConfigSbc::setCodecConfig(const uint8_t* p_peer_codec_info,
              __func__, status);
    goto fail;
  }
  // Try using the prefered peer codec config (if valid), instead of the peer
  // capability.
  if (is_capability && A2DP_IsPeerSinkCodecValidSbc(ota_codec_peer_config_)) {
    status = A2DP_ParseInfoSbc(&sink_info_cie, ota_codec_peer_config_, false);
    if (status != A2DP_SUCCESS) {
      // Use the peer codec capability
      status =
          A2DP_ParseInfoSbc(&sink_info_cie, p_peer_codec_info, is_capability);
      CHECK(status == A2DP_SUCCESS);
    }
  }

  //
  // Build the preferred configuration
@@ -1572,13 +1583,12 @@ bool A2dpCodecConfigSbc::setCodecConfig(const uint8_t* p_peer_codec_info,
  // Create a local copy of the peer codec capability/config, and the
  // result codec config.
  if (is_capability) {
    status = A2DP_BuildInfoSbc(AVDT_MEDIA_TYPE_AUDIO, &sink_info_cie,
                               ota_codec_peer_capability_);
    memcpy(ota_codec_peer_capability_, p_peer_codec_info,
           sizeof(ota_codec_peer_capability_));
  } else {
    status = A2DP_BuildInfoSbc(AVDT_MEDIA_TYPE_AUDIO, &sink_info_cie,
                               ota_codec_peer_config_);
    memcpy(ota_codec_peer_config_, p_peer_codec_info,
           sizeof(ota_codec_peer_config_));
  }
  CHECK(status == A2DP_SUCCESS);
  status = A2DP_BuildInfoSbc(AVDT_MEDIA_TYPE_AUDIO, &result_config_cie,
                             ota_codec_config_);
  CHECK(status == A2DP_SUCCESS);