Loading system/bta/le_audio/client.cc +2 −2 Original line number Diff line number Diff line Loading @@ -522,9 +522,9 @@ class LeAudioClientImpl : public LeAudioClient { bool group_conf_changed = group->ReloadAudioLocations(); group_conf_changed |= group->ReloadAudioDirections(); group_conf_changed |= group->UpdateAudioContextAvailability(); if (group_conf_changed) { /* All the configurations should be recalculated for the new conditions */ group->InvalidateCachedConfigurations(); if (group_conf_changed) { callbacks_->OnAudioConf(group->audio_directions_, group->group_id_, group->snk_audio_locations_.to_ulong(), group->src_audio_locations_.to_ulong(), Loading system/bta/le_audio/le_audio_client_test.cc +40 −0 Original line number Diff line number Diff line Loading @@ -4909,10 +4909,24 @@ TEST_F(UnicastTest, TwoEarbudsStreaming) { // Verify Data transfer still works TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920, 40); auto group = streaming_groups.at(group_id); // Stop StopStreaming(group_id, true); Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); // Check if cache configuration is still present ASSERT_TRUE(group ->GetCachedCodecConfigurationByDirection( types::LeAudioContextType::CONVERSATIONAL, le_audio::types::kLeAudioDirectionSink) .has_value()); ASSERT_TRUE(group ->GetCachedCodecConfigurationByDirection( types::LeAudioContextType::CONVERSATIONAL, le_audio::types::kLeAudioDirectionSource) .has_value()); // Release EXPECT_CALL(*mock_le_audio_source_hal_client_, Stop()).Times(1); EXPECT_CALL(*mock_le_audio_source_hal_client_, OnDestroyed()).Times(1); Loading @@ -4922,6 +4936,18 @@ TEST_F(UnicastTest, TwoEarbudsStreaming) { SyncOnMainLoop(); Mock::VerifyAndClearExpectations(&mock_le_audio_source_hal_client_); // Setting group inactive, shall not change cached configuration ASSERT_TRUE(group ->GetCachedCodecConfigurationByDirection( types::LeAudioContextType::CONVERSATIONAL, le_audio::types::kLeAudioDirectionSink) .has_value()); ASSERT_TRUE(group ->GetCachedCodecConfigurationByDirection( types::LeAudioContextType::CONVERSATIONAL, le_audio::types::kLeAudioDirectionSource) .has_value()); } TEST_F(UnicastTest, UpdateActiveAudioConfigForLocalSinkSource) { Loading Loading @@ -5913,6 +5939,8 @@ TEST_F(UnicastTest, StartStreamToSupportedContextTypeThenMixUnavailable) { Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); Mock::VerifyAndClearExpectations(&mock_le_audio_source_hal_client_); auto group = streaming_groups.at(group_id); // Expect two iso channel to be fed with data uint8_t cis_count_out = 2; uint8_t cis_count_in = 0; Loading Loading @@ -5962,6 +5990,12 @@ TEST_F(UnicastTest, StartStreamToSupportedContextTypeThenMixUnavailable) { SyncOnMainLoop(); // Verify cache has been removed due to available context change ASSERT_FALSE(group ->GetCachedCodecConfigurationByDirection( types::LeAudioContextType::MEDIA, le_audio::types::kLeAudioDirectionSink) .has_value()); /* Start Media again */ contexts.sink = types::AudioContexts(types::LeAudioContextType::MEDIA); EXPECT_CALL( Loading @@ -5973,6 +6007,12 @@ TEST_F(UnicastTest, StartStreamToSupportedContextTypeThenMixUnavailable) { SyncOnMainLoop(); ASSERT_TRUE(group ->GetCachedCodecConfigurationByDirection( types::LeAudioContextType::MEDIA, le_audio::types::kLeAudioDirectionSink) .has_value()); Mock::VerifyAndClearExpectations(&mock_state_machine_); Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); Mock::VerifyAndClearExpectations(&mock_le_audio_source_hal_client_); Loading Loading
system/bta/le_audio/client.cc +2 −2 Original line number Diff line number Diff line Loading @@ -522,9 +522,9 @@ class LeAudioClientImpl : public LeAudioClient { bool group_conf_changed = group->ReloadAudioLocations(); group_conf_changed |= group->ReloadAudioDirections(); group_conf_changed |= group->UpdateAudioContextAvailability(); if (group_conf_changed) { /* All the configurations should be recalculated for the new conditions */ group->InvalidateCachedConfigurations(); if (group_conf_changed) { callbacks_->OnAudioConf(group->audio_directions_, group->group_id_, group->snk_audio_locations_.to_ulong(), group->src_audio_locations_.to_ulong(), Loading
system/bta/le_audio/le_audio_client_test.cc +40 −0 Original line number Diff line number Diff line Loading @@ -4909,10 +4909,24 @@ TEST_F(UnicastTest, TwoEarbudsStreaming) { // Verify Data transfer still works TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920, 40); auto group = streaming_groups.at(group_id); // Stop StopStreaming(group_id, true); Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); // Check if cache configuration is still present ASSERT_TRUE(group ->GetCachedCodecConfigurationByDirection( types::LeAudioContextType::CONVERSATIONAL, le_audio::types::kLeAudioDirectionSink) .has_value()); ASSERT_TRUE(group ->GetCachedCodecConfigurationByDirection( types::LeAudioContextType::CONVERSATIONAL, le_audio::types::kLeAudioDirectionSource) .has_value()); // Release EXPECT_CALL(*mock_le_audio_source_hal_client_, Stop()).Times(1); EXPECT_CALL(*mock_le_audio_source_hal_client_, OnDestroyed()).Times(1); Loading @@ -4922,6 +4936,18 @@ TEST_F(UnicastTest, TwoEarbudsStreaming) { SyncOnMainLoop(); Mock::VerifyAndClearExpectations(&mock_le_audio_source_hal_client_); // Setting group inactive, shall not change cached configuration ASSERT_TRUE(group ->GetCachedCodecConfigurationByDirection( types::LeAudioContextType::CONVERSATIONAL, le_audio::types::kLeAudioDirectionSink) .has_value()); ASSERT_TRUE(group ->GetCachedCodecConfigurationByDirection( types::LeAudioContextType::CONVERSATIONAL, le_audio::types::kLeAudioDirectionSource) .has_value()); } TEST_F(UnicastTest, UpdateActiveAudioConfigForLocalSinkSource) { Loading Loading @@ -5913,6 +5939,8 @@ TEST_F(UnicastTest, StartStreamToSupportedContextTypeThenMixUnavailable) { Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); Mock::VerifyAndClearExpectations(&mock_le_audio_source_hal_client_); auto group = streaming_groups.at(group_id); // Expect two iso channel to be fed with data uint8_t cis_count_out = 2; uint8_t cis_count_in = 0; Loading Loading @@ -5962,6 +5990,12 @@ TEST_F(UnicastTest, StartStreamToSupportedContextTypeThenMixUnavailable) { SyncOnMainLoop(); // Verify cache has been removed due to available context change ASSERT_FALSE(group ->GetCachedCodecConfigurationByDirection( types::LeAudioContextType::MEDIA, le_audio::types::kLeAudioDirectionSink) .has_value()); /* Start Media again */ contexts.sink = types::AudioContexts(types::LeAudioContextType::MEDIA); EXPECT_CALL( Loading @@ -5973,6 +6007,12 @@ TEST_F(UnicastTest, StartStreamToSupportedContextTypeThenMixUnavailable) { SyncOnMainLoop(); ASSERT_TRUE(group ->GetCachedCodecConfigurationByDirection( types::LeAudioContextType::MEDIA, le_audio::types::kLeAudioDirectionSink) .has_value()); Mock::VerifyAndClearExpectations(&mock_state_machine_); Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); Mock::VerifyAndClearExpectations(&mock_le_audio_source_hal_client_); Loading