Loading system/audio_hal_interface/a2dp_encoding.cc +3 −3 Original line number Diff line number Diff line Loading @@ -70,11 +70,11 @@ void cleanup() { } // Set up the codec into BluetoothAudio HAL bool setup_codec() { bool setup_codec(A2dpCodecConfig* a2dp_config) { if (HalVersionManager::GetHalTransport() == BluetoothAudioHalTransport::HIDL) { return hidl::a2dp::setup_codec(); return hidl::a2dp::setup_codec(a2dp_config); } return aidl::a2dp::setup_codec(); return aidl::a2dp::setup_codec(a2dp_config); } // Send command to the BluetoothAudio HAL: StartSession, EndSession, Loading system/audio_hal_interface/a2dp_encoding.h +2 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <sstream> #include <vector> #include "a2dp_codec_api.h" #include "a2dp_constants.h" #include "avdt_api.h" #include "common/message_loop_thread.h" Loading Loading @@ -56,7 +57,7 @@ bool init(bluetooth::common::MessageLoopThread* message_loop); void cleanup(); // Set up the codec into BluetoothAudio HAL bool setup_codec(); bool setup_codec(A2dpCodecConfig* a2dp_config); // Set low latency buffer mode allowed or disallowed void set_audio_low_latency_mode_allowed(bool allowed); Loading system/audio_hal_interface/a2dp_encoding_host.cc +1 −1 Original line number Diff line number Diff line Loading @@ -248,7 +248,7 @@ void cleanup() { } // Set up the codec into BluetoothAudio HAL bool setup_codec() { bool setup_codec(A2dpCodecConfig* /*a2dp_config*/) { // TODO: setup codec return true; } Loading system/audio_hal_interface/aidl/a2dp_encoding_aidl.cc +9 −22 Original line number Diff line number Diff line Loading @@ -288,12 +288,8 @@ static uint16_t a2dp_get_peer_mtu(btav_a2dp_codec_index_t codec_index, uint8_t c return peer_mtu; } bool a2dp_get_selected_hal_codec_config(CodecConfiguration* codec_config) { A2dpCodecConfig* a2dp_config = bta_av_get_a2dp_current_codec(); if (a2dp_config == nullptr) { log::warn("failure to get A2DP codec config"); return false; } bool a2dp_get_selected_hal_codec_config(A2dpCodecConfig* a2dp_config, CodecConfiguration* codec_config) { btav_a2dp_codec_config_t current_codec = a2dp_config->getCodecConfig(); switch (current_codec.codec_type) { case BTAV_A2DP_CODEC_INDEX_SOURCE_SBC: Loading Loading @@ -360,16 +356,11 @@ bool a2dp_get_selected_hal_codec_config(CodecConfiguration* codec_config) { return true; } bool a2dp_get_selected_hal_pcm_config(PcmConfiguration* pcm_config) { static bool a2dp_get_selected_hal_pcm_config(A2dpCodecConfig* a2dp_codec_configs, PcmConfiguration* pcm_config) { if (pcm_config == nullptr) { return false; } A2dpCodecConfig* a2dp_codec_configs = bta_av_get_a2dp_current_codec(); if (a2dp_codec_configs == nullptr) { log::warn("failure to get A2DP codec config"); *pcm_config = BluetoothAudioSinkClientInterface::kInvalidPcmConfiguration; return false; } btav_a2dp_codec_config_t current_codec = a2dp_codec_configs->getCodecConfig(); pcm_config->sampleRateHz = A2dpCodecToHalSampleRate(current_codec); Loading Loading @@ -514,18 +505,14 @@ void cleanup() { } // Set up the codec into BluetoothAudio HAL bool setup_codec() { bool setup_codec(A2dpCodecConfig* a2dp_config) { log::assert_that(a2dp_config != nullptr, "received invalid codec configuration"); if (!is_hal_enabled()) { log::error("BluetoothAudio HAL is not enabled"); return false; } A2dpCodecConfig* a2dp_config = bta_av_get_a2dp_current_codec(); if (a2dp_config == nullptr) { log::error("the current codec is not configured"); return false; } if (provider::supports_codec(a2dp_config->codecIndex())) { // The codec is supported in the provider info (AIDL v4). // In this case, the codec is offloaded, and the configuration passed Loading Loading @@ -569,7 +556,7 @@ bool setup_codec() { // Fallback to legacy offloading path. CodecConfiguration codec_config{}; if (!a2dp_get_selected_hal_codec_config(&codec_config)) { if (!a2dp_get_selected_hal_codec_config(a2dp_config, &codec_config)) { log::error("Failed to get CodecConfiguration"); return false; } Loading @@ -592,7 +579,7 @@ bool setup_codec() { audio_config.set<AudioConfiguration::a2dpConfig>(codec_config); } else { PcmConfiguration pcm_config{}; if (!a2dp_get_selected_hal_pcm_config(&pcm_config)) { if (!a2dp_get_selected_hal_pcm_config(a2dp_config, &pcm_config)) { log::error("Failed to get PcmConfiguration"); return false; } Loading system/audio_hal_interface/aidl/a2dp_encoding_aidl.h +1 −1 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ void cleanup(); /*** * Set up the codec into BluetoothAudio HAL ***/ bool setup_codec(); bool setup_codec(A2dpCodecConfig* a2dp_config); /*** * Send command to the BluetoothAudio HAL: StartSession, EndSession, Loading Loading
system/audio_hal_interface/a2dp_encoding.cc +3 −3 Original line number Diff line number Diff line Loading @@ -70,11 +70,11 @@ void cleanup() { } // Set up the codec into BluetoothAudio HAL bool setup_codec() { bool setup_codec(A2dpCodecConfig* a2dp_config) { if (HalVersionManager::GetHalTransport() == BluetoothAudioHalTransport::HIDL) { return hidl::a2dp::setup_codec(); return hidl::a2dp::setup_codec(a2dp_config); } return aidl::a2dp::setup_codec(); return aidl::a2dp::setup_codec(a2dp_config); } // Send command to the BluetoothAudio HAL: StartSession, EndSession, Loading
system/audio_hal_interface/a2dp_encoding.h +2 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <sstream> #include <vector> #include "a2dp_codec_api.h" #include "a2dp_constants.h" #include "avdt_api.h" #include "common/message_loop_thread.h" Loading Loading @@ -56,7 +57,7 @@ bool init(bluetooth::common::MessageLoopThread* message_loop); void cleanup(); // Set up the codec into BluetoothAudio HAL bool setup_codec(); bool setup_codec(A2dpCodecConfig* a2dp_config); // Set low latency buffer mode allowed or disallowed void set_audio_low_latency_mode_allowed(bool allowed); Loading
system/audio_hal_interface/a2dp_encoding_host.cc +1 −1 Original line number Diff line number Diff line Loading @@ -248,7 +248,7 @@ void cleanup() { } // Set up the codec into BluetoothAudio HAL bool setup_codec() { bool setup_codec(A2dpCodecConfig* /*a2dp_config*/) { // TODO: setup codec return true; } Loading
system/audio_hal_interface/aidl/a2dp_encoding_aidl.cc +9 −22 Original line number Diff line number Diff line Loading @@ -288,12 +288,8 @@ static uint16_t a2dp_get_peer_mtu(btav_a2dp_codec_index_t codec_index, uint8_t c return peer_mtu; } bool a2dp_get_selected_hal_codec_config(CodecConfiguration* codec_config) { A2dpCodecConfig* a2dp_config = bta_av_get_a2dp_current_codec(); if (a2dp_config == nullptr) { log::warn("failure to get A2DP codec config"); return false; } bool a2dp_get_selected_hal_codec_config(A2dpCodecConfig* a2dp_config, CodecConfiguration* codec_config) { btav_a2dp_codec_config_t current_codec = a2dp_config->getCodecConfig(); switch (current_codec.codec_type) { case BTAV_A2DP_CODEC_INDEX_SOURCE_SBC: Loading Loading @@ -360,16 +356,11 @@ bool a2dp_get_selected_hal_codec_config(CodecConfiguration* codec_config) { return true; } bool a2dp_get_selected_hal_pcm_config(PcmConfiguration* pcm_config) { static bool a2dp_get_selected_hal_pcm_config(A2dpCodecConfig* a2dp_codec_configs, PcmConfiguration* pcm_config) { if (pcm_config == nullptr) { return false; } A2dpCodecConfig* a2dp_codec_configs = bta_av_get_a2dp_current_codec(); if (a2dp_codec_configs == nullptr) { log::warn("failure to get A2DP codec config"); *pcm_config = BluetoothAudioSinkClientInterface::kInvalidPcmConfiguration; return false; } btav_a2dp_codec_config_t current_codec = a2dp_codec_configs->getCodecConfig(); pcm_config->sampleRateHz = A2dpCodecToHalSampleRate(current_codec); Loading Loading @@ -514,18 +505,14 @@ void cleanup() { } // Set up the codec into BluetoothAudio HAL bool setup_codec() { bool setup_codec(A2dpCodecConfig* a2dp_config) { log::assert_that(a2dp_config != nullptr, "received invalid codec configuration"); if (!is_hal_enabled()) { log::error("BluetoothAudio HAL is not enabled"); return false; } A2dpCodecConfig* a2dp_config = bta_av_get_a2dp_current_codec(); if (a2dp_config == nullptr) { log::error("the current codec is not configured"); return false; } if (provider::supports_codec(a2dp_config->codecIndex())) { // The codec is supported in the provider info (AIDL v4). // In this case, the codec is offloaded, and the configuration passed Loading Loading @@ -569,7 +556,7 @@ bool setup_codec() { // Fallback to legacy offloading path. CodecConfiguration codec_config{}; if (!a2dp_get_selected_hal_codec_config(&codec_config)) { if (!a2dp_get_selected_hal_codec_config(a2dp_config, &codec_config)) { log::error("Failed to get CodecConfiguration"); return false; } Loading @@ -592,7 +579,7 @@ bool setup_codec() { audio_config.set<AudioConfiguration::a2dpConfig>(codec_config); } else { PcmConfiguration pcm_config{}; if (!a2dp_get_selected_hal_pcm_config(&pcm_config)) { if (!a2dp_get_selected_hal_pcm_config(a2dp_config, &pcm_config)) { log::error("Failed to get PcmConfiguration"); return false; } Loading
system/audio_hal_interface/aidl/a2dp_encoding_aidl.h +1 −1 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ void cleanup(); /*** * Set up the codec into BluetoothAudio HAL ***/ bool setup_codec(); bool setup_codec(A2dpCodecConfig* a2dp_config); /*** * Send command to the BluetoothAudio HAL: StartSession, EndSession, Loading