From 4856308c50250b21b9674872e4f28c8dd5a20885 Mon Sep 17 00:00:00 2001 From: Jakub Tyszkowski Date: Thu, 4 Jan 2024 16:02:38 +0000 Subject: [PATCH] LeAudio/multicodec: Fix the async data path getter API Just like the returned data path configurations are split for each direction, the function arguments should also have the directional context. The vendor module might need to know which connection handles in the stream map are for the sink and which are for the source direction, to provide the proper data path configurations for each direction. Bug: 308428217 Bug: 307258939 Test: m android.hardware.bluetooth.audio-update-api Change-Id: I270b6f4631869e2180580c886f0b58bd777d2123 --- .../audio/IBluetoothAudioProvider.aidl | 6 ++++- .../audio/IBluetoothAudioProvider.aidl | 25 ++++++++++++++++++- .../aidl/default/BluetoothAudioProvider.cpp | 13 ++++++---- .../aidl/default/BluetoothAudioProvider.h | 10 +++++--- 4 files changed, 43 insertions(+), 11 deletions(-) diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl index f155634430..87401ff7fd 100644 --- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl @@ -45,7 +45,7 @@ interface IBluetoothAudioProvider { void setCodecPriority(in android.hardware.bluetooth.audio.CodecId codecId, int priority); List getLeAudioAseConfiguration(in @nullable List remoteSinkAudioCapabilities, in @nullable List remoteSourceAudioCapabilities, in List requirements); android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseQosConfigurationPair getLeAudioAseQosConfiguration(in android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseQosConfigurationRequirement qosRequirement); - android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDataPathConfigurationPair getLeAudioAseDatapathConfiguration(in android.hardware.bluetooth.audio.AudioContext context, in android.hardware.bluetooth.audio.LeAudioConfiguration.StreamMap[] streamMap); + android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDataPathConfigurationPair getLeAudioAseDatapathConfiguration(in @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.StreamConfig sinkConfig, in @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.StreamConfig sourceConfig); void onSinkAseMetadataChanged(in android.hardware.bluetooth.audio.IBluetoothAudioProvider.AseState state, int cigId, int cisId, in @nullable android.hardware.bluetooth.audio.MetadataLtv[] metadata); void onSourceAseMetadataChanged(in android.hardware.bluetooth.audio.IBluetoothAudioProvider.AseState state, int cigId, int cisId, in @nullable android.hardware.bluetooth.audio.MetadataLtv[] metadata); android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioBroadcastConfigurationSetting getLeAudioBroadcastConfiguration(in @nullable List remoteSinkAudioCapabilities, in android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioBroadcastConfigurationRequirement requirement); @@ -146,6 +146,10 @@ interface IBluetoothAudioProvider { @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDataPathConfiguration inputConfig; @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDataPathConfiguration outputConfig; } + parcelable StreamConfig { + android.hardware.bluetooth.audio.AudioContext context; + android.hardware.bluetooth.audio.LeAudioConfiguration.StreamMap[] streamMap; + } @Backing(type="byte") @VintfStability enum AseState { ENABLING = 0x00, diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl index 2e16f4e33f..8c6fe692b7 100644 --- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl @@ -518,15 +518,38 @@ interface IBluetoothAudioProvider { @nullable LeAudioDataPathConfiguration outputConfig; } + /** + * Stream Configuration + */ + parcelable StreamConfig { + /** + * Streaming Audio Context. + * This can serve as a hint for selecting the proper configuration by + * the offloader. + */ + AudioContext context; + /** + * Stream configuration, including connection handles and audio channel + * allocations. + */ + StreamMap[] streamMap; + } + /** * Used to get a data path configuration which dynamically depends on CIS * connection handles in StreamMap. This is used if non-dynamic data path * was not provided in LeAudioAseConfigurationSetting. Calling this during * the unicast audio stream establishment might slightly delay the stream * start. + * + * @param sinkConfig - remote sink device stream configuration + * @param sourceConfig - remote source device stream configuration + * + * @return LeAudioDataPathConfigurationPair */ LeAudioDataPathConfigurationPair getLeAudioAseDatapathConfiguration( - in AudioContext context, in StreamMap[] streamMap); + in @nullable StreamConfig sinkConfig, + in @nullable StreamConfig sourceConfig); /* * Audio Stream Endpoint state used to report Metadata changes on the remote diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp b/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp index bdba898a6a..8d03faec04 100644 --- a/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp +++ b/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp @@ -229,14 +229,17 @@ ndk::ScopedAStatus BluetoothAudioProvider::getLeAudioAseQosConfiguration( }; ndk::ScopedAStatus BluetoothAudioProvider::getLeAudioAseDatapathConfiguration( - const ::aidl::android::hardware::bluetooth::audio::AudioContext& in_context, - const std::vector<::aidl::android::hardware::bluetooth::audio:: - LeAudioConfiguration::StreamMap>& in_streamMap, + const std::optional<::aidl::android::hardware::bluetooth::audio:: + IBluetoothAudioProvider::StreamConfig>& + in_sinkConfig, + const std::optional<::aidl::android::hardware::bluetooth::audio:: + IBluetoothAudioProvider::StreamConfig>& + in_sourceConfig, ::aidl::android::hardware::bluetooth::audio::IBluetoothAudioProvider:: LeAudioDataPathConfigurationPair* _aidl_return) { /* TODO: Implement */ - (void)in_context; - (void)in_streamMap; + (void)in_sinkConfig; + (void)in_sourceConfig; (void)_aidl_return; return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); } diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProvider.h b/bluetooth/audio/aidl/default/BluetoothAudioProvider.h index 5064869ca3..2c21440ab2 100644 --- a/bluetooth/audio/aidl/default/BluetoothAudioProvider.h +++ b/bluetooth/audio/aidl/default/BluetoothAudioProvider.h @@ -71,10 +71,12 @@ class BluetoothAudioProvider : public BnBluetoothAudioProvider { ::aidl::android::hardware::bluetooth::audio::IBluetoothAudioProvider:: LeAudioAseQosConfigurationPair* _aidl_return) override; ndk::ScopedAStatus getLeAudioAseDatapathConfiguration( - const ::aidl::android::hardware::bluetooth::audio::AudioContext& - in_context, - const std::vector<::aidl::android::hardware::bluetooth::audio:: - LeAudioConfiguration::StreamMap>& in_streamMap, + const std::optional<::aidl::android::hardware::bluetooth::audio:: + IBluetoothAudioProvider::StreamConfig>& + in_sinkConfig, + const std::optional<::aidl::android::hardware::bluetooth::audio:: + IBluetoothAudioProvider::StreamConfig>& + in_sourceConfig, ::aidl::android::hardware::bluetooth::audio::IBluetoothAudioProvider:: LeAudioDataPathConfigurationPair* _aidl_return) override; ndk::ScopedAStatus onSinkAseMetadataChanged(