diff options
author | Scott Lobdell <slobdell@google.com> | 2022-03-11 19:27:17 +0000 |
---|---|---|
committer | Scott Lobdell <slobdell@google.com> | 2022-03-11 19:57:09 +0000 |
commit | c9218ef1b82430a07d94f74c212a30e7ccc52975 (patch) | |
tree | 241b7fdeb6bdf1cf3af925ba8996f18faa8973d9 /system/audio_hal_interface/aidl/client_interface.cc | |
parent | a26bda4d37221f2f7ef750b413502091e3bcddd4 (diff) | |
parent | 480d2270b269a0e47bf475eb439111f3f966e2a9 (diff) |
Merge TP1A.220225.003
Change-Id: Id71ac466dbfe3707fe2e544ce22b1da8f474ec2b
Diffstat (limited to 'system/audio_hal_interface/aidl/client_interface.cc')
-rw-r--r-- | system/audio_hal_interface/aidl/client_interface.cc | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/system/audio_hal_interface/aidl/client_interface.cc b/system/audio_hal_interface/aidl/client_interface.cc index 9626ecdb40..6bf3bd7db2 100644 --- a/system/audio_hal_interface/aidl/client_interface.cc +++ b/system/audio_hal_interface/aidl/client_interface.cc @@ -232,6 +232,24 @@ bool BluetoothAudioClientInterface::UpdateAudioConfig( return true; } +bool BluetoothAudioClientInterface::SetLowLatencyModeAllowed(bool allowed) { + is_low_latency_allowed_ = allowed; + if (provider_ == nullptr) { + LOG(INFO) << __func__ + << ": BluetoothAudioHal nullptr"; + return false; + } + + auto aidl_retval = provider_->setLowLatencyModeAllowed(allowed); + if (!aidl_retval.isOk()) { + LOG(ERROR) << __func__ << ": BluetoothAudioHal failure: " + << aidl_retval.getDescription(); + return false; + } + return true; +} + + int BluetoothAudioClientInterface::StartSession() { std::lock_guard<std::mutex> guard(internal_mutex_); if (provider_ == nullptr) { @@ -249,9 +267,12 @@ int BluetoothAudioClientInterface::StartSession() { std::unique_ptr<DataMQ> data_mq; DataMQDesc mq_desc; - + std::vector<LatencyMode> latency_modes = {LatencyMode::FREE}; + if (is_low_latency_allowed_) { + latency_modes.push_back(LatencyMode::LOW_LATENCY); + } auto aidl_retval = provider_->startSession( - stack_if, transport_->GetAudioConfiguration(), &mq_desc); + stack_if, transport_->GetAudioConfiguration(), latency_modes, &mq_desc); if (!aidl_retval.isOk()) { LOG(FATAL) << __func__ << ": BluetoothAudioHal failure: " << aidl_retval.getDescription(); |