Loading system/audio_bluetooth_hw/device_port_proxy.cc +7 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,13 @@ bool BluetoothAudioPortAidl::init_session_type(audio_devices_t device) { << StringPrintf("%#x", device) << ")"; session_type_ = SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH; break; case AUDIO_DEVICE_OUT_BLE_BROADCAST: LOG(VERBOSE) << __func__ << ": device=AUDIO_DEVICE_OUT_BLE_BROADCAST (MEDIA) (" << StringPrintf("%#x", device) << ")"; session_type_ = SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH; break; default: LOG(ERROR) << __func__ << ": unknown device=" << StringPrintf("%#x", device); Loading system/audio_hal_interface/aidl/client_interface_aidl.cc +6 −2 Original line number Diff line number Diff line Loading @@ -190,7 +190,9 @@ bool BluetoothAudioClientInterface::UpdateAudioConfig( transport_->GetSessionType() == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH || transport_->GetSessionType() == SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH); SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH || transport_->GetSessionType() == SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH); bool is_a2dp_offload_session = (transport_->GetSessionType() == SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH); Loading @@ -198,7 +200,9 @@ bool BluetoothAudioClientInterface::UpdateAudioConfig( (transport_->GetSessionType() == SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH || transport_->GetSessionType() == SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH); SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH || transport_->GetSessionType() == SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH); auto audio_config_tag = audio_config.getTag(); bool is_software_audio_config = (is_software_session && Loading system/audio_hal_interface/aidl/le_audio_software_aidl.cc +24 −13 Original line number Diff line number Diff line Loading @@ -54,14 +54,6 @@ static ChannelMode le_audio_channel_mode2audio_hal(uint8_t channels_count) { return ChannelMode::UNKNOWN; } bool is_source_hal_enabled() { return LeAudioSourceTransport::interface != nullptr; } bool is_sink_hal_enabled() { return LeAudioSinkTransport::interface != nullptr; } LeAudioTransport::LeAudioTransport(void (*flush)(void), StreamCallbacks stream_cb, PcmConfiguration pcm_config) Loading Loading @@ -183,17 +175,36 @@ void LeAudioTransport::ClearPendingStartStream(void) { is_pending_start_request_ = false; } void flush_sink() { if (!is_sink_hal_enabled()) return; inline void flush_unicast_sink() { if (LeAudioSinkTransport::interface_unicast_ == nullptr) return; LeAudioSinkTransport::interface_unicast_->FlushAudioData(); } inline void flush_broadcast_sink() { if (LeAudioSinkTransport::interface_broadcast_ == nullptr) return; LeAudioSinkTransport::interface->FlushAudioData(); LeAudioSinkTransport::interface_broadcast_->FlushAudioData(); } inline bool is_broadcaster_session(SessionType session_type) { if (session_type == SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH || session_type == SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH) { return true; } return false; } LeAudioSinkTransport::LeAudioSinkTransport(SessionType session_type, StreamCallbacks stream_cb) : IBluetoothSinkTransportInstance(session_type, (AudioConfiguration){}) { transport_ = new LeAudioTransport(flush_sink, std::move(stream_cb), {16000, ChannelMode::STEREO, 16, 0}); transport_ = new LeAudioTransport( is_broadcaster_session(session_type) ? flush_broadcast_sink : flush_unicast_sink, std::move(stream_cb), {16000, ChannelMode::STEREO, 16, 0}); }; LeAudioSinkTransport::~LeAudioSinkTransport() { delete transport_; } Loading system/audio_hal_interface/aidl/le_audio_software_aidl.h +8 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ namespace audio { namespace aidl { namespace le_audio { using ::aidl::android::hardware::bluetooth::audio:: LeAudioBroadcastConfiguration; using ::aidl::android::hardware::bluetooth::audio::LeAudioConfiguration; using ::aidl::android::hardware::bluetooth::audio::PcmConfiguration; using ::aidl::android::hardware::bluetooth::audio::SessionType; Loading Loading @@ -144,8 +146,12 @@ class LeAudioSinkTransport bool IsPendingStartStream(void); void ClearPendingStartStream(void); static inline LeAudioSinkTransport* instance = nullptr; static inline BluetoothAudioSinkClientInterface* interface = nullptr; static inline LeAudioSinkTransport* instance_unicast_ = nullptr; static inline LeAudioSinkTransport* instance_broadcast_ = nullptr; static inline BluetoothAudioSinkClientInterface* interface_unicast_ = nullptr; static inline BluetoothAudioSinkClientInterface* interface_broadcast_ = nullptr; private: LeAudioTransport* transport_; Loading system/audio_hal_interface/fuzzer/libbt_audio_hal_le_audio_software_fuzzer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -80,9 +80,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { interface->ReleaseSource(source); } if (!interface->IsSinkAcquired()) { if (!interface->IsUnicastSinkAcquired()) { LeAudioClientInterface::Sink* sink = interface->GetSink(streamCb, &messageLoopThread); interface->GetSink(streamCb, &messageLoopThread, false); if (sink != nullptr) { sink->StartSession(); uint16_t delay = fdp.ConsumeIntegral<uint16_t>(); Loading Loading
system/audio_bluetooth_hw/device_port_proxy.cc +7 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,13 @@ bool BluetoothAudioPortAidl::init_session_type(audio_devices_t device) { << StringPrintf("%#x", device) << ")"; session_type_ = SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH; break; case AUDIO_DEVICE_OUT_BLE_BROADCAST: LOG(VERBOSE) << __func__ << ": device=AUDIO_DEVICE_OUT_BLE_BROADCAST (MEDIA) (" << StringPrintf("%#x", device) << ")"; session_type_ = SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH; break; default: LOG(ERROR) << __func__ << ": unknown device=" << StringPrintf("%#x", device); Loading
system/audio_hal_interface/aidl/client_interface_aidl.cc +6 −2 Original line number Diff line number Diff line Loading @@ -190,7 +190,9 @@ bool BluetoothAudioClientInterface::UpdateAudioConfig( transport_->GetSessionType() == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH || transport_->GetSessionType() == SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH); SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH || transport_->GetSessionType() == SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH); bool is_a2dp_offload_session = (transport_->GetSessionType() == SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH); Loading @@ -198,7 +200,9 @@ bool BluetoothAudioClientInterface::UpdateAudioConfig( (transport_->GetSessionType() == SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH || transport_->GetSessionType() == SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH); SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH || transport_->GetSessionType() == SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH); auto audio_config_tag = audio_config.getTag(); bool is_software_audio_config = (is_software_session && Loading
system/audio_hal_interface/aidl/le_audio_software_aidl.cc +24 −13 Original line number Diff line number Diff line Loading @@ -54,14 +54,6 @@ static ChannelMode le_audio_channel_mode2audio_hal(uint8_t channels_count) { return ChannelMode::UNKNOWN; } bool is_source_hal_enabled() { return LeAudioSourceTransport::interface != nullptr; } bool is_sink_hal_enabled() { return LeAudioSinkTransport::interface != nullptr; } LeAudioTransport::LeAudioTransport(void (*flush)(void), StreamCallbacks stream_cb, PcmConfiguration pcm_config) Loading Loading @@ -183,17 +175,36 @@ void LeAudioTransport::ClearPendingStartStream(void) { is_pending_start_request_ = false; } void flush_sink() { if (!is_sink_hal_enabled()) return; inline void flush_unicast_sink() { if (LeAudioSinkTransport::interface_unicast_ == nullptr) return; LeAudioSinkTransport::interface_unicast_->FlushAudioData(); } inline void flush_broadcast_sink() { if (LeAudioSinkTransport::interface_broadcast_ == nullptr) return; LeAudioSinkTransport::interface->FlushAudioData(); LeAudioSinkTransport::interface_broadcast_->FlushAudioData(); } inline bool is_broadcaster_session(SessionType session_type) { if (session_type == SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH || session_type == SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH) { return true; } return false; } LeAudioSinkTransport::LeAudioSinkTransport(SessionType session_type, StreamCallbacks stream_cb) : IBluetoothSinkTransportInstance(session_type, (AudioConfiguration){}) { transport_ = new LeAudioTransport(flush_sink, std::move(stream_cb), {16000, ChannelMode::STEREO, 16, 0}); transport_ = new LeAudioTransport( is_broadcaster_session(session_type) ? flush_broadcast_sink : flush_unicast_sink, std::move(stream_cb), {16000, ChannelMode::STEREO, 16, 0}); }; LeAudioSinkTransport::~LeAudioSinkTransport() { delete transport_; } Loading
system/audio_hal_interface/aidl/le_audio_software_aidl.h +8 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ namespace audio { namespace aidl { namespace le_audio { using ::aidl::android::hardware::bluetooth::audio:: LeAudioBroadcastConfiguration; using ::aidl::android::hardware::bluetooth::audio::LeAudioConfiguration; using ::aidl::android::hardware::bluetooth::audio::PcmConfiguration; using ::aidl::android::hardware::bluetooth::audio::SessionType; Loading Loading @@ -144,8 +146,12 @@ class LeAudioSinkTransport bool IsPendingStartStream(void); void ClearPendingStartStream(void); static inline LeAudioSinkTransport* instance = nullptr; static inline BluetoothAudioSinkClientInterface* interface = nullptr; static inline LeAudioSinkTransport* instance_unicast_ = nullptr; static inline LeAudioSinkTransport* instance_broadcast_ = nullptr; static inline BluetoothAudioSinkClientInterface* interface_unicast_ = nullptr; static inline BluetoothAudioSinkClientInterface* interface_broadcast_ = nullptr; private: LeAudioTransport* transport_; Loading
system/audio_hal_interface/fuzzer/libbt_audio_hal_le_audio_software_fuzzer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -80,9 +80,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { interface->ReleaseSource(source); } if (!interface->IsSinkAcquired()) { if (!interface->IsUnicastSinkAcquired()) { LeAudioClientInterface::Sink* sink = interface->GetSink(streamCb, &messageLoopThread); interface->GetSink(streamCb, &messageLoopThread, false); if (sink != nullptr) { sink->StartSession(); uint16_t delay = fdp.ConsumeIntegral<uint16_t>(); Loading