summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Henri Chataing <henrichataing@google.com> 2025-01-16 09:44:24 +0000
committer Henri Chataing <henrichataing@google.com> 2025-01-29 18:47:14 +0000
commit155d0cf8689c718e34a86cbbaa6b42a20f375fd8 (patch)
treefa1df58ec93f5613831c31c41b1a45e8a04e8d0a
parentf64f083469d2f61ae6f37b33ea1a370a1657f60b (diff)
Remove support for LDAC decoder
The LDAC decoder is currently loaded as the shared library libldacBT_bco.so. This will no longer be supported when bt becomes a mainline module as using dlopen() is forbidden. Bug: 331817295 Test: m com.android.bt Flag: EXEMPT, dead code removal Change-Id: I3512e59b0f12cf37973aed4275e2c007cb2dcb10
-rw-r--r--TEST_MAPPING6
-rw-r--r--system/audio_hal_interface/aidl/a2dp/a2dp_provider_info.cc3
-rw-r--r--system/audio_hal_interface/aidl/a2dp/a2dp_provider_info_unittest.cc2
-rw-r--r--system/audio_hal_interface/aidl/a2dp/codec_status_aidl.cc5
-rw-r--r--system/audio_hal_interface/fuzzer/README.md2
-rw-r--r--system/audio_hal_interface/fuzzer/libbt_audio_hal_a2dp_encoding_fuzzer.cpp2
-rw-r--r--system/audio_hal_interface/fuzzer/libbt_audio_hal_client_interface_fuzzer.cpp2
-rw-r--r--system/audio_hal_interface/hidl/client_interface_hidl_unittest.cc2
-rw-r--r--system/audio_hal_interface/hidl/codec_status_hidl.cc5
-rw-r--r--system/include/hardware/bt_av.h3
-rw-r--r--system/stack/Android.bp50
-rw-r--r--system/stack/a2dp/a2dp_codec_config.cc3
-rw-r--r--system/stack/a2dp/a2dp_vendor.cc24
-rw-r--r--system/stack/a2dp/a2dp_vendor_ldac.cc95
-rw-r--r--system/stack/a2dp/a2dp_vendor_ldac_decoder.cc281
-rw-r--r--system/stack/a2dp/a2dp_vendor_ldac_linux.cc28
-rw-r--r--system/stack/include/a2dp_vendor_ldac.h30
-rw-r--r--system/stack/include/a2dp_vendor_ldac_decoder.h56
-rw-r--r--system/stack/test/a2dp/a2dp_vendor_ldac_decoder_test.cc56
-rw-r--r--system/stack/test/a2dp/a2dp_vendor_ldac_unittest.cc12
-rw-r--r--system/stack/test/a2dp/misc_fake.cc21
-rw-r--r--system/stack/test/fuzzers/a2dp/codec/a2dpCodecHelperFunctions.h1
-rw-r--r--system/stack/test/stack_a2dp_test.cc44
23 files changed, 8 insertions, 725 deletions
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 562f9717c8..d3205af4c9 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -136,9 +136,6 @@
"name": "net_test_performance"
},
{
- "name": "net_test_stack_a2dp_native"
- },
- {
"name": "net_test_stack_acl"
},
{
@@ -335,9 +332,6 @@
"name": "net_test_performance"
},
{
- "name": "net_test_stack_a2dp_native"
- },
- {
"name": "net_test_stack_acl"
},
{
diff --git a/system/audio_hal_interface/aidl/a2dp/a2dp_provider_info.cc b/system/audio_hal_interface/aidl/a2dp/a2dp_provider_info.cc
index ccd0bf04fe..8ab27d06d2 100644
--- a/system/audio_hal_interface/aidl/a2dp/a2dp_provider_info.cc
+++ b/system/audio_hal_interface/aidl/a2dp/a2dp_provider_info.cc
@@ -171,9 +171,6 @@ static std::optional<btav_a2dp_codec_index_t> assignSinkCodecIndex(
int codec_id = codec.id.get<CodecId::vendor>().codecId;
/* match know vendor codecs */
- if (vendor_id == A2DP_LDAC_VENDOR_ID && codec_id == A2DP_LDAC_CODEC_ID) {
- return BTAV_A2DP_CODEC_INDEX_SINK_LDAC;
- }
if (vendor_id == A2DP_OPUS_VENDOR_ID && codec_id == A2DP_OPUS_CODEC_ID) {
return BTAV_A2DP_CODEC_INDEX_SINK_OPUS;
}
diff --git a/system/audio_hal_interface/aidl/a2dp/a2dp_provider_info_unittest.cc b/system/audio_hal_interface/aidl/a2dp/a2dp_provider_info_unittest.cc
index b3731e5627..6ac1bee5ed 100644
--- a/system/audio_hal_interface/aidl/a2dp/a2dp_provider_info_unittest.cc
+++ b/system/audio_hal_interface/aidl/a2dp/a2dp_provider_info_unittest.cc
@@ -269,7 +269,7 @@ TEST_F(ProviderInfoTest, TestGetCodecNotSupported) {
GetProviderInfoForTesting(true, false);
auto received_codec_info_not_supported_codec =
- provider_info->GetCodec(BTAV_A2DP_CODEC_INDEX_SINK_LDAC);
+ provider_info->GetCodec(BTAV_A2DP_CODEC_INDEX_SINK_MAX);
ASSERT_FALSE(received_codec_info_not_supported_codec.has_value());
}
diff --git a/system/audio_hal_interface/aidl/a2dp/codec_status_aidl.cc b/system/audio_hal_interface/aidl/a2dp/codec_status_aidl.cc
index cb4a601f0a..dfdebd2071 100644
--- a/system/audio_hal_interface/aidl/a2dp/codec_status_aidl.cc
+++ b/system/audio_hal_interface/aidl/a2dp/codec_status_aidl.cc
@@ -502,16 +502,11 @@ bool UpdateOffloadingCapabilities(
codec_type_set.insert(CodecType::OPUS);
break;
case BTAV_A2DP_CODEC_INDEX_SINK_SBC:
- [[fallthrough]];
case BTAV_A2DP_CODEC_INDEX_SINK_AAC:
- [[fallthrough]];
- case BTAV_A2DP_CODEC_INDEX_SINK_LDAC:
- [[fallthrough]];
case BTAV_A2DP_CODEC_INDEX_SINK_OPUS:
log::warn("Ignore sink codec_type={}", preference.codec_type);
break;
case BTAV_A2DP_CODEC_INDEX_MAX:
- [[fallthrough]];
default:
log::error("Unknown codec_type={}", preference.codec_type);
return false;
diff --git a/system/audio_hal_interface/fuzzer/README.md b/system/audio_hal_interface/fuzzer/README.md
index 6d92d8f81f..a54c5cb9d7 100644
--- a/system/audio_hal_interface/fuzzer/README.md
+++ b/system/audio_hal_interface/fuzzer/README.md
@@ -34,7 +34,7 @@ Fuzzers assigns values to the following parameters to pass on to libbt-audio-hal
|------------- |-------------| ----- |
| `status` | 0.`UNKNOWN` 1.`SUCCESS` 2.`UNSUPPORTED_CODEC_CONFIGURATION`
3.`FAILURE` 4.`PENDING` | Value obtained from FuzzedDataProvider |
-| `index` | 0.`BTAV_A2DP_CODEC_INDEX_SOURCE_SBC` 1.`BTAV_A2DP_CODEC_INDEX_SOURCE_AAC` 2.`BTAV_A2DP_CODEC_INDEX_SOURCE_APTX` 3.`BTAV_A2DP_CODEC_INDEX_SOURCE_APTX_HD` 4.`BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC` 5.`BTAV_A2DP_CODEC_INDEX_SINK_SBC` 6.`BTAV_A2DP_CODEC_INDEX_SINK_AAC` 7.`BTAV_A2DP_CODEC_INDEX_SINK_LDAC` | Value obtained from FuzzedDataProvider |
+| `index` | 0.`BTAV_A2DP_CODEC_INDEX_SOURCE_SBC` 1.`BTAV_A2DP_CODEC_INDEX_SOURCE_AAC` 2.`BTAV_A2DP_CODEC_INDEX_SOURCE_APTX` 3.`BTAV_A2DP_CODEC_INDEX_SOURCE_APTX_HD` 4.`BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC` 5.`BTAV_A2DP_CODEC_INDEX_SINK_SBC` 6.`BTAV_A2DP_CODEC_INDEX_SINK_AAC` | Value obtained from FuzzedDataProvider |
| `sessionType` | 0.`SessionType::UNKNOWN` 1.`SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH` 2.`SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH` 3.`SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH` | Value obtained from FuzzedDataProvider |
| `sessionType_2_1` | 0.`SessionType_2_1::UNKNOWN` 1.`SessionType_2_1::A2DP_SOFTWARE_ENCODING_DATAPATH` 2.`SessionType_2_1::A2DP_HARDWARE_OFFLOAD_DATAPATH` 3.`SessionType_2_1::HEARING_AID_SOFTWARE_ENCODING_DATAPATH` 4.`SessionType_2_1::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH` 5.`SessionType_2_1::LE_AUDIO_SOFTWARE_DECODED_DATAPATH` 6.`SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH` 7.`SessionType_2_1::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH` | Value obtained from FuzzedDataProvider |
| `param.sampleRate` | 0.`SampleRate::RATE_UNKNOWN` 1.`SampleRate::RATE_8000` 2.`SampleRate::RATE_16000` 3.`SampleRate::RATE_24000` 4.`SampleRate::RATE_32000` 5.`SampleRate::RATE_44100` 6.`SampleRate::RATE_48000` | Value obtained from FuzzedDataProvider |
diff --git a/system/audio_hal_interface/fuzzer/libbt_audio_hal_a2dp_encoding_fuzzer.cpp b/system/audio_hal_interface/fuzzer/libbt_audio_hal_a2dp_encoding_fuzzer.cpp
index 7613b7efe6..64a85ddfe4 100644
--- a/system/audio_hal_interface/fuzzer/libbt_audio_hal_a2dp_encoding_fuzzer.cpp
+++ b/system/audio_hal_interface/fuzzer/libbt_audio_hal_a2dp_encoding_fuzzer.cpp
@@ -42,7 +42,7 @@ constexpr btav_a2dp_codec_index_t kCodecIndices[] = {
BTAV_A2DP_CODEC_INDEX_SOURCE_SBC, BTAV_A2DP_CODEC_INDEX_SOURCE_AAC,
BTAV_A2DP_CODEC_INDEX_SOURCE_APTX, BTAV_A2DP_CODEC_INDEX_SOURCE_APTX_HD,
BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC, BTAV_A2DP_CODEC_INDEX_SINK_SBC,
- BTAV_A2DP_CODEC_INDEX_SINK_AAC, BTAV_A2DP_CODEC_INDEX_SINK_LDAC};
+ BTAV_A2DP_CODEC_INDEX_SINK_AAC};
std::vector<std::vector<btav_a2dp_codec_config_t>> CodecOffloadingPreferenceGenerator() {
std::vector<std::vector<btav_a2dp_codec_config_t>> offloadingPreferences = {
diff --git a/system/audio_hal_interface/fuzzer/libbt_audio_hal_client_interface_fuzzer.cpp b/system/audio_hal_interface/fuzzer/libbt_audio_hal_client_interface_fuzzer.cpp
index c309d44b34..7f5bbfc0c6 100644
--- a/system/audio_hal_interface/fuzzer/libbt_audio_hal_client_interface_fuzzer.cpp
+++ b/system/audio_hal_interface/fuzzer/libbt_audio_hal_client_interface_fuzzer.cpp
@@ -131,7 +131,7 @@ constexpr btav_a2dp_codec_index_t kCodecIndices[] = {
BTAV_A2DP_CODEC_INDEX_SOURCE_SBC, BTAV_A2DP_CODEC_INDEX_SOURCE_AAC,
BTAV_A2DP_CODEC_INDEX_SOURCE_APTX, BTAV_A2DP_CODEC_INDEX_SOURCE_APTX_HD,
BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC, BTAV_A2DP_CODEC_INDEX_SINK_SBC,
- BTAV_A2DP_CODEC_INDEX_SINK_AAC, BTAV_A2DP_CODEC_INDEX_SINK_LDAC};
+ BTAV_A2DP_CODEC_INDEX_SINK_AAC};
class TestSinkTransport : public bluetooth::audio::hidl::IBluetoothSinkTransportInstance {
private:
diff --git a/system/audio_hal_interface/hidl/client_interface_hidl_unittest.cc b/system/audio_hal_interface/hidl/client_interface_hidl_unittest.cc
index 13ed21c06f..b9ac810b17 100644
--- a/system/audio_hal_interface/hidl/client_interface_hidl_unittest.cc
+++ b/system/audio_hal_interface/hidl/client_interface_hidl_unittest.cc
@@ -126,7 +126,7 @@ constexpr btav_a2dp_codec_index_t codec_indexes[] = {
BTAV_A2DP_CODEC_INDEX_SOURCE_SBC, BTAV_A2DP_CODEC_INDEX_SOURCE_AAC,
BTAV_A2DP_CODEC_INDEX_SOURCE_APTX, BTAV_A2DP_CODEC_INDEX_SOURCE_APTX_HD,
BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC, BTAV_A2DP_CODEC_INDEX_SINK_SBC,
- BTAV_A2DP_CODEC_INDEX_SINK_AAC, BTAV_A2DP_CODEC_INDEX_SINK_LDAC};
+ BTAV_A2DP_CODEC_INDEX_SINK_AAC};
constexpr uint16_t kPeerMtus[5] = {660, 663, 883, 1005, 1500};
class TestSinkTransport : public bluetooth::audio::hidl::IBluetoothSinkTransportInstance {
diff --git a/system/audio_hal_interface/hidl/codec_status_hidl.cc b/system/audio_hal_interface/hidl/codec_status_hidl.cc
index fe54dbdb1e..a74592a60c 100644
--- a/system/audio_hal_interface/hidl/codec_status_hidl.cc
+++ b/system/audio_hal_interface/hidl/codec_status_hidl.cc
@@ -463,16 +463,11 @@ bool UpdateOffloadingCapabilities(
log::warn("Ignore source codec_type={}, not supported on HIDL", preference.codec_type);
break;
case BTAV_A2DP_CODEC_INDEX_SINK_SBC:
- [[fallthrough]];
case BTAV_A2DP_CODEC_INDEX_SINK_AAC:
- [[fallthrough]];
- case BTAV_A2DP_CODEC_INDEX_SINK_LDAC:
- [[fallthrough]];
case BTAV_A2DP_CODEC_INDEX_SINK_OPUS:
log::warn("Ignore sink codec_type={}", preference.codec_type);
break;
case BTAV_A2DP_CODEC_INDEX_MAX:
- [[fallthrough]];
default:
log::error("Unknown codec_type={}", preference.codec_type);
return false;
diff --git a/system/include/hardware/bt_av.h b/system/include/hardware/bt_av.h
index b839cb048f..f7d367bc6d 100644
--- a/system/include/hardware/bt_av.h
+++ b/system/include/hardware/bt_av.h
@@ -75,7 +75,6 @@ typedef enum {
// Add an entry for each sink codec here
BTAV_A2DP_CODEC_INDEX_SINK_SBC = BTAV_A2DP_CODEC_INDEX_SINK_MIN,
BTAV_A2DP_CODEC_INDEX_SINK_AAC,
- BTAV_A2DP_CODEC_INDEX_SINK_LDAC,
BTAV_A2DP_CODEC_INDEX_SINK_OPUS,
BTAV_A2DP_CODEC_INDEX_SINK_MAX,
@@ -184,8 +183,6 @@ struct btav_a2dp_codec_config_t {
return "SBC (Sink)";
case BTAV_A2DP_CODEC_INDEX_SINK_AAC:
return "AAC (Sink)";
- case BTAV_A2DP_CODEC_INDEX_SINK_LDAC:
- return "LDAC (Sink)";
case BTAV_A2DP_CODEC_INDEX_SOURCE_LC3:
return "LC3";
case BTAV_A2DP_CODEC_INDEX_SINK_OPUS:
diff --git a/system/stack/Android.bp b/system/stack/Android.bp
index 783117ddc3..2ac6a4e91e 100644
--- a/system/stack/Android.bp
+++ b/system/stack/Android.bp
@@ -87,7 +87,6 @@ cc_library_static {
"a2dp/a2dp_vendor_aptx_hd.cc",
"a2dp/a2dp_vendor_aptx_hd_encoder.cc",
"a2dp/a2dp_vendor_ldac.cc",
- "a2dp/a2dp_vendor_ldac_decoder.cc",
"a2dp/a2dp_vendor_ldac_encoder.cc",
"a2dp/a2dp_vendor_opus.cc",
"a2dp/a2dp_vendor_opus_decoder.cc",
@@ -1357,7 +1356,6 @@ cc_test {
"a2dp/a2dp_vendor_aptx_hd.cc",
"a2dp/a2dp_vendor_aptx_hd_encoder.cc",
"a2dp/a2dp_vendor_ldac.cc",
- "a2dp/a2dp_vendor_ldac_decoder.cc",
"a2dp/a2dp_vendor_ldac_encoder.cc",
"a2dp/a2dp_vendor_opus.cc",
"a2dp/a2dp_vendor_opus_decoder.cc",
@@ -1414,54 +1412,6 @@ cc_test {
header_libs: ["libbluetooth_headers"],
}
-cc_test {
- name: "net_test_stack_a2dp_native",
- defaults: [
- "fluoride_defaults",
- "mts_defaults",
- ],
- test_suites: ["general-tests"],
- host_supported: true,
- test_options: {
- unit_test: true,
- },
- include_dirs: [
- "external/libldac/inc",
- "packages/modules/Bluetooth/system",
- "packages/modules/Bluetooth/system/gd",
- "packages/modules/Bluetooth/system/stack/include",
- ],
- srcs: [
- "a2dp/a2dp_vendor_ldac_decoder.cc",
- "test/a2dp/a2dp_vendor_ldac_decoder_test.cc",
- "test/a2dp/misc_fake.cc",
- ],
- aidl: {
- libs: ["bluetooth_constants"],
- },
- shared_libs: [
- "libbinder",
- "libcrypto",
- "libcutils",
- ],
- static_libs: [
- "libbase",
- "libbluetooth_crypto_toolbox",
- "libbluetooth_log",
- "libbt-common",
- "libchrome",
- "libcom.android.sysprop.bluetooth.wrapped",
- "liblog",
- "libosi",
- ],
- sanitize: {
- address: true,
- cfi: true,
- misc_undefined: ["bounds"],
- },
- header_libs: ["libbluetooth_headers"],
-}
-
// gatt sr hash test
cc_test {
name: "net_test_stack_gatt_sr_hash_native",
diff --git a/system/stack/a2dp/a2dp_codec_config.cc b/system/stack/a2dp/a2dp_codec_config.cc
index 9155dabf52..47cfc81030 100644
--- a/system/stack/a2dp/a2dp_codec_config.cc
+++ b/system/stack/a2dp/a2dp_codec_config.cc
@@ -192,9 +192,6 @@ A2dpCodecConfig* A2dpCodecConfig::createCodec(btav_a2dp_codec_index_t codec_inde
case BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC:
codec_config = new A2dpCodecConfigLdacSource(codec_priority);
break;
- case BTAV_A2DP_CODEC_INDEX_SINK_LDAC:
- codec_config = new A2dpCodecConfigLdacSink(codec_priority);
- break;
case BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS:
codec_config = new A2dpCodecConfigOpusSource(codec_priority);
break;
diff --git a/system/stack/a2dp/a2dp_vendor.cc b/system/stack/a2dp/a2dp_vendor.cc
index 28a27c7cb6..febfabb48d 100644
--- a/system/stack/a2dp/a2dp_vendor.cc
+++ b/system/stack/a2dp/a2dp_vendor.cc
@@ -129,11 +129,6 @@ tA2DP_STATUS A2DP_IsVendorSinkCodecSupported(const uint8_t* p_codec_info) {
// Add checks based on <vendor_id, codec_id>
// NOTE: Should be done only for local Sink codecs.
- // Check for LDAC
- if (vendor_id == A2DP_LDAC_VENDOR_ID && codec_id == A2DP_LDAC_CODEC_ID) {
- return A2DP_IsVendorSinkCodecSupportedLdac(p_codec_info);
- }
-
// Check for Opus
if (vendor_id == A2DP_OPUS_VENDOR_ID && codec_id == A2DP_OPUS_CODEC_ID) {
return A2DP_IsVendorSinkCodecSupportedOpus(p_codec_info);
@@ -279,11 +274,6 @@ int A2DP_VendorGetSinkTrackChannelType(const uint8_t* p_codec_info) {
// Add checks based on <vendor_id, codec_id>
// NOTE: Should be done only for local Sink codecs.
- // Check for LDAC
- if (vendor_id == A2DP_LDAC_VENDOR_ID && codec_id == A2DP_LDAC_CODEC_ID) {
- return A2DP_VendorGetSinkTrackChannelTypeLdac(p_codec_info);
- }
-
// Check for Opus
if (vendor_id == A2DP_OPUS_VENDOR_ID && codec_id == A2DP_OPUS_CODEC_ID) {
return A2DP_VendorGetSinkTrackChannelTypeOpus(p_codec_info);
@@ -358,11 +348,6 @@ const tA2DP_DECODER_INTERFACE* A2DP_VendorGetDecoderInterface(const uint8_t* p_c
// Add checks based on <vendor_id, codec_id>
// NOTE: Should be done only for local Sink codecs.
- // Check for LDAC
- if (vendor_id == A2DP_LDAC_VENDOR_ID && codec_id == A2DP_LDAC_CODEC_ID) {
- return A2DP_VendorGetDecoderInterfaceLdac(p_codec_info);
- }
-
// Check for Opus
if (vendor_id == A2DP_OPUS_VENDOR_ID && codec_id == A2DP_OPUS_CODEC_ID) {
return A2DP_VendorGetDecoderInterfaceOpus(p_codec_info);
@@ -436,11 +421,6 @@ btav_a2dp_codec_index_t A2DP_VendorSinkCodecIndex(const uint8_t* p_codec_info) {
// Add checks based on <vendor_id, codec_id>
// NOTE: Should be done only for local Sink codecs.
- // Check for LDAC
- if (vendor_id == A2DP_LDAC_VENDOR_ID && codec_id == A2DP_LDAC_CODEC_ID) {
- return A2DP_VendorSinkCodecIndexLdac(p_codec_info);
- }
-
// Check for Opus
if (vendor_id == A2DP_OPUS_VENDOR_ID && codec_id == A2DP_OPUS_CODEC_ID) {
return A2DP_VendorSinkCodecIndexOpus(p_codec_info);
@@ -463,8 +443,6 @@ const char* A2DP_VendorCodecIndexStr(btav_a2dp_codec_index_t codec_index) {
return A2DP_VendorCodecIndexStrAptxHd();
case BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC:
return A2DP_VendorCodecIndexStrLdac();
- case BTAV_A2DP_CODEC_INDEX_SINK_LDAC:
- return A2DP_VendorCodecIndexStrLdacSink();
case BTAV_A2DP_CODEC_INDEX_SOURCE_LC3:
return "LC3 not implemented";
case BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS:
@@ -496,8 +474,6 @@ bool A2DP_VendorInitCodecConfig(btav_a2dp_codec_index_t codec_index, AvdtpSepCon
return A2DP_VendorInitCodecConfigAptxHd(p_cfg);
case BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC:
return A2DP_VendorInitCodecConfigLdac(p_cfg);
- case BTAV_A2DP_CODEC_INDEX_SINK_LDAC:
- return A2DP_VendorInitCodecConfigLdacSink(p_cfg);
case BTAV_A2DP_CODEC_INDEX_SOURCE_LC3:
break; // not implemented
case BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS:
diff --git a/system/stack/a2dp/a2dp_vendor_ldac.cc b/system/stack/a2dp/a2dp_vendor_ldac.cc
index 951be4c35b..ef7fea0be8 100644
--- a/system/stack/a2dp/a2dp_vendor_ldac.cc
+++ b/system/stack/a2dp/a2dp_vendor_ldac.cc
@@ -37,7 +37,6 @@
#include "a2dp_codec_api.h"
#include "a2dp_constants.h"
#include "a2dp_vendor_ldac_constants.h"
-#include "a2dp_vendor_ldac_decoder.h"
#include "a2dp_vendor_ldac_encoder.h"
#include "avdt_api.h"
#include "btif/include/btif_av_co.h"
@@ -102,16 +101,6 @@ static const tA2DP_ENCODER_INTERFACE a2dp_encoder_interface_ldac = {
a2dp_vendor_ldac_send_frames,
a2dp_vendor_ldac_set_transmit_queue_length};
-static const tA2DP_DECODER_INTERFACE a2dp_decoder_interface_ldac = {
- a2dp_vendor_ldac_decoder_init, a2dp_vendor_ldac_decoder_cleanup,
- a2dp_vendor_ldac_decoder_decode_packet, a2dp_vendor_ldac_decoder_start,
- a2dp_vendor_ldac_decoder_suspend, a2dp_vendor_ldac_decoder_configure,
-};
-
-static tA2DP_STATUS A2DP_CodecInfoMatchesCapabilityLdac(const tA2DP_LDAC_CIE* p_cap,
- const uint8_t* p_codec_info,
- bool is_peer_codec_info);
-
// Builds the LDAC Media Codec Capabilities byte sequence beginning from the
// LOSC octet. |media_type| is the media type |AVDT_MEDIA_TYPE_*|.
// |p_ie| is a pointer to the LDAC Codec Information Element information.
@@ -250,50 +239,6 @@ bool A2DP_IsCodecValidLdac(const uint8_t* p_codec_info) {
(A2DP_ParseInfoLdac(&cfg_cie, p_codec_info, true) == A2DP_SUCCESS);
}
-tA2DP_STATUS A2DP_IsVendorSinkCodecSupportedLdac(const uint8_t* p_codec_info) {
- return A2DP_CodecInfoMatchesCapabilityLdac(&a2dp_ldac_sink_caps, p_codec_info, false);
-}
-
-// Checks whether A2DP LDAC codec configuration matches with a device's codec
-// capabilities. |p_cap| is the LDAC codec configuration. |p_codec_info| is
-// the device's codec capabilities.
-// If |is_capability| is true, the byte sequence is codec capabilities,
-// otherwise is codec configuration.
-// |p_codec_info| contains the codec capabilities for a peer device that
-// is acting as an A2DP source.
-// Returns A2DP_SUCCESS if the codec configuration matches with capabilities,
-// otherwise the corresponding A2DP error status code.
-static tA2DP_STATUS A2DP_CodecInfoMatchesCapabilityLdac(const tA2DP_LDAC_CIE* p_cap,
- const uint8_t* p_codec_info,
- bool is_capability) {
- tA2DP_STATUS status;
- tA2DP_LDAC_CIE cfg_cie;
-
- /* parse configuration */
- status = A2DP_ParseInfoLdac(&cfg_cie, p_codec_info, is_capability);
- if (status != A2DP_SUCCESS) {
- log::error("parsing failed {}", status);
- return status;
- }
-
- /* verify that each parameter is in range */
-
- log::verbose("FREQ peer: 0x{:x}, capability 0x{:x}", cfg_cie.sampleRate, p_cap->sampleRate);
- log::verbose("CH_MODE peer: 0x{:x}, capability 0x{:x}", cfg_cie.channelMode, p_cap->channelMode);
-
- /* sampling frequency */
- if ((cfg_cie.sampleRate & p_cap->sampleRate) == 0) {
- return A2DP_NOT_SUPPORTED_SAMPLING_FREQUENCY;
- }
-
- /* channel mode */
- if ((cfg_cie.channelMode & p_cap->channelMode) == 0) {
- return A2DP_NOT_SUPPORTED_CHANNEL_MODE;
- }
-
- return A2DP_SUCCESS;
-}
-
bool A2DP_VendorUsesRtpHeaderLdac(bool /* content_protection_enabled */,
const uint8_t* /* p_codec_info */) {
// TODO: Is this correct? The RTP header is always included?
@@ -566,15 +511,6 @@ const tA2DP_ENCODER_INTERFACE* A2DP_VendorGetEncoderInterfaceLdac(
return &a2dp_encoder_interface_ldac;
}
-const tA2DP_DECODER_INTERFACE* A2DP_VendorGetDecoderInterfaceLdac(
- const uint8_t* p_codec_info) {
- if (!A2DP_IsCodecValidLdac(p_codec_info)) {
- return NULL;
- }
-
- return &a2dp_decoder_interface_ldac;
-}
-
bool A2DP_VendorAdjustCodecLdac(uint8_t* p_codec_info) {
tA2DP_LDAC_CIE cfg_cie;
@@ -590,22 +526,12 @@ btav_a2dp_codec_index_t A2DP_VendorSourceCodecIndexLdac(const uint8_t* /* p_code
return BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC;
}
-btav_a2dp_codec_index_t A2DP_VendorSinkCodecIndexLdac(const uint8_t* /* p_codec_info */) {
- return BTAV_A2DP_CODEC_INDEX_SINK_LDAC;
-}
-
const char* A2DP_VendorCodecIndexStrLdac(void) { return "LDAC"; }
-const char* A2DP_VendorCodecIndexStrLdacSink(void) { return "LDAC SINK"; }
-
bool A2DP_VendorInitCodecConfigLdac(AvdtpSepConfig* p_cfg) {
return A2DP_BuildInfoLdac(AVDT_MEDIA_TYPE_AUDIO, &a2dp_ldac_source_caps, p_cfg->codec_info);
}
-bool A2DP_VendorInitCodecConfigLdacSink(AvdtpSepConfig* p_cfg) {
- return A2DP_BuildInfoLdac(AVDT_MEDIA_TYPE_AUDIO, &a2dp_ldac_sink_caps, p_cfg->codec_info);
-}
-
A2dpCodecConfigLdacSource::A2dpCodecConfigLdacSource(btav_a2dp_codec_priority_t codec_priority)
: A2dpCodecConfigLdacBase(BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC, A2DP_VendorCodecIndexStrLdac(),
codec_priority, true) {
@@ -1320,24 +1246,3 @@ fail:
sizeof(ota_codec_peer_capability_));
return false;
}
-
-A2dpCodecConfigLdacSink::A2dpCodecConfigLdacSink(btav_a2dp_codec_priority_t codec_priority)
- : A2dpCodecConfigLdacBase(BTAV_A2DP_CODEC_INDEX_SINK_LDAC, A2DP_VendorCodecIndexStrLdacSink(),
- codec_priority, false) {}
-
-A2dpCodecConfigLdacSink::~A2dpCodecConfigLdacSink() {}
-
-bool A2dpCodecConfigLdacSink::init() {
- // Load the decoder
- if (!A2DP_VendorLoadDecoderLdac()) {
- log::error("cannot load the decoder");
- return false;
- }
-
- return true;
-}
-
-bool A2dpCodecConfigLdacSink::useRtpHeaderMarkerBit() const {
- // TODO: This method applies only to Source codecs
- return false;
-}
diff --git a/system/stack/a2dp/a2dp_vendor_ldac_decoder.cc b/system/stack/a2dp/a2dp_vendor_ldac_decoder.cc
deleted file mode 100644
index 9c13d50160..0000000000
--- a/system/stack/a2dp/a2dp_vendor_ldac_decoder.cc
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright 2016 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.
- */
-
-#define LOG_TAG "bluetooth-a2dp"
-
-#include "a2dp_vendor_ldac_decoder.h"
-
-#include <bluetooth/log.h>
-#include <dlfcn.h>
-#include <ldacBT.h>
-#include <ldacBT_bco_for_fluoride.h>
-#include <pthread.h>
-#include <string.h>
-
-#include <cstdint>
-
-#include "a2dp_vendor_ldac.h"
-#include "a2dp_vendor_ldac_constants.h"
-#include "avdt_api.h"
-#include "stack/include/bt_hdr.h"
-
-using namespace bluetooth;
-
-namespace std {
-template <>
-struct formatter<LDACBT_SMPL_FMT_T> : enum_formatter<LDACBT_SMPL_FMT_T> {};
-} // namespace std
-
-//
-// Decoder for LDAC Source Codec
-//
-
-//
-// The LDAC BCO shared library, and the functions to use
-//
-static const char* LDAC_BCO_LIB_NAME = "libldacBT_bco.so";
-static void* ldac_bco_lib_handle = NULL;
-
-static const char* LDAC_BCO_INIT_NAME = "ldac_BCO_init";
-typedef HANDLE_LDAC_BCO (*tLDAC_BCO_INIT)(decoded_data_callback_t decode_callback);
-
-static const char* LDAC_BCO_CLEANUP_NAME = "ldac_BCO_cleanup";
-typedef int32_t (*tLDAC_BCO_CLEANUP)(HANDLE_LDAC_BCO hLdacBco);
-
-static const char* LDAC_BCO_DECODE_PACKET_NAME = "ldac_BCO_decode_packet";
-typedef int32_t (*tLDAC_BCO_DECODE_PACKET)(HANDLE_LDAC_BCO hLdacBco, void* data, int32_t length);
-
-static const char* LDAC_BCO_START_NAME = "ldac_BCO_start";
-typedef int32_t (*tLDAC_BCO_START)(HANDLE_LDAC_BCO hLdacBco);
-
-static const char* LDAC_BCO_SUSPEND_NAME = "ldac_BCO_suspend";
-typedef int32_t (*tLDAC_BCO_SUSPEND)(HANDLE_LDAC_BCO hLdacBco);
-
-static const char* LDAC_BCO_CONFIGURE_NAME = "ldac_BCO_configure";
-typedef int32_t (*tLDAC_BCO_CONFIGURE)(HANDLE_LDAC_BCO hLdacBco, int32_t sample_rate,
- int32_t bits_per_sample, int32_t channel_mode);
-
-static tLDAC_BCO_INIT ldac_BCO_init_func;
-static tLDAC_BCO_CLEANUP ldac_BCO_cleanup_func;
-static tLDAC_BCO_DECODE_PACKET ldac_BCO_decode_packet_func;
-static tLDAC_BCO_START ldac_BCO_start_func;
-static tLDAC_BCO_SUSPEND ldac_BCO_suspend_func;
-static tLDAC_BCO_CONFIGURE ldac_BCO_configure_func;
-
-// offset
-#define A2DP_LDAC_OFFSET (AVDT_MEDIA_OFFSET + A2DP_LDAC_MPL_HDR_LEN)
-
-typedef struct {
- uint32_t sample_rate;
- uint8_t channel_mode;
- uint8_t bits_per_sample;
- int pcm_wlength;
- LDACBT_SMPL_FMT_T pcm_fmt;
-} tA2DP_LDAC_DECODER_PARAMS;
-
-typedef struct {
- pthread_mutex_t mutex;
- bool use_SCMS_T;
- bool is_peer_edr; // True if the peer device supports EDR
- bool peer_supports_3mbps; // True if the peer device supports 3Mbps EDR
- uint16_t peer_mtu; // MTU of the A2DP peer
- uint32_t timestamp; // Timestamp for the A2DP frames
-
- HANDLE_LDAC_BCO ldac_handle_bco;
- bool has_ldac_handle; // True if ldac_handle is valid
- unsigned char* decode_buf;
- decoded_data_callback_t decode_callback;
-} tA2DP_LDAC_DECODER_CB;
-
-static tA2DP_LDAC_DECODER_CB a2dp_ldac_decoder_cb;
-
-static void* load_func(const char* func_name) {
- void* func_ptr = dlsym(ldac_bco_lib_handle, func_name);
- if (func_ptr == NULL) {
- log::error("cannot find function '{}' in the decoder library: {}", func_name, dlerror());
- A2DP_VendorUnloadDecoderLdac();
- return NULL;
- }
- return func_ptr;
-}
-
-bool A2DP_VendorLoadDecoderLdac(void) {
- if (ldac_bco_lib_handle != NULL) {
- return true; // Already loaded
- }
-
- // Initialize the control block
- memset(&a2dp_ldac_decoder_cb, 0, sizeof(a2dp_ldac_decoder_cb));
-
- pthread_mutex_init(&(a2dp_ldac_decoder_cb.mutex), NULL);
-
- // Open the decoder library
- ldac_bco_lib_handle = dlopen(LDAC_BCO_LIB_NAME, RTLD_NOW);
- if (ldac_bco_lib_handle == NULL) {
- log::info("cannot open LDAC decoder library {}: {}", LDAC_BCO_LIB_NAME, dlerror());
- return false;
- }
-
- // Load all functions
- ldac_BCO_init_func = (tLDAC_BCO_INIT)load_func(LDAC_BCO_INIT_NAME);
- if (ldac_BCO_init_func == NULL) {
- return false;
- }
-
- ldac_BCO_cleanup_func = (tLDAC_BCO_CLEANUP)load_func(LDAC_BCO_CLEANUP_NAME);
- if (ldac_BCO_cleanup_func == NULL) {
- return false;
- }
-
- ldac_BCO_decode_packet_func = (tLDAC_BCO_DECODE_PACKET)load_func(LDAC_BCO_DECODE_PACKET_NAME);
- if (ldac_BCO_decode_packet_func == NULL) {
- return false;
- }
-
- ldac_BCO_start_func = (tLDAC_BCO_START)load_func(LDAC_BCO_START_NAME);
- if (ldac_BCO_start_func == NULL) {
- return false;
- }
-
- ldac_BCO_suspend_func = (tLDAC_BCO_SUSPEND)load_func(LDAC_BCO_SUSPEND_NAME);
- if (ldac_BCO_suspend_func == NULL) {
- return false;
- }
-
- ldac_BCO_configure_func = (tLDAC_BCO_CONFIGURE)load_func(LDAC_BCO_CONFIGURE_NAME);
- if (ldac_BCO_configure_func == NULL) {
- return false;
- }
-
- return true;
-}
-
-void A2DP_VendorUnloadDecoderLdac(void) {
- // Cleanup any LDAC-related state
- if (a2dp_ldac_decoder_cb.has_ldac_handle && ldac_BCO_cleanup_func != NULL) {
- ldac_BCO_cleanup_func(a2dp_ldac_decoder_cb.ldac_handle_bco);
- }
- pthread_mutex_destroy(&(a2dp_ldac_decoder_cb.mutex));
- memset(&a2dp_ldac_decoder_cb, 0, sizeof(a2dp_ldac_decoder_cb));
-
- ldac_BCO_init_func = NULL;
- ldac_BCO_cleanup_func = NULL;
- ldac_BCO_decode_packet_func = NULL;
- ldac_BCO_start_func = NULL;
- ldac_BCO_suspend_func = NULL;
- ldac_BCO_configure_func = NULL;
-
- if (ldac_bco_lib_handle != NULL) {
- dlclose(ldac_bco_lib_handle);
- ldac_bco_lib_handle = NULL;
- }
-}
-
-bool a2dp_vendor_ldac_decoder_init(decoded_data_callback_t decode_callback) {
- pthread_mutex_lock(&(a2dp_ldac_decoder_cb.mutex));
-
- if (a2dp_ldac_decoder_cb.has_ldac_handle) {
- ldac_BCO_cleanup_func(a2dp_ldac_decoder_cb.ldac_handle_bco);
- }
-
- a2dp_ldac_decoder_cb.ldac_handle_bco = ldac_BCO_init_func(decode_callback);
- a2dp_ldac_decoder_cb.has_ldac_handle = (a2dp_ldac_decoder_cb.ldac_handle_bco != NULL);
-
- pthread_mutex_unlock(&(a2dp_ldac_decoder_cb.mutex));
- return true;
-}
-
-void a2dp_vendor_ldac_decoder_cleanup(void) {
- pthread_mutex_lock(&(a2dp_ldac_decoder_cb.mutex));
- if (a2dp_ldac_decoder_cb.has_ldac_handle) {
- ldac_BCO_cleanup_func(a2dp_ldac_decoder_cb.ldac_handle_bco);
- }
- a2dp_ldac_decoder_cb.ldac_handle_bco = NULL;
- pthread_mutex_unlock(&(a2dp_ldac_decoder_cb.mutex));
-}
-
-bool a2dp_vendor_ldac_decoder_decode_packet(BT_HDR* p_buf) {
- if (p_buf == nullptr) {
- log::error("Dropping packet with nullptr");
- return false;
- }
- pthread_mutex_lock(&(a2dp_ldac_decoder_cb.mutex));
- unsigned char* pBuffer = reinterpret_cast<unsigned char*>(p_buf->data + p_buf->offset);
- // unsigned int bufferSize = p_buf->len;
- unsigned int bytesValid = p_buf->len;
- if (bytesValid == 0) {
- pthread_mutex_unlock(&(a2dp_ldac_decoder_cb.mutex));
- log::warn("Dropping packet with zero length");
- return false;
- }
-
- int bs_bytes, frame_number;
-
- frame_number = (int)pBuffer[0];
- bs_bytes = (int)bytesValid;
- bytesValid -= 1;
- log::info("INPUT size : {}, frame : {}", bs_bytes, frame_number);
-
- if (a2dp_ldac_decoder_cb.has_ldac_handle) {
- ldac_BCO_decode_packet_func(a2dp_ldac_decoder_cb.ldac_handle_bco, pBuffer, bs_bytes);
- }
-
- pthread_mutex_unlock(&(a2dp_ldac_decoder_cb.mutex));
- return true;
-}
-
-void a2dp_vendor_ldac_decoder_start(void) {
- pthread_mutex_lock(&(a2dp_ldac_decoder_cb.mutex));
- log::info("");
- if (a2dp_ldac_decoder_cb.has_ldac_handle) {
- ldac_BCO_start_func(a2dp_ldac_decoder_cb.ldac_handle_bco);
- }
- pthread_mutex_unlock(&(a2dp_ldac_decoder_cb.mutex));
-}
-
-void a2dp_vendor_ldac_decoder_suspend(void) {
- pthread_mutex_lock(&(a2dp_ldac_decoder_cb.mutex));
- log::info("");
- if (a2dp_ldac_decoder_cb.has_ldac_handle) {
- ldac_BCO_suspend_func(a2dp_ldac_decoder_cb.ldac_handle_bco);
- }
- pthread_mutex_unlock(&(a2dp_ldac_decoder_cb.mutex));
-}
-
-void a2dp_vendor_ldac_decoder_configure(const uint8_t* p_codec_info) {
- int32_t sample_rate;
- int32_t bits_per_sample;
- int32_t channel_mode;
-
- if (p_codec_info == NULL) {
- log::error("p_codec_info is NULL");
- return;
- }
-
- pthread_mutex_lock(&(a2dp_ldac_decoder_cb.mutex));
- sample_rate = A2DP_VendorGetTrackSampleRateLdac(p_codec_info);
- bits_per_sample = A2DP_VendorGetTrackBitsPerSampleLdac(p_codec_info);
- channel_mode = A2DP_VendorGetChannelModeCodeLdac(p_codec_info);
-
- log::info(", sample_rate={}, bits_per_sample={}, channel_mode={}", sample_rate, bits_per_sample,
- channel_mode);
-
- if (a2dp_ldac_decoder_cb.has_ldac_handle) {
- ldac_BCO_configure_func(a2dp_ldac_decoder_cb.ldac_handle_bco, sample_rate, bits_per_sample,
- channel_mode);
- }
- pthread_mutex_unlock(&(a2dp_ldac_decoder_cb.mutex));
-}
diff --git a/system/stack/a2dp/a2dp_vendor_ldac_linux.cc b/system/stack/a2dp/a2dp_vendor_ldac_linux.cc
index a777304c37..2401619c98 100644
--- a/system/stack/a2dp/a2dp_vendor_ldac_linux.cc
+++ b/system/stack/a2dp/a2dp_vendor_ldac_linux.cc
@@ -20,10 +20,6 @@
bool A2DP_IsCodecValidLdac(const uint8_t* p_codec_info) { return false; }
-tA2DP_STATUS A2DP_IsVendorSinkCodecSupportedLdac(const uint8_t* p_codec_info) {
- return A2DP_NOT_SUPPORTED_CODEC_TYPE;
-}
-
bool A2DP_VendorUsesRtpHeaderLdac(bool content_protection_enabled,
const uint8_t* p_codec_info) {
return false;
@@ -51,8 +47,6 @@ int A2DP_VendorGetTrackBitsPerSampleLdac(const uint8_t* p_codec_info) { return -
int A2DP_VendorGetTrackChannelCountLdac(const uint8_t* p_codec_info) { return -1; }
-int A2DP_VendorGetSinkTrackChannelTypeLdac(const uint8_t* p_codec_info) { return -1; }
-
int A2DP_VendorGetChannelModeCodeLdac(const uint8_t* p_codec_info) { return -1; }
int A2DP_VendorGetFrameSizeLdac(const uint8_t* p_codec_info) { return -1; }
@@ -75,28 +69,16 @@ const tA2DP_ENCODER_INTERFACE* A2DP_VendorGetEncoderInterfaceLdac(const uint8_t*
return nullptr;
}
-const tA2DP_DECODER_INTERFACE* A2DP_VendorGetDecoderInterfaceLdac(const uint8_t* p_codec_info) {
- return nullptr;
-}
-
bool A2DP_VendorAdjustCodecLdac(uint8_t* p_codec_info) { return false; }
btav_a2dp_codec_index_t A2DP_VendorSourceCodecIndexLdac(const uint8_t* p_codec_info) {
return BTAV_A2DP_CODEC_INDEX_MAX;
}
-btav_a2dp_codec_index_t A2DP_VendorSinkCodecIndexLdac(const uint8_t* p_codec_info) {
- return BTAV_A2DP_CODEC_INDEX_MAX;
-}
-
const char* A2DP_VendorCodecIndexStrLdac(void) { return "Ldac"; }
-const char* A2DP_VendorCodecIndexStrLdacSink(void) { return "Ldac SINK"; }
-
bool A2DP_VendorInitCodecConfigLdac(AvdtpSepConfig* p_cfg) { return false; }
-bool A2DP_VendorInitCodecConfigLdacSink(AvdtpSepConfig* p_cfg) { return false; }
-
A2dpCodecConfigLdacSource::A2dpCodecConfigLdacSource(btav_a2dp_codec_priority_t codec_priority)
: A2dpCodecConfigLdacBase(BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC, A2DP_VendorCodecIndexStrLdac(),
codec_priority, true) {}
@@ -118,13 +100,3 @@ tA2DP_STATUS A2dpCodecConfigLdacBase::setCodecConfig(const uint8_t* p_peer_codec
bool A2dpCodecConfigLdacBase::setPeerCodecCapabilities(const uint8_t* p_peer_codec_capabilities) {
return false;
}
-
-A2dpCodecConfigLdacSink::A2dpCodecConfigLdacSink(btav_a2dp_codec_priority_t codec_priority)
- : A2dpCodecConfigLdacBase(BTAV_A2DP_CODEC_INDEX_SINK_LDAC, A2DP_VendorCodecIndexStrLdacSink(),
- codec_priority, false) {}
-
-A2dpCodecConfigLdacSink::~A2dpCodecConfigLdacSink() {}
-
-bool A2dpCodecConfigLdacSink::init() { return false; }
-
-bool A2dpCodecConfigLdacSink::useRtpHeaderMarkerBit() const { return false; }
diff --git a/system/stack/include/a2dp_vendor_ldac.h b/system/stack/include/a2dp_vendor_ldac.h
index ec755c3b72..8f323a8c90 100644
--- a/system/stack/include/a2dp_vendor_ldac.h
+++ b/system/stack/include/a2dp_vendor_ldac.h
@@ -56,17 +56,6 @@ private:
void debug_codec_dump(int fd) override;
};
-class A2dpCodecConfigLdacSink : public A2dpCodecConfigLdacBase {
-public:
- A2dpCodecConfigLdacSink(btav_a2dp_codec_priority_t codec_priority);
- virtual ~A2dpCodecConfigLdacSink();
-
- bool init() override;
-
-private:
- bool useRtpHeaderMarkerBit() const override;
-};
-
// Checks whether the codec capabilities contain a valid A2DP LDAC Source
// codec.
// NOTE: only codecs that are implemented are considered valid.
@@ -166,13 +155,6 @@ std::string A2DP_VendorCodecInfoStringLdac(const uint8_t* p_codec_info);
// supported, otherwise NULL.
const tA2DP_ENCODER_INTERFACE* A2DP_VendorGetEncoderInterfaceLdac(const uint8_t* p_codec_info);
-// Gets the current A2DP LDAC decoder interface that can be used to decode
-// received A2DP packets - see |tA2DP_DECODER_INTERFACE|.
-// |p_codec_info| contains the codec information.
-// Returns the A2DP LDAC decoder interface if the |p_codec_info| is valid and
-// supported, otherwise NULL.
-const tA2DP_DECODER_INTERFACE* A2DP_VendorGetDecoderInterfaceLdac(const uint8_t* p_codec_info);
-
// Adjusts the A2DP LDAC codec, based on local support and Bluetooth
// specification.
// |p_codec_info| contains the codec information to adjust.
@@ -184,23 +166,11 @@ bool A2DP_VendorAdjustCodecLdac(uint8_t* p_codec_info);
// otherwise |BTAV_A2DP_CODEC_INDEX_MAX|.
btav_a2dp_codec_index_t A2DP_VendorSourceCodecIndexLdac(const uint8_t* p_codec_info);
-// Gets the A2DP LDAC Sink codec index for a given |p_codec_info|.
-// Returns the corresponding |btav_a2dp_codec_index_t| on success,
-// otherwise |BTAV_A2DP_CODEC_INDEX_MAX|.
-btav_a2dp_codec_index_t A2DP_VendorSinkCodecIndexLdac(const uint8_t* p_codec_info);
-
// Gets the A2DP LDAC Source codec name.
const char* A2DP_VendorCodecIndexStrLdac(void);
-// Gets the A2DP LDAC Sink codec name.
-const char* A2DP_VendorCodecIndexStrLdacSink(void);
-
// Initializes A2DP LDAC Source codec information into |AvdtpSepConfig|
// configuration entry pointed by |p_cfg|.
bool A2DP_VendorInitCodecConfigLdac(AvdtpSepConfig* p_cfg);
-// Initializes A2DP LDAC Sink codec information into |AvdtpSepConfig|
-// configuration entry pointed by |p_cfg|.
-bool A2DP_VendorInitCodecConfigLdacSink(AvdtpSepConfig* p_cfg);
-
#endif // A2DP_VENDOR_LDAC_H
diff --git a/system/stack/include/a2dp_vendor_ldac_decoder.h b/system/stack/include/a2dp_vendor_ldac_decoder.h
deleted file mode 100644
index 3d15b8397a..0000000000
--- a/system/stack/include/a2dp_vendor_ldac_decoder.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2016 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.
- */
-
-//
-// Interface to the A2DP LDAC Decoder
-//
-
-#ifndef A2DP_VENDOR_LDAC_DECODER_H
-#define A2DP_VENDOR_LDAC_DECODER_H
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include "a2dp_codec_api.h"
-#include "stack/include/bt_hdr.h"
-
-// Loads the A2DP LDAC decoder.
-// Return true on success, otherwise false.
-bool A2DP_VendorLoadDecoderLdac(void);
-
-// Unloads the A2DP LDAC decoder.
-void A2DP_VendorUnloadDecoderLdac(void);
-
-// Initialize the A2DP LDAC decoder.
-bool a2dp_vendor_ldac_decoder_init(decoded_data_callback_t decode_callback);
-
-// Cleanup the A2DP LDAC decoder.
-void a2dp_vendor_ldac_decoder_cleanup(void);
-
-// Decodes |p_buf|. Calls |decode_callback| passed into
-// |a2dp_vendor_ldac_decoder_init| if decoded frames are available.
-bool a2dp_vendor_ldac_decoder_decode_packet(BT_HDR* p_buf);
-
-// Start the A2DP LDAC decoder.
-void a2dp_vendor_ldac_decoder_start(void);
-
-// Suspend the A2DP LDAC decoder.
-void a2dp_vendor_ldac_decoder_suspend(void);
-
-// A2DP LDAC decoder configuration.
-void a2dp_vendor_ldac_decoder_configure(const uint8_t* p_codec_info);
-
-#endif // A2DP_VENDOR_LDAC_DECODER_H
diff --git a/system/stack/test/a2dp/a2dp_vendor_ldac_decoder_test.cc b/system/stack/test/a2dp/a2dp_vendor_ldac_decoder_test.cc
deleted file mode 100644
index 4f78adbb00..0000000000
--- a/system/stack/test/a2dp/a2dp_vendor_ldac_decoder_test.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2020 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.
- */
-
-#include "stack/include/a2dp_vendor_ldac_decoder.h"
-
-#include <gtest/gtest.h>
-
-#include <cstdint>
-
-#include "osi/include/allocator.h"
-#include "stack/include/bt_hdr.h"
-
-namespace {
-
-uint8_t* Data(BT_HDR* packet) { return packet->data + packet->offset; }
-
-} // namespace
-
-/**
- * Test class to test selected functionality in stack/a2dp
- */
-class A2dpStackTest : public ::testing::Test {
-protected:
- BT_HDR* AllocateL2capPacket(const std::vector<uint8_t> data) const {
- auto packet = AllocatePacket(data.size());
- std::copy(data.cbegin(), data.cend(), Data(packet));
- return packet;
- }
-
-private:
- BT_HDR* AllocatePacket(size_t packet_length) const {
- BT_HDR* packet = static_cast<BT_HDR*>(osi_calloc(sizeof(BT_HDR) + packet_length));
- packet->len = packet_length;
- return packet;
- }
-};
-
-TEST_F(A2dpStackTest, DecodePacket_ZeroLength) {
- const std::vector<uint8_t> data;
- BT_HDR* p_buf = AllocateL2capPacket(data);
- ASSERT_FALSE(a2dp_vendor_ldac_decoder_decode_packet(p_buf));
- osi_free(p_buf);
-}
diff --git a/system/stack/test/a2dp/a2dp_vendor_ldac_unittest.cc b/system/stack/test/a2dp/a2dp_vendor_ldac_unittest.cc
index d446d808ac..d6b19a1651 100644
--- a/system/stack/test/a2dp/a2dp_vendor_ldac_unittest.cc
+++ b/system/stack/test/a2dp/a2dp_vendor_ldac_unittest.cc
@@ -57,9 +57,6 @@ protected:
encoder_iface_ = const_cast<tA2DP_ENCODER_INTERFACE*>(
A2DP_VendorGetEncoderInterfaceLdac(kCodecInfoLdacCapability));
ASSERT_NE(encoder_iface_, nullptr);
- decoder_iface_ = const_cast<tA2DP_DECODER_INTERFACE*>(
- A2DP_VendorGetDecoderInterfaceLdac(kCodecInfoLdacCapability));
- ASSERT_NE(decoder_iface_, nullptr);
}
void TearDown() override {
@@ -69,22 +66,15 @@ protected:
if (encoder_iface_ != nullptr) {
encoder_iface_->encoder_cleanup();
}
- if (decoder_iface_ != nullptr) {
- decoder_iface_->decoder_cleanup();
- }
}
// NOTE: Make a super func for all codecs
void SetCodecConfig() {
uint8_t source_codec_info_result[AVDT_CODEC_SIZE];
- btav_a2dp_codec_index_t peer_codec_index;
a2dp_codecs_ = new A2dpCodecs(std::vector<btav_a2dp_codec_config_t>());
ASSERT_TRUE(a2dp_codecs_->init());
- peer_codec_index = A2DP_SinkCodecIndex(kCodecInfoLdacCapability);
- ASSERT_NE(peer_codec_index, BTAV_A2DP_CODEC_INDEX_MAX);
- ASSERT_EQ(peer_codec_index, BTAV_A2DP_CODEC_INDEX_SINK_LDAC);
source_codec_config_ = a2dp_codecs_->findSourceCodecConfig(kCodecInfoLdacCapability);
ASSERT_NE(source_codec_config_, nullptr);
ASSERT_TRUE(a2dp_codecs_->setCodecConfig(kCodecInfoLdacCapability, true,
@@ -103,7 +93,6 @@ protected:
encoder_iface_->encoder_init(&peer_params, source_codec_config_, read_cb, enqueue_cb);
}
- void InitializeDecoder(decoded_data_callback_t data_cb) { decoder_iface_->decoder_init(data_cb); }
BT_HDR* AllocateL2capPacket(const std::vector<uint8_t> data) const {
auto packet = AllocatePacket(data.size());
std::copy(data.cbegin(), data.cend(), Data(packet));
@@ -118,7 +107,6 @@ protected:
A2dpCodecConfig* source_codec_config_;
A2dpCodecs* a2dp_codecs_;
tA2DP_ENCODER_INTERFACE* encoder_iface_;
- tA2DP_DECODER_INTERFACE* decoder_iface_;
};
TEST_F(A2dpLdacTest, a2dp_source_read_underflow) {
diff --git a/system/stack/test/a2dp/misc_fake.cc b/system/stack/test/a2dp/misc_fake.cc
deleted file mode 100644
index ee82394629..0000000000
--- a/system/stack/test/a2dp/misc_fake.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2020 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.
- */
-
-#include "stack/include/a2dp_vendor_ldac.h"
-
-int A2DP_VendorGetTrackSampleRateLdac(const uint8_t* /*p_codec_info*/) { return 0; }
-int A2DP_VendorGetTrackBitsPerSampleLdac(const uint8_t* /*p_codec_info*/) { return 0; }
-int A2DP_VendorGetChannelModeCodeLdac(const uint8_t* /*p_codec_info*/) { return 0; }
diff --git a/system/stack/test/fuzzers/a2dp/codec/a2dpCodecHelperFunctions.h b/system/stack/test/fuzzers/a2dp/codec/a2dpCodecHelperFunctions.h
index 87c9a55cc0..888fa563f6 100644
--- a/system/stack/test/fuzzers/a2dp/codec/a2dpCodecHelperFunctions.h
+++ b/system/stack/test/fuzzers/a2dp/codec/a2dpCodecHelperFunctions.h
@@ -34,7 +34,6 @@ static const std::vector<btav_a2dp_codec_index_t> CODEC_INDEX_ENUM_VALS = {
BTAV_A2DP_CODEC_INDEX_SINK_MIN,
BTAV_A2DP_CODEC_INDEX_SINK_SBC,
BTAV_A2DP_CODEC_INDEX_SINK_AAC,
- BTAV_A2DP_CODEC_INDEX_SINK_LDAC,
BTAV_A2DP_CODEC_INDEX_SINK_MAX,
BTAV_A2DP_CODEC_INDEX_MIN,
BTAV_A2DP_CODEC_INDEX_MAX};
diff --git a/system/stack/test/stack_a2dp_test.cc b/system/stack/test/stack_a2dp_test.cc
index ee4d56ce54..e54a6be472 100644
--- a/system/stack/test/stack_a2dp_test.cc
+++ b/system/stack/test/stack_a2dp_test.cc
@@ -244,20 +244,6 @@ const uint8_t codec_info_non_a2dp_fake[AVDT_CODEC_SIZE] = {
10 // Unused
};
-static const char* APTX_ENCODER_LIB_NAME = "libaptX_encoder.so";
-static const char* APTX_HD_ENCODER_LIB_NAME = "libaptXHD_encoder.so";
-static const char* LDAC_ENCODER_LIB_NAME = "libldacBT_enc.so";
-static const char* LDAC_DECODER_LIB_NAME = "libldacBT_dec.so";
-
-static bool has_shared_library(const char* name) {
- void* lib_handle = dlopen(name, RTLD_NOW);
- if (lib_handle != nullptr) {
- dlclose(lib_handle);
- return true;
- }
- return false;
-}
-
} // namespace
class StackA2dpTest : public ::testing::Test {
@@ -270,46 +256,22 @@ protected:
bool supported = false;
switch (codec_index) {
case BTAV_A2DP_CODEC_INDEX_SOURCE_SBC:
- supported = true;
- break;
case BTAV_A2DP_CODEC_INDEX_SOURCE_AAC:
- supported = true;
- break;
case BTAV_A2DP_CODEC_INDEX_SOURCE_APTX:
- // Codec aptX is supported only if the device has the corresponding
- // shared library installed.
- supported = has_shared_library(APTX_ENCODER_LIB_NAME);
- break;
case BTAV_A2DP_CODEC_INDEX_SOURCE_APTX_HD:
- // Codec aptX-HD is supported only if the device has the corresponding
- // shared library installed.
- supported = has_shared_library(APTX_HD_ENCODER_LIB_NAME);
- break;
case BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC:
- // Codec LDAC is supported only if the device has the corresponding
- // shared library installed.
- supported = has_shared_library(LDAC_ENCODER_LIB_NAME);
- break;
- case BTAV_A2DP_CODEC_INDEX_SINK_SBC:
+ case BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS:
supported = true;
break;
+ case BTAV_A2DP_CODEC_INDEX_SINK_SBC:
case BTAV_A2DP_CODEC_INDEX_SINK_AAC:
- supported = true;
- break;
- case BTAV_A2DP_CODEC_INDEX_SINK_LDAC:
- // Codec LDAC is supported only if the device has the corresponding
- // shared library installed.
- supported = has_shared_library(LDAC_DECODER_LIB_NAME);
- break;
- case BTAV_A2DP_CODEC_INDEX_SOURCE_LC3:
- break;
- case BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS:
case BTAV_A2DP_CODEC_INDEX_SINK_OPUS:
supported = true;
break;
case BTAV_A2DP_CODEC_INDEX_MAX:
case BTAV_A2DP_CODEC_INDEX_SOURCE_MAX:
case BTAV_A2DP_CODEC_INDEX_SINK_MAX:
+ case BTAV_A2DP_CODEC_INDEX_SOURCE_LC3:
// Needed to avoid using "default:" case so we can capture when
// a new codec is added, and it can be included here.
break;