mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 21:37:44 +00:00
Merge changes from topic "bt-broadcast-aidl" am: b8e8c57ac6
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1977699 Change-Id: I111a9e3aaac832f357a786d66f76bd154a1e6c94
This commit is contained in:
@@ -37,4 +37,5 @@ union AudioConfiguration {
|
||||
android.hardware.bluetooth.audio.PcmConfiguration pcmConfig;
|
||||
android.hardware.bluetooth.audio.CodecConfiguration a2dpConfig;
|
||||
android.hardware.bluetooth.audio.LeAudioConfiguration leAudioConfig;
|
||||
android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration leAudioBroadcastConfig;
|
||||
}
|
||||
|
||||
@@ -33,8 +33,9 @@
|
||||
|
||||
package android.hardware.bluetooth.audio;
|
||||
@VintfStability
|
||||
parcelable BroadcastConfiguration {
|
||||
android.hardware.bluetooth.audio.BroadcastConfiguration.BroadcastStreamMap[] streamMap;
|
||||
parcelable LeAudioBroadcastConfiguration {
|
||||
android.hardware.bluetooth.audio.CodecType codecType;
|
||||
android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration.BroadcastStreamMap[] streamMap;
|
||||
@VintfStability
|
||||
parcelable BroadcastStreamMap {
|
||||
char streamHandle;
|
||||
@@ -34,12 +34,13 @@
|
||||
package android.hardware.bluetooth.audio;
|
||||
@VintfStability
|
||||
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.LeAudioConfiguration.StreamMap[] streamMap;
|
||||
int peerDelayUs;
|
||||
android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig;
|
||||
@VintfStability
|
||||
union LeAudioModeConfig {
|
||||
android.hardware.bluetooth.audio.UnicastConfiguration unicastConfig;
|
||||
android.hardware.bluetooth.audio.BroadcastConfiguration broadcastConfig;
|
||||
parcelable StreamMap {
|
||||
char streamHandle;
|
||||
int audioChannelAllocation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
@@ -42,4 +42,6 @@ enum SessionType {
|
||||
LE_AUDIO_SOFTWARE_DECODING_DATAPATH = 5,
|
||||
LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH = 6,
|
||||
LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH = 7,
|
||||
LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH = 8,
|
||||
LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH = 9,
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
package android.hardware.bluetooth.audio;
|
||||
|
||||
import android.hardware.bluetooth.audio.CodecConfiguration;
|
||||
import android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration;
|
||||
import android.hardware.bluetooth.audio.LeAudioConfiguration;
|
||||
import android.hardware.bluetooth.audio.PcmConfiguration;
|
||||
|
||||
@@ -28,4 +29,5 @@ union AudioConfiguration {
|
||||
PcmConfiguration pcmConfig;
|
||||
CodecConfiguration a2dpConfig;
|
||||
LeAudioConfiguration leAudioConfig;
|
||||
LeAudioBroadcastConfiguration leAudioBroadcastConfig;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package android.hardware.bluetooth.audio;
|
||||
import android.hardware.bluetooth.audio.AudioLocation;
|
||||
import android.hardware.bluetooth.audio.CodecType;
|
||||
import android.hardware.bluetooth.audio.Lc3Capabilities;
|
||||
import android.hardware.bluetooth.audio.LeAudioMode;
|
||||
|
||||
/**
|
||||
* Used to specify the le audio broadcast codec capabilities for hardware offload.
|
||||
|
||||
@@ -16,14 +16,15 @@
|
||||
|
||||
package android.hardware.bluetooth.audio;
|
||||
|
||||
import android.hardware.bluetooth.audio.CodecType;
|
||||
import android.hardware.bluetooth.audio.LeAudioCodecConfiguration;
|
||||
|
||||
@VintfStability
|
||||
parcelable BroadcastConfiguration {
|
||||
parcelable LeAudioBroadcastConfiguration {
|
||||
@VintfStability
|
||||
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
|
||||
*/
|
||||
char streamHandle;
|
||||
@@ -35,5 +36,6 @@ parcelable BroadcastConfiguration {
|
||||
int audioChannelAllocation;
|
||||
LeAudioCodecConfiguration leAudioCodecConfig;
|
||||
}
|
||||
CodecType codecType;
|
||||
BroadcastStreamMap[] streamMap;
|
||||
}
|
||||
@@ -16,22 +16,28 @@
|
||||
|
||||
package android.hardware.bluetooth.audio;
|
||||
|
||||
import android.hardware.bluetooth.audio.BroadcastConfiguration;
|
||||
import android.hardware.bluetooth.audio.CodecType;
|
||||
import android.hardware.bluetooth.audio.LeAudioMode;
|
||||
import android.hardware.bluetooth.audio.UnicastConfiguration;
|
||||
import android.hardware.bluetooth.audio.LeAudioCodecConfiguration;
|
||||
|
||||
@VintfStability
|
||||
parcelable LeAudioConfiguration {
|
||||
@VintfStability
|
||||
union LeAudioModeConfig {
|
||||
UnicastConfiguration unicastConfig;
|
||||
BroadcastConfiguration broadcastConfig;
|
||||
parcelable StreamMap {
|
||||
/*
|
||||
* 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;
|
||||
StreamMap[] streamMap;
|
||||
int peerDelayUs;
|
||||
LeAudioCodecConfiguration leAudioCodecConfig;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
@@ -33,19 +33,33 @@ enum SessionType {
|
||||
*/
|
||||
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,
|
||||
/**
|
||||
* 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,
|
||||
/**
|
||||
* 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,
|
||||
/**
|
||||
* 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,
|
||||
/**
|
||||
* 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,
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package android.hardware.bluetooth.audio;
|
||||
import android.hardware.bluetooth.audio.AudioLocation;
|
||||
import android.hardware.bluetooth.audio.CodecType;
|
||||
import android.hardware.bluetooth.audio.Lc3Capabilities;
|
||||
import android.hardware.bluetooth.audio.LeAudioMode;
|
||||
|
||||
/**
|
||||
* Used to specify the le audio unicast codec capabilities for hardware offload.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -64,6 +64,14 @@ ndk::ScopedAStatus BluetoothAudioProviderFactory::openProvider(
|
||||
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
|
||||
provider = ndk::SharedRefBase::make<LeAudioOffloadInputAudioProvider>();
|
||||
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:
|
||||
provider = nullptr;
|
||||
break;
|
||||
@@ -93,7 +101,10 @@ ndk::ScopedAStatus BluetoothAudioProviderFactory::getProviderCapabilities(
|
||||
} else if (session_type ==
|
||||
SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
|
||||
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 =
|
||||
BluetoothAudioCodecs::GetLeAudioOffloadCodecCapabilities(session_type);
|
||||
if (db_codec_capabilities.size()) {
|
||||
|
||||
@@ -38,6 +38,12 @@ LeAudioOffloadInputAudioProvider::LeAudioOffloadInputAudioProvider()
|
||||
session_type_ = SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH;
|
||||
}
|
||||
|
||||
LeAudioOffloadBroadcastAudioProvider::LeAudioOffloadBroadcastAudioProvider()
|
||||
: LeAudioOffloadAudioProvider() {
|
||||
session_type_ =
|
||||
SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH;
|
||||
}
|
||||
|
||||
LeAudioOffloadAudioProvider::LeAudioOffloadAudioProvider()
|
||||
: BluetoothAudioProvider() {}
|
||||
|
||||
|
||||
@@ -48,6 +48,12 @@ class LeAudioOffloadInputAudioProvider : public LeAudioOffloadAudioProvider {
|
||||
LeAudioOffloadInputAudioProvider();
|
||||
};
|
||||
|
||||
class LeAudioOffloadBroadcastAudioProvider
|
||||
: public LeAudioOffloadAudioProvider {
|
||||
public:
|
||||
LeAudioOffloadBroadcastAudioProvider();
|
||||
};
|
||||
|
||||
} // namespace audio
|
||||
} // namespace bluetooth
|
||||
} // namespace hardware
|
||||
|
||||
@@ -55,6 +55,11 @@ LeAudioSoftwareInputAudioProvider::LeAudioSoftwareInputAudioProvider()
|
||||
session_type_ = SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH;
|
||||
}
|
||||
|
||||
LeAudioSoftwareBroadcastAudioProvider::LeAudioSoftwareBroadcastAudioProvider()
|
||||
: LeAudioSoftwareAudioProvider() {
|
||||
session_type_ = SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH;
|
||||
}
|
||||
|
||||
LeAudioSoftwareAudioProvider::LeAudioSoftwareAudioProvider()
|
||||
: BluetoothAudioProvider(), data_mq_(nullptr) {}
|
||||
|
||||
@@ -78,7 +83,9 @@ ndk::ScopedAStatus LeAudioSoftwareAudioProvider::startSession(
|
||||
}
|
||||
|
||||
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;
|
||||
else if (session_type_ == SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH)
|
||||
buffer_modifier = kBufferInCount;
|
||||
|
||||
@@ -51,6 +51,12 @@ class LeAudioSoftwareInputAudioProvider : public LeAudioSoftwareAudioProvider {
|
||||
LeAudioSoftwareInputAudioProvider();
|
||||
};
|
||||
|
||||
class LeAudioSoftwareBroadcastAudioProvider
|
||||
: public LeAudioSoftwareAudioProvider {
|
||||
public:
|
||||
LeAudioSoftwareBroadcastAudioProvider();
|
||||
};
|
||||
|
||||
} // namespace audio
|
||||
} // namespace bluetooth
|
||||
} // namespace hardware
|
||||
|
||||
@@ -94,6 +94,8 @@ const AudioConfiguration BluetoothAudioSession::GetAudioConfig() {
|
||||
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
|
||||
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
|
||||
return AudioConfiguration(LeAudioConfiguration{});
|
||||
case SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
|
||||
return AudioConfiguration(LeAudioBroadcastConfiguration{});
|
||||
default:
|
||||
return AudioConfiguration(PcmConfiguration{});
|
||||
}
|
||||
@@ -137,6 +139,8 @@ bool BluetoothAudioSession::IsSessionReady() {
|
||||
SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
|
||||
session_type_ ==
|
||||
SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH ||
|
||||
session_type_ ==
|
||||
SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
|
||||
(data_mq_ != nullptr && data_mq_->isValid()));
|
||||
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::HEARING_AID_SOFTWARE_ENCODING_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 =
|
||||
(session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH);
|
||||
bool is_offload_le_audio_session =
|
||||
|
||||
@@ -86,6 +86,8 @@ class BluetoothAudioSessionControl {
|
||||
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
|
||||
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
|
||||
return AudioConfiguration(LeAudioConfiguration{});
|
||||
case SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
|
||||
return AudioConfiguration(LeAudioBroadcastConfiguration{});
|
||||
default:
|
||||
return AudioConfiguration(PcmConfiguration{});
|
||||
}
|
||||
|
||||
@@ -418,100 +418,89 @@ inline Lc3Config_2_1 to_hidl_lc3_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 = {
|
||||
.audioChannelAllocation = 0,
|
||||
};
|
||||
if (leaudio_config.modeConfig.getTag() ==
|
||||
LeAudioConfiguration::LeAudioModeConfig::unicastConfig) {
|
||||
auto& unicast_config =
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
inline LeAudioConfig_2_2 to_hidl_leaudio_config_2_2(
|
||||
const LeAudioConfiguration& leaudio_config) {
|
||||
const LeAudioConfiguration& unicast_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() ==
|
||||
LeAudioConfiguration::LeAudioModeConfig::unicastConfig) {
|
||||
hidl_leaudio_config.mode = LeAudioMode_2_2::UNICAST;
|
||||
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
|
||||
.get<LeAudioCodecConfiguration::lc3Config>();
|
||||
hidl_unicast_config.lc3Config = to_hidl_lc3_config_2_1(lc3_config);
|
||||
|
||||
auto& lc3_config = unicast_config.leAudioCodecConfig
|
||||
.get<LeAudioCodecConfiguration::lc3Config>();
|
||||
hidl_unicast_config.lc3Config = to_hidl_lc3_config_2_1(lc3_config);
|
||||
hidl_unicast_config.streamMap.resize(unicast_config.streamMap.size());
|
||||
for (int i = 0; i < unicast_config.streamMap.size(); i++) {
|
||||
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());
|
||||
for (int i = 0; i < unicast_config.streamMap.size(); i++) {
|
||||
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);
|
||||
}
|
||||
} else if (leaudio_config.modeConfig.getTag() ==
|
||||
LeAudioConfiguration::LeAudioModeConfig::broadcastConfig) {
|
||||
hidl_leaudio_config.mode = LeAudioMode_2_2::BROADCAST;
|
||||
auto bcast_config =
|
||||
leaudio_config.modeConfig
|
||||
.get<LeAudioConfiguration::LeAudioModeConfig::broadcastConfig>();
|
||||
::android::hardware::bluetooth::audio::V2_2::BroadcastConfig
|
||||
hidl_bcast_config;
|
||||
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>());
|
||||
}
|
||||
inline LeAudioConfig_2_2 to_hidl_leaudio_broadcast_config_2_2(
|
||||
const LeAudioBroadcastConfiguration& broadcast_config) {
|
||||
LeAudioConfig_2_2 hidl_leaudio_config;
|
||||
hidl_leaudio_config.mode = LeAudioMode_2_2::BROADCAST;
|
||||
::android::hardware::bluetooth::audio::V2_2::BroadcastConfig
|
||||
hidl_bcast_config;
|
||||
hidl_bcast_config.streamMap.resize(broadcast_config.streamMap.size());
|
||||
for (int i = 0; i < broadcast_config.streamMap.size(); i++) {
|
||||
hidl_bcast_config.streamMap[i].audioChannelAllocation =
|
||||
static_cast<uint32_t>(
|
||||
broadcast_config.streamMap[i].audioChannelAllocation);
|
||||
hidl_bcast_config.streamMap[i].streamHandle =
|
||||
static_cast<uint16_t>(broadcast_config.streamMap[i].streamHandle);
|
||||
hidl_bcast_config.streamMap[i].lc3Config = to_hidl_lc3_config_2_1(
|
||||
broadcast_config.streamMap[i]
|
||||
.leAudioCodecConfig.get<LeAudioCodecConfiguration::lc3Config>());
|
||||
}
|
||||
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(
|
||||
audio_config.get<AudioConfiguration::leAudioConfig>()));
|
||||
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;
|
||||
}
|
||||
@@ -552,6 +545,10 @@ inline AudioConfig_2_2 to_hidl_audio_config_2_2(
|
||||
hidl_audio_config.leAudioConfig(to_hidl_leaudio_config_2_2(
|
||||
audio_config.get<AudioConfiguration::leAudioConfig>()));
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user