diff options
author | Eric Laurent <elaurent@google.com> | 2022-05-06 08:34:23 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-05-06 08:34:23 +0000 |
commit | a1a87002a23c8ef272013a54c1496368e2d76ab3 (patch) | |
tree | 9c246e891cec42ac1c2a67629975937fbeef777a | |
parent | 1e8223c47a9fe2077e469100ac5ae64f7baa7792 (diff) | |
parent | 575e3bb555ba429fac217c6dee7f0d844c921af5 (diff) | |
download | media-a1a87002a23c8ef272013a54c1496368e2d76ab3.tar.gz |
Merge "audio: utility and macros for LE audio broadcast" into tm-dev am: 575e3bb555
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/media/+/17183474
Change-Id: I9dd3efe6cbcd05e9a5722afe2c10f8f94d508160
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | audio/include/system/audio-base-utils.h | 10 | ||||
-rw-r--r-- | audio/include/system/audio.h | 7 | ||||
-rw-r--r-- | tests/systemaudio_tests.cpp | 3 |
3 files changed, 20 insertions, 0 deletions
diff --git a/audio/include/system/audio-base-utils.h b/audio/include/system/audio-base-utils.h index 5f094c88..525a3837 100644 --- a/audio/include/system/audio-base-utils.h +++ b/audio/include/system/audio-base-utils.h @@ -229,6 +229,11 @@ static CONST_ARRAY audio_devices_t AUDIO_DEVICE_OUT_ALL_BLE_ARRAY[] = { AUDIO_DEVICE_OUT_BLE_BROADCAST, // 0x20000002u }; +static CONST_ARRAY audio_devices_t AUDIO_DEVICE_OUT_BLE_UNICAST_ARRAY[] = { + AUDIO_DEVICE_OUT_BLE_HEADSET, // 0x20000000u + AUDIO_DEVICE_OUT_BLE_SPEAKER, // 0x20000001u +}; + // inline constexpr static CONST_ARRAY audio_devices_t AUDIO_DEVICE_IN_ALL_ARRAY[] = { AUDIO_DEVICE_IN_COMMUNICATION, // 0x80000001u @@ -312,6 +317,8 @@ static const uint32_t AUDIO_DEVICE_OUT_DIGITAL_CNT = AUDIO_ARRAY_SIZE( AUDIO_DEVICE_OUT_ALL_DIGITAL_ARRAY); static const uint32_t AUDIO_DEVICE_OUT_BLE_CNT = AUDIO_ARRAY_SIZE( AUDIO_DEVICE_OUT_ALL_BLE_ARRAY); +static const uint32_t AUDIO_DEVICE_OUT_BLE_UNICAST_CNT = AUDIO_ARRAY_SIZE( + AUDIO_DEVICE_OUT_BLE_UNICAST_ARRAY); static const uint32_t AUDIO_DEVICE_IN_CNT = AUDIO_ARRAY_SIZE(AUDIO_DEVICE_IN_ALL_ARRAY); static const uint32_t AUDIO_DEVICE_IN_SCO_CNT = AUDIO_ARRAY_SIZE(AUDIO_DEVICE_IN_ALL_SCO_ARRAY); @@ -357,6 +364,8 @@ static_assert(isSorted(AUDIO_DEVICE_OUT_ALL_DIGITAL_ARRAY), "AUDIO_DEVICE_OUT_ALL_DIGITAL_ARRAY must be sorted"); static_assert(isSorted(AUDIO_DEVICE_OUT_ALL_BLE_ARRAY), "AUDIO_DEVICE_OUT_ALL_BLE_ARRAY must be sorted"); +static_assert(isSorted(AUDIO_DEVICE_OUT_BLE_UNICAST_ARRAY), + "AUDIO_DEVICE_OUT_BLE_UNICAST_ARRAY must be sorted"); static_assert(isSorted(AUDIO_DEVICE_IN_ALL_ARRAY), "AUDIO_DEVICE_IN_ALL_ARRAY must be sorted"); static_assert(isSorted(AUDIO_DEVICE_IN_ALL_SCO_ARRAY), @@ -374,6 +383,7 @@ static_assert(AUDIO_DEVICE_OUT_SCO_CNT == std::size(AUDIO_DEVICE_OUT_ALL_SCO_ARR static_assert(AUDIO_DEVICE_OUT_USB_CNT == std::size(AUDIO_DEVICE_OUT_ALL_USB_ARRAY)); static_assert(AUDIO_DEVICE_OUT_DIGITAL_CNT == std::size(AUDIO_DEVICE_OUT_ALL_DIGITAL_ARRAY)); static_assert(AUDIO_DEVICE_OUT_BLE_CNT == std::size(AUDIO_DEVICE_OUT_ALL_BLE_ARRAY)); +static_assert(AUDIO_DEVICE_OUT_BLE_UNICAST_CNT == std::size(AUDIO_DEVICE_OUT_BLE_UNICAST_ARRAY)); static_assert(AUDIO_DEVICE_IN_CNT == std::size(AUDIO_DEVICE_IN_ALL_ARRAY)); static_assert(AUDIO_DEVICE_IN_SCO_CNT == std::size(AUDIO_DEVICE_IN_ALL_SCO_ARRAY)); static_assert(AUDIO_DEVICE_IN_USB_CNT == std::size(AUDIO_DEVICE_IN_ALL_USB_ARRAY)); diff --git a/audio/include/system/audio.h b/audio/include/system/audio.h index 25092f6d..2f7fe23e 100644 --- a/audio/include/system/audio.h +++ b/audio/include/system/audio.h @@ -1386,6 +1386,13 @@ static inline bool audio_is_ble_out_device(audio_devices_t device) AUDIO_DEVICE_OUT_ALL_BLE_ARRAY, 0 /*left*/, AUDIO_DEVICE_OUT_BLE_CNT, device); } +static inline bool audio_is_ble_unicast_device(audio_devices_t device) +{ + return audio_binary_search_device_array( + AUDIO_DEVICE_OUT_BLE_UNICAST_ARRAY, 0 /*left*/, + AUDIO_DEVICE_OUT_BLE_UNICAST_CNT, device); +} + static inline bool audio_is_ble_in_device(audio_devices_t device) { return audio_binary_search_device_array( diff --git a/tests/systemaudio_tests.cpp b/tests/systemaudio_tests.cpp index 79052f59..985673f8 100644 --- a/tests/systemaudio_tests.cpp +++ b/tests/systemaudio_tests.cpp @@ -205,6 +205,9 @@ TEST(SystemAudioTest, AudioDeviceTypeHelperFunction) { runAudioDeviceTypeHelperFunction(allDeviceTypes, AUDIO_DEVICE_IN_ALL_BLE_ARRAY, std::size(AUDIO_DEVICE_IN_ALL_BLE_ARRAY), "ble in", audio_is_ble_in_device); + runAudioDeviceTypeHelperFunction(allDeviceTypes, AUDIO_DEVICE_OUT_BLE_UNICAST_ARRAY, + std::size(AUDIO_DEVICE_OUT_BLE_UNICAST_ARRAY), "ble unicast", + audio_is_ble_unicast_device); } |