Loading system/audio_hal_interface/le_audio_software.cc +5 −3 Original line number Diff line number Diff line Loading @@ -408,9 +408,11 @@ LeAudioClientInterface::Sink::GetBroadcastConfig( auto aidl_pacs = GetAidlLeAudioDeviceCapabilitiesFromStackFormat(pacs); auto reqs = GetAidlLeAudioBroadcastConfigurationRequirementFromStackFormat(subgroup_quality); auto aidl_broadcast_config = aidl::le_audio::LeAudioSourceTransport::interface->getLeAudioBroadcastConfiguration( aidl_pacs, reqs); log::assert_that(aidl::le_audio::LeAudioSinkTransport::interface_broadcast_ != nullptr, "LeAudioSourceTransport::interface should not be null"); auto aidl_broadcast_config = aidl::le_audio::LeAudioSinkTransport::interface_broadcast_ ->getLeAudioBroadcastConfiguration(aidl_pacs, reqs); return GetStackBroadcastConfigurationFromAidlFormat(aidl_broadcast_config); } Loading system/audio_hal_interface/le_audio_software_unittest.cc +41 −4 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ #include "aidl/audio_ctrl_ack.h" #include "aidl/le_audio_software_aidl.h" #include "audio_hal_interface/hal_version_manager.h" #include "bta/le_audio/mock_codec_manager.h" #include "gmock/gmock.h" #include "hidl/le_audio_software_hidl.h" Loading Loading @@ -540,12 +541,11 @@ protected: sink_ = LeAudioClientInterface::Get()->GetSink(*unicast_sink_stream_cb_, &message_loop_thread, is_broadcast_); source_ = LeAudioClientInterface::Get()->GetSource(*unicast_source_stream_cb_, &message_loop_thread); if (is_broadcast_) { ASSERT_TRUE(LeAudioClientInterface::Get()->IsBroadcastSinkAcquired()); } else { source_ = LeAudioClientInterface::Get()->GetSource(*unicast_source_stream_cb_, &message_loop_thread); ASSERT_TRUE(LeAudioClientInterface::Get()->IsSourceAcquired()); ASSERT_TRUE(LeAudioClientInterface::Get()->IsUnicastSinkAcquired()); } Loading @@ -554,10 +554,10 @@ protected: virtual void TearDown() override { if (LeAudioClientInterface::Get()->IsUnicastSinkAcquired() || LeAudioClientInterface::Get()->IsBroadcastSinkAcquired()) { LeAudioClientInterface::Get()->ReleaseSink(sink_); if (is_broadcast_) { ASSERT_FALSE(LeAudioClientInterface::Get()->IsBroadcastSinkAcquired()); } else { LeAudioClientInterface::Get()->ReleaseSink(sink_); ASSERT_FALSE(LeAudioClientInterface::Get()->IsUnicastSinkAcquired()); } } Loading Loading @@ -591,7 +591,19 @@ protected: class LeAudioSoftwareUnicastTestAidl : public LeAudioSoftwareUnicastTest { protected: void SetUpMockCodecManager(bluetooth::le_audio::types::CodecLocation location) { codec_manager_ = bluetooth::le_audio::CodecManager::GetInstance(); ASSERT_NE(codec_manager_, nullptr); std::vector<bluetooth::le_audio::btle_audio_codec_config_t> mock_offloading_preference(0); codec_manager_->Start(mock_offloading_preference); mock_codec_manager_ = MockCodecManager::GetInstance(); ASSERT_NE((void*)mock_codec_manager_, (void*)codec_manager_); ASSERT_NE(mock_codec_manager_, nullptr); ON_CALL(*mock_codec_manager_, GetCodecLocation()).WillByDefault(Return(location)); } virtual void SetUp() override { SetUpMockCodecManager(::bluetooth::le_audio::types::CodecLocation::ADSP); ON_CALL(hal_version_manager_, GetHalTransport) .WillByDefault(Return(bluetooth::audio::BluetoothAudioHalTransport::AIDL)); Loading @@ -602,6 +614,8 @@ protected: } MockBluetoothAudioClientInterfaceAidl audio_client_interface_; bluetooth::le_audio::CodecManager* codec_manager_; MockCodecManager* mock_codec_manager_; }; TEST_F(LeAudioSoftwareUnicastTestAidl, AcquireAndRelease) { Loading @@ -628,4 +642,27 @@ TEST_F(LeAudioSoftwareUnicastTestHidl, AcquireAndRelease) { ASSERT_NE(nullptr, sink_); ASSERT_NE(nullptr, source_); } class LeAudioSoftwareBroadcastTestAidl : public LeAudioSoftwareUnicastTestAidl { protected: virtual void SetUp() override { is_broadcast_ = true; LeAudioSoftwareUnicastTestAidl::SetUp(); } }; TEST_F(LeAudioSoftwareBroadcastTestAidl, AcquireAndRelease) { ASSERT_NE(nullptr, sink_); ASSERT_EQ(nullptr, source_); ASSERT_NE(::bluetooth::audio::aidl::le_audio::LeAudioSinkTransport::interface_broadcast_, nullptr); ASSERT_EQ(::bluetooth::audio::aidl::le_audio::LeAudioSinkTransport::interface_unicast_, nullptr); ASSERT_EQ(::bluetooth::audio::aidl::le_audio::LeAudioSourceTransport::interface, nullptr); } TEST_F(LeAudioSoftwareBroadcastTestAidl, GetBroadcastConfig) { ASSERT_NE(nullptr, sink_); ASSERT_NE(sink_->GetBroadcastConfig({}, std::nullopt), std::nullopt); } } // namespace Loading
system/audio_hal_interface/le_audio_software.cc +5 −3 Original line number Diff line number Diff line Loading @@ -408,9 +408,11 @@ LeAudioClientInterface::Sink::GetBroadcastConfig( auto aidl_pacs = GetAidlLeAudioDeviceCapabilitiesFromStackFormat(pacs); auto reqs = GetAidlLeAudioBroadcastConfigurationRequirementFromStackFormat(subgroup_quality); auto aidl_broadcast_config = aidl::le_audio::LeAudioSourceTransport::interface->getLeAudioBroadcastConfiguration( aidl_pacs, reqs); log::assert_that(aidl::le_audio::LeAudioSinkTransport::interface_broadcast_ != nullptr, "LeAudioSourceTransport::interface should not be null"); auto aidl_broadcast_config = aidl::le_audio::LeAudioSinkTransport::interface_broadcast_ ->getLeAudioBroadcastConfiguration(aidl_pacs, reqs); return GetStackBroadcastConfigurationFromAidlFormat(aidl_broadcast_config); } Loading
system/audio_hal_interface/le_audio_software_unittest.cc +41 −4 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ #include "aidl/audio_ctrl_ack.h" #include "aidl/le_audio_software_aidl.h" #include "audio_hal_interface/hal_version_manager.h" #include "bta/le_audio/mock_codec_manager.h" #include "gmock/gmock.h" #include "hidl/le_audio_software_hidl.h" Loading Loading @@ -540,12 +541,11 @@ protected: sink_ = LeAudioClientInterface::Get()->GetSink(*unicast_sink_stream_cb_, &message_loop_thread, is_broadcast_); source_ = LeAudioClientInterface::Get()->GetSource(*unicast_source_stream_cb_, &message_loop_thread); if (is_broadcast_) { ASSERT_TRUE(LeAudioClientInterface::Get()->IsBroadcastSinkAcquired()); } else { source_ = LeAudioClientInterface::Get()->GetSource(*unicast_source_stream_cb_, &message_loop_thread); ASSERT_TRUE(LeAudioClientInterface::Get()->IsSourceAcquired()); ASSERT_TRUE(LeAudioClientInterface::Get()->IsUnicastSinkAcquired()); } Loading @@ -554,10 +554,10 @@ protected: virtual void TearDown() override { if (LeAudioClientInterface::Get()->IsUnicastSinkAcquired() || LeAudioClientInterface::Get()->IsBroadcastSinkAcquired()) { LeAudioClientInterface::Get()->ReleaseSink(sink_); if (is_broadcast_) { ASSERT_FALSE(LeAudioClientInterface::Get()->IsBroadcastSinkAcquired()); } else { LeAudioClientInterface::Get()->ReleaseSink(sink_); ASSERT_FALSE(LeAudioClientInterface::Get()->IsUnicastSinkAcquired()); } } Loading Loading @@ -591,7 +591,19 @@ protected: class LeAudioSoftwareUnicastTestAidl : public LeAudioSoftwareUnicastTest { protected: void SetUpMockCodecManager(bluetooth::le_audio::types::CodecLocation location) { codec_manager_ = bluetooth::le_audio::CodecManager::GetInstance(); ASSERT_NE(codec_manager_, nullptr); std::vector<bluetooth::le_audio::btle_audio_codec_config_t> mock_offloading_preference(0); codec_manager_->Start(mock_offloading_preference); mock_codec_manager_ = MockCodecManager::GetInstance(); ASSERT_NE((void*)mock_codec_manager_, (void*)codec_manager_); ASSERT_NE(mock_codec_manager_, nullptr); ON_CALL(*mock_codec_manager_, GetCodecLocation()).WillByDefault(Return(location)); } virtual void SetUp() override { SetUpMockCodecManager(::bluetooth::le_audio::types::CodecLocation::ADSP); ON_CALL(hal_version_manager_, GetHalTransport) .WillByDefault(Return(bluetooth::audio::BluetoothAudioHalTransport::AIDL)); Loading @@ -602,6 +614,8 @@ protected: } MockBluetoothAudioClientInterfaceAidl audio_client_interface_; bluetooth::le_audio::CodecManager* codec_manager_; MockCodecManager* mock_codec_manager_; }; TEST_F(LeAudioSoftwareUnicastTestAidl, AcquireAndRelease) { Loading @@ -628,4 +642,27 @@ TEST_F(LeAudioSoftwareUnicastTestHidl, AcquireAndRelease) { ASSERT_NE(nullptr, sink_); ASSERT_NE(nullptr, source_); } class LeAudioSoftwareBroadcastTestAidl : public LeAudioSoftwareUnicastTestAidl { protected: virtual void SetUp() override { is_broadcast_ = true; LeAudioSoftwareUnicastTestAidl::SetUp(); } }; TEST_F(LeAudioSoftwareBroadcastTestAidl, AcquireAndRelease) { ASSERT_NE(nullptr, sink_); ASSERT_EQ(nullptr, source_); ASSERT_NE(::bluetooth::audio::aidl::le_audio::LeAudioSinkTransport::interface_broadcast_, nullptr); ASSERT_EQ(::bluetooth::audio::aidl::le_audio::LeAudioSinkTransport::interface_unicast_, nullptr); ASSERT_EQ(::bluetooth::audio::aidl::le_audio::LeAudioSourceTransport::interface, nullptr); } TEST_F(LeAudioSoftwareBroadcastTestAidl, GetBroadcastConfig) { ASSERT_NE(nullptr, sink_); ASSERT_NE(sink_->GetBroadcastConfig({}, std::nullopt), std::nullopt); } } // namespace