@@ -723,7 +723,116 @@ TEST_F(IntegrationTest, neighbours)
723
723
});
724
724
}
725
725
726
- TEST_F (IntegrationTest, dynamicNeighbours)
726
+ TEST_F (IntegrationTest, dynamicNeighbours_removeNeighbours)
727
+ {
728
+ runTestInThread (expectedTestThreadCount (1 ), [this ]() {
729
+ _config.readFromString (_defaultSmbConfig);
730
+
731
+ initBridge (_config);
732
+ const auto baseUrl = " http://127.0.0.1:8080" ;
733
+
734
+ GroupCall<SfuClient<Channel>> group (_httpd,
735
+ _instanceCounter,
736
+ *_mainPoolAllocator,
737
+ _audioAllocator,
738
+ *_clientTransportFactory,
739
+ *_publicTransportFactory,
740
+ *_sslDtls,
741
+ 4 );
742
+
743
+ Conference conf (_httpd);
744
+
745
+ ScopedFinalize finalize (std::bind (&IntegrationTest::finalizeSimulation, this ));
746
+ startSimulation ();
747
+
748
+ group.startConference (conf, baseUrl);
749
+
750
+ std::string neighbours[] = {" gid1" };
751
+
752
+ CallConfigBuilder cfgBuilder (conf.getId ());
753
+ cfgBuilder.url (baseUrl).withOpus ().withVideo ();
754
+
755
+ CallConfigBuilder cfgNeighbours (cfgBuilder);
756
+ cfgNeighbours.neighbours (utils::Span<std::string>(neighbours));
757
+
758
+ group.clients [0 ]->initiateCall (cfgBuilder.build ());
759
+ group.clients [1 ]->joinCall (cfgNeighbours.build ());
760
+ group.clients [2 ]->joinCall (cfgNeighbours.build ());
761
+ group.clients [3 ]->joinCall (cfgNeighbours.mixed ().build ());
762
+
763
+ // 600, 1300, 2100, 3200
764
+ ASSERT_TRUE (group.connectAll (utils::Time::sec * _clientsConnectionTimeout));
765
+
766
+ nlohmann::json responseBody;
767
+ const auto conferenceId = conf.getId ();
768
+
769
+ for (int i = 1 ; i < 4 ; i++)
770
+ {
771
+ auto endpointId = group.clients [i]->getEndpointId ();
772
+
773
+ nlohmann::json body = {{" action" , " reconfigure" }};
774
+ body[" neighbours" ] = {{" groups" , nlohmann::json::array ()}};
775
+
776
+ auto neighboursSet = emulator::awaitResponse<HttpPutRequest>(_httpd,
777
+ std::string (baseUrl) + " /conferences/" + conferenceId + " /" + endpointId,
778
+ body.dump (),
779
+ 1.5 * utils::Time::sec,
780
+ responseBody);
781
+ EXPECT_TRUE (neighboursSet);
782
+ }
783
+
784
+ make5secCallWithDefaultAudioProfile (group);
785
+
786
+ auto statsSuccess = emulator::awaitResponse<HttpGetRequest>(_httpd,
787
+ std::string (baseUrl) + " /stats" ,
788
+ 1500 * utils::Time::ms,
789
+ responseBody);
790
+ EXPECT_TRUE (statsSuccess);
791
+
792
+ auto confRequest = emulator::awaitResponse<HttpGetRequest>(_httpd,
793
+ std::string (baseUrl) + " /conferences" ,
794
+ 1500 * utils::Time::ms,
795
+ responseBody);
796
+ EXPECT_TRUE (confRequest);
797
+
798
+ group.stopTransports ();
799
+
800
+ group.awaitPendingJobs (utils::Time::sec * 4 );
801
+ finalizeSimulation ();
802
+
803
+ const size_t chMixed[] = {0 , 0 , 0 , 3 };
804
+ AudioAnalysisData results[4 ];
805
+ for (size_t id = 0 ; id < 4 ; ++id)
806
+ {
807
+ results[id] = analyzeRecording<SfuClient<Channel>>(group.clients [id].get (), 5 , true , chMixed[id]);
808
+
809
+ std::unordered_map<uint32_t , transport::ReportSummary> transportSummary;
810
+ std::string clientName = " client_" + std::to_string (id);
811
+ group.clients [id]->getReportSummary (transportSummary);
812
+ logTransportSummary (clientName.c_str (), transportSummary);
813
+
814
+ logVideoSent (clientName.c_str (), *group.clients [id]);
815
+ logVideoReceive (clientName.c_str (), *group.clients [id]);
816
+ }
817
+
818
+ EXPECT_EQ (results[0 ].audioSsrcCount , 3u );
819
+ EXPECT_EQ (results[1 ].audioSsrcCount , 3u );
820
+ EXPECT_EQ (results[2 ].audioSsrcCount , 3u );
821
+ EXPECT_EQ (results[3 ].audioSsrcCount , 1u );
822
+
823
+ EXPECT_EQ (results[0 ].dominantFrequencies .size (), 3 );
824
+ EXPECT_EQ (results[1 ].dominantFrequencies .size (), 3 );
825
+ EXPECT_EQ (results[2 ].dominantFrequencies .size (), 3 );
826
+ EXPECT_EQ (results[3 ].dominantFrequencies .size (), 3 );
827
+
828
+ if (results[3 ].dominantFrequencies .size () > 0 )
829
+ {
830
+ EXPECT_NEAR (results[3 ].dominantFrequencies [0 ], 600.0 , 50.0 );
831
+ }
832
+ });
833
+ }
834
+
835
+ TEST_F (IntegrationTest, dynamicNeighbours_addNeighbours)
727
836
{
728
837
runTestInThread (expectedTestThreadCount (1 ), [this ]() {
729
838
_config.readFromString (_defaultSmbConfig);
0 commit comments