__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
// 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);