SpatialAudio: Export LatencyMode functions to BluetoothAudioSession
BluetoothAudioSession utility supports latency control functions, so
audio_bluetooth_hw can get / set the LatencyMode easily.
Bug: 214615268
Bug: 218708371
Test: build
Tag: #feature
Change-Id: Ia85581c74fc91f406309539755d60d36c173f5e0
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h
index 6e390cc..5bf17bd 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h
@@ -27,6 +27,7 @@
#include <mutex>
#include <unordered_map>
+#include <vector>
namespace aidl {
namespace android {
@@ -120,7 +121,8 @@
***/
void OnSessionStarted(const std::shared_ptr<IBluetoothAudioPort> stack_iface,
const DataMQDesc* mq_desc,
- const AudioConfiguration& audio_config);
+ const AudioConfiguration& audio_config,
+ const std::vector<LatencyMode>& latency_modes);
/***
* The report function is used to report that the Bluetooth stack has ended
@@ -175,13 +177,15 @@
* Those control functions are for the bluetooth_audio module to start,
* suspend, stop stream, to check position, and to update metadata.
***/
- bool StartStream();
+ bool StartStream(bool low_latency);
bool SuspendStream();
void StopStream();
bool GetPresentationPosition(PresentationPosition& presentation_position);
void UpdateSourceMetadata(const struct source_metadata& source_metadata);
void UpdateSinkMetadata(const struct sink_metadata& sink_metadata);
- void SetLatencyMode(LatencyMode latency_mode);
+
+ std::vector<LatencyMode> GetSupportedLatencyModes();
+ void SetLatencyMode(const LatencyMode& latency_mode);
// The control function writes stream to FMQ
size_t OutWritePcmData(const void* buffer, size_t bytes);
@@ -202,6 +206,8 @@
std::unique_ptr<DataMQ> data_mq_;
// audio data configuration for both software and offloading
std::unique_ptr<AudioConfiguration> audio_config_;
+ std::vector<LatencyMode> latency_modes_;
+ bool low_latency_allowed_ = true;
// saving those registered bluetooth_audio's callbacks
std::unordered_map<uint16_t, std::shared_ptr<struct PortStatusCallbacks>>
@@ -234,4 +240,4 @@
} // namespace bluetooth
} // namespace hardware
} // namespace android
-} // namespace aidl
\ No newline at end of file
+} // namespace aidl