Merge "Report broacast audio config to HAL" into main

This commit is contained in:
Silen Sun 2024-05-24 01:04:40 +00:00 committed by Gerrit Code Review
commit 9534a2dc4c

View file

@ -121,19 +121,42 @@ const AudioConfiguration BluetoothAudioSession::GetAudioConfig() {
void BluetoothAudioSession::ReportAudioConfigChanged(
const AudioConfiguration& audio_config) {
std::lock_guard<std::recursive_mutex> guard(mutex_);
if (com::android::btaudio::hal::flags::leaudio_report_broadcast_ac_to_hal()) {
if (session_type_ ==
SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
session_type_ ==
SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) {
if (audio_config.getTag() != AudioConfiguration::leAudioConfig) {
LOG(ERROR) << __func__ << " invalid audio config type for SessionType ="
<< toString(session_type_);
return;
}
} else if (session_type_ ==
SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH) {
if (audio_config.getTag() != AudioConfiguration::leAudioBroadcastConfig) {
LOG(ERROR) << __func__ << " invalid audio config type for SessionType ="
<< toString(session_type_);
return;
}
} else {
LOG(ERROR) << __func__ << " invalid SessionType ="
<< toString(session_type_);
return;
}
} else {
if (session_type_ !=
SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH &&
session_type_ !=
SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) {
return;
}
std::lock_guard<std::recursive_mutex> guard(mutex_);
if (audio_config.getTag() != AudioConfiguration::leAudioConfig) {
LOG(ERROR) << __func__ << " invalid audio config type for SessionType ="
<< toString(session_type_);
return;
}
}
audio_config_ = std::make_unique<AudioConfiguration>(audio_config);