From 653108cc56845eb1e1475bf9eb971198b4a8239c Mon Sep 17 00:00:00 2001 From: Josh Wu Date: Fri, 21 Jan 2022 22:33:43 -0800 Subject: [PATCH] BtAudio: Remove sample_rate_to_hidl_2_0_map Bug: 203490261 Test: m android.hardware.bluetooth.audio-V1-impl Change-Id: Ie19f808e304ea6f293c611d99a810a97a7e1fd94 --- .../aidl_session/HidlToAidlMiddleware.cpp | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/bluetooth/audio/utils/aidl_session/HidlToAidlMiddleware.cpp b/bluetooth/audio/utils/aidl_session/HidlToAidlMiddleware.cpp index 8f7a1774c0..d16fc9be6f 100644 --- a/bluetooth/audio/utils/aidl_session/HidlToAidlMiddleware.cpp +++ b/bluetooth/audio/utils/aidl_session/HidlToAidlMiddleware.cpp @@ -111,18 +111,6 @@ const static std::unordered_map SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH}, }; -const static std::unordered_map - sample_rate_to_hidl_2_0_map{ - {44100, SampleRate_2_0::RATE_44100}, - {48000, SampleRate_2_0::RATE_48000}, - {88200, SampleRate_2_0::RATE_88200}, - {96000, SampleRate_2_0::RATE_96000}, - {176400, SampleRate_2_0::RATE_176400}, - {192000, SampleRate_2_0::RATE_192000}, - {16000, SampleRate_2_0::RATE_16000}, - {24000, SampleRate_2_0::RATE_24000}, - }; - const static std::unordered_map sample_rate_to_hidl_2_1_map{ {44100, SampleRate_2_1::RATE_44100}, @@ -231,18 +219,19 @@ inline HidlStatus to_hidl_status(const BluetoothAudioStatus& status) { } } -inline SampleRate_2_0 to_hidl_sample_rate_2_0(const int32_t sample_rate_hz) { - auto it = sample_rate_to_hidl_2_0_map.find(sample_rate_hz); - if (it != sample_rate_to_hidl_2_0_map.end()) return it->second; - return SampleRate_2_0::RATE_UNKNOWN; -} - inline SampleRate_2_1 to_hidl_sample_rate_2_1(const int32_t sample_rate_hz) { auto it = sample_rate_to_hidl_2_1_map.find(sample_rate_hz); if (it != sample_rate_to_hidl_2_1_map.end()) return it->second; return SampleRate_2_1::RATE_UNKNOWN; } +inline SampleRate_2_0 to_hidl_sample_rate_2_0(const int32_t sample_rate_hz) { + auto it = sample_rate_to_hidl_2_1_map.find(sample_rate_hz); + if (it != sample_rate_to_hidl_2_1_map.end()) + return static_cast(it->second); + return SampleRate_2_0::RATE_UNKNOWN; +} + inline BitsPerSample_2_0 to_hidl_bits_per_sample(const int8_t bit_per_sample) { switch (bit_per_sample) { case 16: