From cc0cd5eadf108f527895767f38b32c51affa928f Mon Sep 17 00:00:00 2001 From: Chen Chen Date: Mon, 31 Jan 2022 15:50:17 -0800 Subject: [PATCH] Spatial Audio: Add audio HAL interface for allowing or disallowing low latency audio Bug: 214615268 Test: build Tag: feature Change-Id: I5c9e26edb1271cd69a487409506cc1b93f49e111 --- bluetooth/audio/2.2/IBluetoothAudioProvider.hal | 8 ++++++++ .../audio/2.2/default/BluetoothAudioProvider.cpp | 12 ++++++++++++ bluetooth/audio/2.2/default/BluetoothAudioProvider.h | 2 ++ 3 files changed, 22 insertions(+) diff --git a/bluetooth/audio/2.2/IBluetoothAudioProvider.hal b/bluetooth/audio/2.2/IBluetoothAudioProvider.hal index f57753709c..7c91805619 100644 --- a/bluetooth/audio/2.2/IBluetoothAudioProvider.hal +++ b/bluetooth/audio/2.2/IBluetoothAudioProvider.hal @@ -69,4 +69,12 @@ interface IBluetoothAudioProvider extends @2.1::IBluetoothAudioProvider { * encoding. */ updateAudioConfiguration(AudioConfiguration audioConfig); + + /** + * Called when the supported latency mode is updated. + * + * @param allowed If the peripheral devices can't keep up with low latency + * mode, the API will be called with supported is false. + */ + setLowLatencyModeAllowed(bool allowed); }; diff --git a/bluetooth/audio/2.2/default/BluetoothAudioProvider.cpp b/bluetooth/audio/2.2/default/BluetoothAudioProvider.cpp index 202cfb9f90..62511e922a 100644 --- a/bluetooth/audio/2.2/default/BluetoothAudioProvider.cpp +++ b/bluetooth/audio/2.2/default/BluetoothAudioProvider.cpp @@ -209,6 +209,18 @@ Return BluetoothAudioProvider::updateAudioConfiguration( return Void(); } +Return BluetoothAudioProvider::setLowLatencyModeAllowed(bool allowed) { + LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_); + + if (stack_iface_ == nullptr) { + LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_) + << " has NO session"; + return Void(); + } + LOG(INFO) << __func__ << " allowed: " << allowed; + return Void(); +} + } // namespace implementation } // namespace V2_2 } // namespace audio diff --git a/bluetooth/audio/2.2/default/BluetoothAudioProvider.h b/bluetooth/audio/2.2/default/BluetoothAudioProvider.h index 425ea3b303..90c158e5b5 100644 --- a/bluetooth/audio/2.2/default/BluetoothAudioProvider.h +++ b/bluetooth/audio/2.2/default/BluetoothAudioProvider.h @@ -56,6 +56,8 @@ class BluetoothAudioProvider : public IBluetoothAudioProvider { Return updateAudioConfiguration( const AudioConfiguration& audioConfig) override; + Return setLowLatencyModeAllowed(bool allowed) override; + protected: sp death_recipient_;