mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Merge "BTAudio HAL: Added feature flag for DSA Over LEA" into main am: 09e546a8c6 am: ba9308ef11
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2854501 Change-Id: I0c06952f2cbf026881fafab9cb4196061b0f960b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
12
bluetooth/audio/flags/Android.bp
Normal file
12
bluetooth/audio/flags/Android.bp
Normal file
@@ -0,0 +1,12 @@
|
||||
aconfig_declarations {
|
||||
name: "btaudiohal_flags",
|
||||
package: "com.android.btaudio.hal.flags",
|
||||
srcs: ["btaudiohal.aconfig"],
|
||||
}
|
||||
|
||||
cc_aconfig_library {
|
||||
name: "btaudiohal_flags_c_lib",
|
||||
aconfig_declarations: "btaudiohal_flags",
|
||||
vendor: true,
|
||||
host_supported: true,
|
||||
}
|
||||
8
bluetooth/audio/flags/btaudiohal.aconfig
Normal file
8
bluetooth/audio/flags/btaudiohal.aconfig
Normal file
@@ -0,0 +1,8 @@
|
||||
package: "com.android.btaudio.hal.flags"
|
||||
|
||||
flag {
|
||||
name: "dsa_lea"
|
||||
namespace: "pixel_bluetooth"
|
||||
description: "Flag for DSA Over LEA"
|
||||
bug: "270987427"
|
||||
}
|
||||
@@ -63,6 +63,10 @@ cc_library_shared {
|
||||
"libhidlbase",
|
||||
"libxml2",
|
||||
"libflatbuffers-cpp",
|
||||
"server_configurable_flags",
|
||||
],
|
||||
static_libs: [
|
||||
"btaudiohal_flags_c_lib",
|
||||
],
|
||||
generated_sources: ["le_audio_codec_capabilities"],
|
||||
generated_headers: [
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <android-base/logging.h>
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <com_android_btaudio_hal_flags.h>
|
||||
#include <hardware/audio.h>
|
||||
|
||||
#include "BluetoothAudioSession.h"
|
||||
@@ -36,6 +37,14 @@ static constexpr int kFmqReceiveTimeoutMs =
|
||||
static constexpr int kWritePollMs = 1; // polled non-blocking interval
|
||||
static constexpr int kReadPollMs = 1; // polled non-blocking interval
|
||||
|
||||
static std::string toString(const std::vector<LatencyMode>& latencies) {
|
||||
std::stringstream latencyModesStr;
|
||||
for (LatencyMode mode : latencies) {
|
||||
latencyModesStr << " " << toString(mode);
|
||||
}
|
||||
return latencyModesStr.str();
|
||||
}
|
||||
|
||||
BluetoothAudioSession::BluetoothAudioSession(const SessionType& session_type)
|
||||
: session_type_(session_type), stack_iface_(nullptr), data_mq_(nullptr) {}
|
||||
|
||||
@@ -65,6 +74,7 @@ void BluetoothAudioSession::OnSessionStarted(
|
||||
stack_iface_ = stack_iface;
|
||||
latency_modes_ = latency_modes;
|
||||
LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
|
||||
<< " - All LatencyModes=" << toString(latency_modes)
|
||||
<< ", AudioConfiguration=" << audio_config.toString();
|
||||
ReportSessionStatus();
|
||||
}
|
||||
@@ -604,31 +614,46 @@ std::vector<LatencyMode> BluetoothAudioSession::GetSupportedLatencyModes() {
|
||||
return std::vector<LatencyMode>();
|
||||
}
|
||||
|
||||
std::vector<LatencyMode> supported_latency_modes;
|
||||
if (session_type_ ==
|
||||
SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH) {
|
||||
for (LatencyMode mode : latency_modes_) {
|
||||
if (mode == LatencyMode::LOW_LATENCY) {
|
||||
// LOW_LATENCY is not supported for LE_HARDWARE_OFFLOAD_ENC sessions
|
||||
continue;
|
||||
if (com::android::btaudio::hal::flags::dsa_lea()) {
|
||||
std::vector<LatencyMode> supported_latency_modes;
|
||||
if (session_type_ ==
|
||||
SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH) {
|
||||
for (LatencyMode mode : latency_modes_) {
|
||||
if (mode == LatencyMode::LOW_LATENCY) {
|
||||
// LOW_LATENCY is not supported for LE_HARDWARE_OFFLOAD_ENC sessions
|
||||
continue;
|
||||
}
|
||||
supported_latency_modes.push_back(mode);
|
||||
}
|
||||
} else {
|
||||
for (LatencyMode mode : latency_modes_) {
|
||||
if (!low_latency_allowed_ && mode == LatencyMode::LOW_LATENCY) {
|
||||
// ignore LOW_LATENCY mode if Bluetooth stack doesn't allow
|
||||
continue;
|
||||
}
|
||||
if (mode == LatencyMode::DYNAMIC_SPATIAL_AUDIO_SOFTWARE ||
|
||||
mode == LatencyMode::DYNAMIC_SPATIAL_AUDIO_HARDWARE) {
|
||||
// DSA_SW and DSA_HW only supported for LE_HARDWARE_OFFLOAD_ENC
|
||||
// sessions
|
||||
continue;
|
||||
}
|
||||
supported_latency_modes.push_back(mode);
|
||||
}
|
||||
supported_latency_modes.push_back(mode);
|
||||
}
|
||||
} else {
|
||||
for (LatencyMode mode : latency_modes_) {
|
||||
if (!low_latency_allowed_ && mode == LatencyMode::LOW_LATENCY) {
|
||||
// ignore LOW_LATENCY mode if Bluetooth stack doesn't allow
|
||||
continue;
|
||||
}
|
||||
if (mode == LatencyMode::DYNAMIC_SPATIAL_AUDIO_SOFTWARE ||
|
||||
mode == LatencyMode::DYNAMIC_SPATIAL_AUDIO_HARDWARE) {
|
||||
// DSA_SW and DSA_HW only supported for LE_HARDWARE_OFFLOAD_ENC sessions
|
||||
continue;
|
||||
}
|
||||
supported_latency_modes.push_back(mode);
|
||||
}
|
||||
LOG(DEBUG) << __func__ << " - Supported LatencyMode="
|
||||
<< toString(supported_latency_modes);
|
||||
return supported_latency_modes;
|
||||
}
|
||||
return supported_latency_modes;
|
||||
|
||||
if (low_latency_allowed_) return latency_modes_;
|
||||
std::vector<LatencyMode> modes;
|
||||
for (LatencyMode mode : latency_modes_) {
|
||||
if (mode == LatencyMode::LOW_LATENCY)
|
||||
// ignore those low latency mode if Bluetooth stack doesn't allow
|
||||
continue;
|
||||
modes.push_back(mode);
|
||||
}
|
||||
return modes;
|
||||
}
|
||||
|
||||
void BluetoothAudioSession::SetLatencyMode(const LatencyMode& latency_mode) {
|
||||
|
||||
Reference in New Issue
Block a user