Merge changes from topic "bt-broadcast-aidl" am: b8e8c57ac6 am: b5c7afe32c am: d3acb83474

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1977699

Change-Id: I9a62ced42080cc4d9e35105189dc9a249f412861
This commit is contained in:
Treehugger Robot
2022-02-10 06:29:05 +00:00
committed by Automerger Merge Worker
22 changed files with 178 additions and 261 deletions

View File

@@ -37,4 +37,5 @@ union AudioConfiguration {
android.hardware.bluetooth.audio.PcmConfiguration pcmConfig; android.hardware.bluetooth.audio.PcmConfiguration pcmConfig;
android.hardware.bluetooth.audio.CodecConfiguration a2dpConfig; android.hardware.bluetooth.audio.CodecConfiguration a2dpConfig;
android.hardware.bluetooth.audio.LeAudioConfiguration leAudioConfig; android.hardware.bluetooth.audio.LeAudioConfiguration leAudioConfig;
android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration leAudioBroadcastConfig;
} }

View File

@@ -33,8 +33,9 @@
package android.hardware.bluetooth.audio; package android.hardware.bluetooth.audio;
@VintfStability @VintfStability
parcelable BroadcastConfiguration { parcelable LeAudioBroadcastConfiguration {
android.hardware.bluetooth.audio.BroadcastConfiguration.BroadcastStreamMap[] streamMap; android.hardware.bluetooth.audio.CodecType codecType;
android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration.BroadcastStreamMap[] streamMap;
@VintfStability @VintfStability
parcelable BroadcastStreamMap { parcelable BroadcastStreamMap {
char streamHandle; char streamHandle;

View File

@@ -34,12 +34,13 @@
package android.hardware.bluetooth.audio; package android.hardware.bluetooth.audio;
@VintfStability @VintfStability
parcelable LeAudioConfiguration { parcelable LeAudioConfiguration {
android.hardware.bluetooth.audio.LeAudioMode mode;
android.hardware.bluetooth.audio.LeAudioConfiguration.LeAudioModeConfig modeConfig;
android.hardware.bluetooth.audio.CodecType codecType; android.hardware.bluetooth.audio.CodecType codecType;
android.hardware.bluetooth.audio.LeAudioConfiguration.StreamMap[] streamMap;
int peerDelayUs;
android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig;
@VintfStability @VintfStability
union LeAudioModeConfig { parcelable StreamMap {
android.hardware.bluetooth.audio.UnicastConfiguration unicastConfig; char streamHandle;
android.hardware.bluetooth.audio.BroadcastConfiguration broadcastConfig; int audioChannelAllocation;
} }
} }

View File

@@ -1,40 +0,0 @@
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.bluetooth.audio;
@Backing(type="byte") @VintfStability
enum LeAudioMode {
UNKNOWN = 0,
UNICAST = 1,
BROADCAST = 2,
}

View File

@@ -42,4 +42,6 @@ enum SessionType {
LE_AUDIO_SOFTWARE_DECODING_DATAPATH = 5, LE_AUDIO_SOFTWARE_DECODING_DATAPATH = 5,
LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH = 6, LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH = 6,
LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH = 7, LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH = 7,
LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH = 8,
LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH = 9,
} }

View File

@@ -1,45 +0,0 @@
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.bluetooth.audio;
@VintfStability
parcelable UnicastConfiguration {
android.hardware.bluetooth.audio.UnicastConfiguration.UnicastStreamMap[] streamMap;
int peerDelay;
android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig;
@VintfStability
parcelable UnicastStreamMap {
char streamHandle;
int audioChannelAllocation;
}
}

View File

@@ -17,6 +17,7 @@
package android.hardware.bluetooth.audio; package android.hardware.bluetooth.audio;
import android.hardware.bluetooth.audio.CodecConfiguration; import android.hardware.bluetooth.audio.CodecConfiguration;
import android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration;
import android.hardware.bluetooth.audio.LeAudioConfiguration; import android.hardware.bluetooth.audio.LeAudioConfiguration;
import android.hardware.bluetooth.audio.PcmConfiguration; import android.hardware.bluetooth.audio.PcmConfiguration;
@@ -28,4 +29,5 @@ union AudioConfiguration {
PcmConfiguration pcmConfig; PcmConfiguration pcmConfig;
CodecConfiguration a2dpConfig; CodecConfiguration a2dpConfig;
LeAudioConfiguration leAudioConfig; LeAudioConfiguration leAudioConfig;
LeAudioBroadcastConfiguration leAudioBroadcastConfig;
} }

View File

@@ -19,7 +19,6 @@ package android.hardware.bluetooth.audio;
import android.hardware.bluetooth.audio.AudioLocation; import android.hardware.bluetooth.audio.AudioLocation;
import android.hardware.bluetooth.audio.CodecType; import android.hardware.bluetooth.audio.CodecType;
import android.hardware.bluetooth.audio.Lc3Capabilities; import android.hardware.bluetooth.audio.Lc3Capabilities;
import android.hardware.bluetooth.audio.LeAudioMode;
/** /**
* Used to specify the le audio broadcast codec capabilities for hardware offload. * Used to specify the le audio broadcast codec capabilities for hardware offload.

View File

@@ -16,14 +16,15 @@
package android.hardware.bluetooth.audio; package android.hardware.bluetooth.audio;
import android.hardware.bluetooth.audio.CodecType;
import android.hardware.bluetooth.audio.LeAudioCodecConfiguration; import android.hardware.bluetooth.audio.LeAudioCodecConfiguration;
@VintfStability @VintfStability
parcelable BroadcastConfiguration { parcelable LeAudioBroadcastConfiguration {
@VintfStability @VintfStability
parcelable BroadcastStreamMap { parcelable BroadcastStreamMap {
/* /*
* The connection handle used for a unicast or a broadcast group. * The connection handle used for a broadcast group.
* Range: 0x0000 to 0xEFFF * Range: 0x0000 to 0xEFFF
*/ */
char streamHandle; char streamHandle;
@@ -35,5 +36,6 @@ parcelable BroadcastConfiguration {
int audioChannelAllocation; int audioChannelAllocation;
LeAudioCodecConfiguration leAudioCodecConfig; LeAudioCodecConfiguration leAudioCodecConfig;
} }
CodecType codecType;
BroadcastStreamMap[] streamMap; BroadcastStreamMap[] streamMap;
} }

View File

@@ -16,22 +16,28 @@
package android.hardware.bluetooth.audio; package android.hardware.bluetooth.audio;
import android.hardware.bluetooth.audio.BroadcastConfiguration;
import android.hardware.bluetooth.audio.CodecType; import android.hardware.bluetooth.audio.CodecType;
import android.hardware.bluetooth.audio.LeAudioMode; import android.hardware.bluetooth.audio.LeAudioCodecConfiguration;
import android.hardware.bluetooth.audio.UnicastConfiguration;
@VintfStability @VintfStability
parcelable LeAudioConfiguration { parcelable LeAudioConfiguration {
@VintfStability @VintfStability
union LeAudioModeConfig { parcelable StreamMap {
UnicastConfiguration unicastConfig; /*
BroadcastConfiguration broadcastConfig; * The connection handle used for a unicast group.
* Range: 0x0000 to 0xEFFF
*/
char streamHandle;
/*
* Audio channel allocation is a bit field, each enabled bit means that given audio
* direction, i.e. "left", or "right" is used. Ordering of audio channels comes from the
* least significant bit to the most significant bit. The valus follows the Bluetooth SIG
* Audio Location assigned number.
*/
int audioChannelAllocation;
} }
/*
* The mode of the LE audio
*/
LeAudioMode mode;
LeAudioModeConfig modeConfig;
CodecType codecType; CodecType codecType;
StreamMap[] streamMap;
int peerDelayUs;
LeAudioCodecConfiguration leAudioCodecConfig;
} }

View File

@@ -1,25 +0,0 @@
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.bluetooth.audio;
@VintfStability
@Backing(type="byte")
enum LeAudioMode {
UNKNOWN,
UNICAST,
BROADCAST,
}

View File

@@ -33,19 +33,33 @@ enum SessionType {
*/ */
HEARING_AID_SOFTWARE_ENCODING_DATAPATH, HEARING_AID_SOFTWARE_ENCODING_DATAPATH,
/** /**
* Used when encoded by Bluetooth Stack and streaming to LE Audio device * Used when audio is encoded by the Bluetooth Stack and is streamed to LE
* Audio unicast device.
*/ */
LE_AUDIO_SOFTWARE_ENCODING_DATAPATH, LE_AUDIO_SOFTWARE_ENCODING_DATAPATH,
/** /**
* Used when decoded by Bluetooth Stack and streaming to audio framework * Used when audio is decoded by the Bluetooth Stack and is streamed to LE
* Audio unicast device.
*/ */
LE_AUDIO_SOFTWARE_DECODING_DATAPATH, LE_AUDIO_SOFTWARE_DECODING_DATAPATH,
/** /**
* Encoding is done by HW an there is control only * Used when audio is encoded by hardware offload and is streamed to LE
* Audio unicast device. This is a control path only.
*/ */
LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH, LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH,
/** /**
* Decoding is done by HW an there is control only * Used when audio is decoded by hardware offload and is streamed to LE
* Audio unicast device. This is a control path only.
*/ */
LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH, LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH,
/**
* Used when audio is encoded by the Bluetooth stack and is streamed to LE
* Audio broadcast channels.
*/
LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH,
/**
* Used when audio is encoded by hardware offload and is streamed to LE
* Audio broadcast channels. This is a control path only.
*/
LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH,
} }

View File

@@ -19,7 +19,6 @@ package android.hardware.bluetooth.audio;
import android.hardware.bluetooth.audio.AudioLocation; import android.hardware.bluetooth.audio.AudioLocation;
import android.hardware.bluetooth.audio.CodecType; import android.hardware.bluetooth.audio.CodecType;
import android.hardware.bluetooth.audio.Lc3Capabilities; import android.hardware.bluetooth.audio.Lc3Capabilities;
import android.hardware.bluetooth.audio.LeAudioMode;
/** /**
* Used to specify the le audio unicast codec capabilities for hardware offload. * Used to specify the le audio unicast codec capabilities for hardware offload.

View File

@@ -1,41 +0,0 @@
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.bluetooth.audio;
import android.hardware.bluetooth.audio.LeAudioCodecConfiguration;
@VintfStability
parcelable UnicastConfiguration {
@VintfStability
parcelable UnicastStreamMap {
/*
* The connection handle used for a unicast or a broadcast group.
* Range: 0x0000 to 0xEFFF
*/
char streamHandle;
/*
* Audio channel allocation is a bit field, each enabled bit means that given audio
* direction, i.e. "left", or "right" is used. Ordering of audio channels comes from the
* least significant bit to the most significant bit. The valus follows the Bluetooth SIG
* Audio Location assigned number.
*/
int audioChannelAllocation;
}
UnicastStreamMap[] streamMap;
int peerDelay;
LeAudioCodecConfiguration leAudioCodecConfig;
}

View File

@@ -64,6 +64,14 @@ ndk::ScopedAStatus BluetoothAudioProviderFactory::openProvider(
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH: case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
provider = ndk::SharedRefBase::make<LeAudioOffloadInputAudioProvider>(); provider = ndk::SharedRefBase::make<LeAudioOffloadInputAudioProvider>();
break; break;
case SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH:
provider =
ndk::SharedRefBase::make<LeAudioSoftwareBroadcastAudioProvider>();
break;
case SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
provider =
ndk::SharedRefBase::make<LeAudioOffloadBroadcastAudioProvider>();
break;
default: default:
provider = nullptr; provider = nullptr;
break; break;
@@ -93,7 +101,10 @@ ndk::ScopedAStatus BluetoothAudioProviderFactory::getProviderCapabilities(
} else if (session_type == } else if (session_type ==
SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH || SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
session_type == session_type ==
SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) { SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH ||
session_type ==
SessionType::
LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH) {
std::vector<LeAudioCodecCapabilitiesSetting> db_codec_capabilities = std::vector<LeAudioCodecCapabilitiesSetting> db_codec_capabilities =
BluetoothAudioCodecs::GetLeAudioOffloadCodecCapabilities(session_type); BluetoothAudioCodecs::GetLeAudioOffloadCodecCapabilities(session_type);
if (db_codec_capabilities.size()) { if (db_codec_capabilities.size()) {

View File

@@ -38,6 +38,12 @@ LeAudioOffloadInputAudioProvider::LeAudioOffloadInputAudioProvider()
session_type_ = SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH; session_type_ = SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH;
} }
LeAudioOffloadBroadcastAudioProvider::LeAudioOffloadBroadcastAudioProvider()
: LeAudioOffloadAudioProvider() {
session_type_ =
SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH;
}
LeAudioOffloadAudioProvider::LeAudioOffloadAudioProvider() LeAudioOffloadAudioProvider::LeAudioOffloadAudioProvider()
: BluetoothAudioProvider() {} : BluetoothAudioProvider() {}

View File

@@ -48,6 +48,12 @@ class LeAudioOffloadInputAudioProvider : public LeAudioOffloadAudioProvider {
LeAudioOffloadInputAudioProvider(); LeAudioOffloadInputAudioProvider();
}; };
class LeAudioOffloadBroadcastAudioProvider
: public LeAudioOffloadAudioProvider {
public:
LeAudioOffloadBroadcastAudioProvider();
};
} // namespace audio } // namespace audio
} // namespace bluetooth } // namespace bluetooth
} // namespace hardware } // namespace hardware

View File

@@ -55,6 +55,11 @@ LeAudioSoftwareInputAudioProvider::LeAudioSoftwareInputAudioProvider()
session_type_ = SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH; session_type_ = SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH;
} }
LeAudioSoftwareBroadcastAudioProvider::LeAudioSoftwareBroadcastAudioProvider()
: LeAudioSoftwareAudioProvider() {
session_type_ = SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH;
}
LeAudioSoftwareAudioProvider::LeAudioSoftwareAudioProvider() LeAudioSoftwareAudioProvider::LeAudioSoftwareAudioProvider()
: BluetoothAudioProvider(), data_mq_(nullptr) {} : BluetoothAudioProvider(), data_mq_(nullptr) {}
@@ -78,7 +83,9 @@ ndk::ScopedAStatus LeAudioSoftwareAudioProvider::startSession(
} }
uint32_t buffer_modifier = 0; uint32_t buffer_modifier = 0;
if (session_type_ == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH) if (session_type_ == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH ||
session_type_ ==
SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH)
buffer_modifier = kBufferOutCount; buffer_modifier = kBufferOutCount;
else if (session_type_ == SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH) else if (session_type_ == SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH)
buffer_modifier = kBufferInCount; buffer_modifier = kBufferInCount;

View File

@@ -51,6 +51,12 @@ class LeAudioSoftwareInputAudioProvider : public LeAudioSoftwareAudioProvider {
LeAudioSoftwareInputAudioProvider(); LeAudioSoftwareInputAudioProvider();
}; };
class LeAudioSoftwareBroadcastAudioProvider
: public LeAudioSoftwareAudioProvider {
public:
LeAudioSoftwareBroadcastAudioProvider();
};
} // namespace audio } // namespace audio
} // namespace bluetooth } // namespace bluetooth
} // namespace hardware } // namespace hardware

View File

@@ -94,6 +94,8 @@ const AudioConfiguration BluetoothAudioSession::GetAudioConfig() {
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH: case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH: case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
return AudioConfiguration(LeAudioConfiguration{}); return AudioConfiguration(LeAudioConfiguration{});
case SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
return AudioConfiguration(LeAudioBroadcastConfiguration{});
default: default:
return AudioConfiguration(PcmConfiguration{}); return AudioConfiguration(PcmConfiguration{});
} }
@@ -137,6 +139,8 @@ bool BluetoothAudioSession::IsSessionReady() {
SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH || SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
session_type_ == session_type_ ==
SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH || SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH ||
session_type_ ==
SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
(data_mq_ != nullptr && data_mq_->isValid())); (data_mq_ != nullptr && data_mq_->isValid()));
return stack_iface_ != nullptr && is_mq_valid && audio_config_ != nullptr; return stack_iface_ != nullptr && is_mq_valid && audio_config_ != nullptr;
} }
@@ -259,7 +263,9 @@ bool BluetoothAudioSession::UpdateAudioConfig(
(session_type_ == SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH || (session_type_ == SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH ||
session_type_ == SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH || session_type_ == SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH ||
session_type_ == SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH || session_type_ == SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH ||
session_type_ == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH); session_type_ == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH ||
session_type_ ==
SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH);
bool is_offload_a2dp_session = bool is_offload_a2dp_session =
(session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH); (session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH);
bool is_offload_le_audio_session = bool is_offload_le_audio_session =

View File

@@ -86,6 +86,8 @@ class BluetoothAudioSessionControl {
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH: case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH: case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
return AudioConfiguration(LeAudioConfiguration{}); return AudioConfiguration(LeAudioConfiguration{});
case SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
return AudioConfiguration(LeAudioBroadcastConfiguration{});
default: default:
return AudioConfiguration(PcmConfiguration{}); return AudioConfiguration(PcmConfiguration{});
} }

View File

@@ -418,100 +418,89 @@ inline Lc3Config_2_1 to_hidl_lc3_config_2_1(
} }
inline Lc3CodecConfig_2_1 to_hidl_leaudio_config_2_1( inline Lc3CodecConfig_2_1 to_hidl_leaudio_config_2_1(
const LeAudioConfiguration& leaudio_config) { const LeAudioConfiguration& unicast_config) {
Lc3CodecConfig_2_1 hidl_lc3_codec_config = { Lc3CodecConfig_2_1 hidl_lc3_codec_config = {
.audioChannelAllocation = 0, .audioChannelAllocation = 0,
}; };
if (leaudio_config.modeConfig.getTag() == if (unicast_config.leAudioCodecConfig.getTag() ==
LeAudioConfiguration::LeAudioModeConfig::unicastConfig) { LeAudioCodecConfiguration::lc3Config) {
auto& unicast_config = LOG(FATAL) << __func__ << ": unexpected codec type(vendor?)";
leaudio_config.modeConfig
.get<LeAudioConfiguration::LeAudioModeConfig::unicastConfig>();
if (unicast_config.leAudioCodecConfig.getTag() ==
LeAudioCodecConfiguration::lc3Config) {
LOG(FATAL) << __func__ << ": unexpected codec type(vendor?)";
}
auto& le_codec_config = unicast_config.leAudioCodecConfig
.get<LeAudioCodecConfiguration::lc3Config>();
hidl_lc3_codec_config.lc3Config = to_hidl_lc3_config_2_1(le_codec_config);
for (const auto& map : unicast_config.streamMap) {
hidl_lc3_codec_config.audioChannelAllocation |=
map.audioChannelAllocation;
}
} else {
// NOTE: Broadcast is not officially supported in HIDL
auto& bcast_config =
leaudio_config.modeConfig
.get<LeAudioConfiguration::LeAudioModeConfig::broadcastConfig>();
if (bcast_config.streamMap.empty()) {
return hidl_lc3_codec_config;
}
if (bcast_config.streamMap[0].leAudioCodecConfig.getTag() !=
LeAudioCodecConfiguration::lc3Config) {
LOG(FATAL) << __func__ << ": unexpected codec type(vendor?)";
}
auto& le_codec_config =
bcast_config.streamMap[0]
.leAudioCodecConfig.get<LeAudioCodecConfiguration::lc3Config>();
hidl_lc3_codec_config.lc3Config = to_hidl_lc3_config_2_1(le_codec_config);
for (const auto& map : bcast_config.streamMap) {
hidl_lc3_codec_config.audioChannelAllocation |=
map.audioChannelAllocation;
}
} }
auto& le_codec_config = unicast_config.leAudioCodecConfig
.get<LeAudioCodecConfiguration::lc3Config>();
hidl_lc3_codec_config.lc3Config = to_hidl_lc3_config_2_1(le_codec_config);
for (const auto& map : unicast_config.streamMap) {
hidl_lc3_codec_config.audioChannelAllocation |= map.audioChannelAllocation;
}
return hidl_lc3_codec_config;
}
inline Lc3CodecConfig_2_1 to_hidl_leaudio_broadcast_config_2_1(
const LeAudioBroadcastConfiguration& broadcast_config) {
Lc3CodecConfig_2_1 hidl_lc3_codec_config = {
.audioChannelAllocation = 0,
};
// NOTE: Broadcast is not officially supported in HIDL
if (broadcast_config.streamMap.empty()) {
return hidl_lc3_codec_config;
}
if (broadcast_config.streamMap[0].leAudioCodecConfig.getTag() !=
LeAudioCodecConfiguration::lc3Config) {
LOG(FATAL) << __func__ << ": unexpected codec type(vendor?)";
}
auto& le_codec_config =
broadcast_config.streamMap[0]
.leAudioCodecConfig.get<LeAudioCodecConfiguration::lc3Config>();
hidl_lc3_codec_config.lc3Config = to_hidl_lc3_config_2_1(le_codec_config);
for (const auto& map : broadcast_config.streamMap) {
hidl_lc3_codec_config.audioChannelAllocation |= map.audioChannelAllocation;
}
return hidl_lc3_codec_config; return hidl_lc3_codec_config;
} }
inline LeAudioConfig_2_2 to_hidl_leaudio_config_2_2( inline LeAudioConfig_2_2 to_hidl_leaudio_config_2_2(
const LeAudioConfiguration& leaudio_config) { const LeAudioConfiguration& unicast_config) {
LeAudioConfig_2_2 hidl_leaudio_config; LeAudioConfig_2_2 hidl_leaudio_config;
hidl_leaudio_config.mode = LeAudioMode_2_2::UNICAST;
::android::hardware::bluetooth::audio::V2_2::UnicastConfig
hidl_unicast_config;
hidl_unicast_config.peerDelay =
static_cast<uint32_t>(unicast_config.peerDelayUs / 1000);
if (leaudio_config.modeConfig.getTag() == auto& lc3_config = unicast_config.leAudioCodecConfig
LeAudioConfiguration::LeAudioModeConfig::unicastConfig) { .get<LeAudioCodecConfiguration::lc3Config>();
hidl_leaudio_config.mode = LeAudioMode_2_2::UNICAST; hidl_unicast_config.lc3Config = to_hidl_lc3_config_2_1(lc3_config);
auto& unicast_config =
leaudio_config.modeConfig
.get<LeAudioConfiguration::LeAudioModeConfig::unicastConfig>();
::android::hardware::bluetooth::audio::V2_2::UnicastConfig
hidl_unicast_config;
hidl_unicast_config.peerDelay =
static_cast<uint32_t>(unicast_config.peerDelay);
auto& lc3_config = unicast_config.leAudioCodecConfig hidl_unicast_config.streamMap.resize(unicast_config.streamMap.size());
.get<LeAudioCodecConfiguration::lc3Config>(); for (int i = 0; i < unicast_config.streamMap.size(); i++) {
hidl_unicast_config.lc3Config = to_hidl_lc3_config_2_1(lc3_config); hidl_unicast_config.streamMap[i].audioChannelAllocation =
static_cast<uint32_t>(
unicast_config.streamMap[i].audioChannelAllocation);
hidl_unicast_config.streamMap[i].streamHandle =
static_cast<uint16_t>(unicast_config.streamMap[i].streamHandle);
}
return hidl_leaudio_config;
}
hidl_unicast_config.streamMap.resize(unicast_config.streamMap.size()); inline LeAudioConfig_2_2 to_hidl_leaudio_broadcast_config_2_2(
for (int i = 0; i < unicast_config.streamMap.size(); i++) { const LeAudioBroadcastConfiguration& broadcast_config) {
hidl_unicast_config.streamMap[i].audioChannelAllocation = LeAudioConfig_2_2 hidl_leaudio_config;
static_cast<uint32_t>( hidl_leaudio_config.mode = LeAudioMode_2_2::BROADCAST;
unicast_config.streamMap[i].audioChannelAllocation); ::android::hardware::bluetooth::audio::V2_2::BroadcastConfig
hidl_unicast_config.streamMap[i].streamHandle = hidl_bcast_config;
static_cast<uint16_t>(unicast_config.streamMap[i].streamHandle); hidl_bcast_config.streamMap.resize(broadcast_config.streamMap.size());
} for (int i = 0; i < broadcast_config.streamMap.size(); i++) {
} else if (leaudio_config.modeConfig.getTag() == hidl_bcast_config.streamMap[i].audioChannelAllocation =
LeAudioConfiguration::LeAudioModeConfig::broadcastConfig) { static_cast<uint32_t>(
hidl_leaudio_config.mode = LeAudioMode_2_2::BROADCAST; broadcast_config.streamMap[i].audioChannelAllocation);
auto bcast_config = hidl_bcast_config.streamMap[i].streamHandle =
leaudio_config.modeConfig static_cast<uint16_t>(broadcast_config.streamMap[i].streamHandle);
.get<LeAudioConfiguration::LeAudioModeConfig::broadcastConfig>(); hidl_bcast_config.streamMap[i].lc3Config = to_hidl_lc3_config_2_1(
::android::hardware::bluetooth::audio::V2_2::BroadcastConfig broadcast_config.streamMap[i]
hidl_bcast_config; .leAudioCodecConfig.get<LeAudioCodecConfiguration::lc3Config>());
hidl_bcast_config.streamMap.resize(bcast_config.streamMap.size());
for (int i = 0; i < bcast_config.streamMap.size(); i++) {
hidl_bcast_config.streamMap[i].audioChannelAllocation =
static_cast<uint32_t>(
bcast_config.streamMap[i].audioChannelAllocation);
hidl_bcast_config.streamMap[i].streamHandle =
static_cast<uint16_t>(bcast_config.streamMap[i].streamHandle);
hidl_bcast_config.streamMap[i].lc3Config = to_hidl_lc3_config_2_1(
bcast_config.streamMap[i]
.leAudioCodecConfig.get<LeAudioCodecConfiguration::lc3Config>());
}
} }
return hidl_leaudio_config; return hidl_leaudio_config;
} }
@@ -532,6 +521,10 @@ inline AudioConfig_2_1 to_hidl_audio_config_2_1(
hidl_audio_config.leAudioCodecConfig(to_hidl_leaudio_config_2_1( hidl_audio_config.leAudioCodecConfig(to_hidl_leaudio_config_2_1(
audio_config.get<AudioConfiguration::leAudioConfig>())); audio_config.get<AudioConfiguration::leAudioConfig>()));
break; break;
case AudioConfiguration::leAudioBroadcastConfig:
hidl_audio_config.leAudioCodecConfig(to_hidl_leaudio_broadcast_config_2_1(
audio_config.get<AudioConfiguration::leAudioBroadcastConfig>()));
break;
} }
return hidl_audio_config; return hidl_audio_config;
} }
@@ -552,6 +545,10 @@ inline AudioConfig_2_2 to_hidl_audio_config_2_2(
hidl_audio_config.leAudioConfig(to_hidl_leaudio_config_2_2( hidl_audio_config.leAudioConfig(to_hidl_leaudio_config_2_2(
audio_config.get<AudioConfiguration::leAudioConfig>())); audio_config.get<AudioConfiguration::leAudioConfig>()));
break; break;
case AudioConfiguration::leAudioBroadcastConfig:
hidl_audio_config.leAudioConfig(to_hidl_leaudio_broadcast_config_2_2(
audio_config.get<AudioConfiguration::leAudioBroadcastConfig>()));
break;
} }
return hidl_audio_config; return hidl_audio_config;
} }