diff --git a/test/pc/e2e/peer_connection_e2e_smoke_test.cc b/test/pc/e2e/peer_connection_e2e_smoke_test.cc index f32e9725d3..62e0d54c20 100644 --- a/test/pc/e2e/peer_connection_e2e_smoke_test.cc +++ b/test/pc/e2e/peer_connection_e2e_smoke_test.cc @@ -25,7 +25,13 @@ namespace webrtc { namespace webrtc_pc_e2e { -TEST(PeerConnectionE2EQualityTestSmokeTest, RunWithEmulatedNetwork) { +// IOS debug builds can be quite slow, disabling to avoid issues with timeouts. +#if defined(WEBRTC_IOS) && defined(WEBRTC_ARCH_ARM64) && !defined(NDEBUG) +#define MAYBE_RunWithEmulatedNetwork DISABLED_RunWithEmulatedNetwork +#else +#define MAYBE_RunWithEmulatedNetwork RunWithEmulatedNetwork +#endif +TEST(PeerConnectionE2EQualityTestSmokeTest, MAYBE_RunWithEmulatedNetwork) { using PeerConfigurer = PeerConnectionE2EQualityTestFixture::PeerConfigurer; using RunParams = PeerConnectionE2EQualityTestFixture::RunParams; using VideoConfig = PeerConnectionE2EQualityTestFixture::VideoConfig; diff --git a/test/scenario/network/network_emulation_manager.cc b/test/scenario/network/network_emulation_manager.cc index 8451c97487..8e1dc76924 100644 --- a/test/scenario/network/network_emulation_manager.cc +++ b/test/scenario/network/network_emulation_manager.cc @@ -23,7 +23,6 @@ namespace webrtc { namespace test { namespace { -constexpr int64_t kPacketProcessingIntervalMs = 1; // uint32_t representation of 192.168.0.0 address constexpr uint32_t kMinIPv4Address = 0xC0A80000; // uint32_t representation of 192.168.255.255 address @@ -64,10 +63,6 @@ NetworkEmulationManagerImpl::NetworkEmulationManagerImpl( task_queue_(time_controller->GetTaskQueueFactory()->CreateTaskQueue( "NetworkEmulation", TaskQueueFactory::Priority::NORMAL)) { - process_task_handle_ = RepeatingTaskHandle::Start(task_queue_.Get(), [this] { - ProcessNetworkPackets(); - return TimeDelta::ms(kPacketProcessingIntervalMs); - }); } // TODO(srte): Ensure that any pending task that must be run for consistency @@ -195,8 +190,14 @@ NetworkEmulationManagerImpl::CreateRandomWalkCrossTraffic( task_queue_.PostTask(CreateResourceOwningTask( std::move(traffic), - [this](std::unique_ptr traffic) { + [this, config](std::unique_ptr traffic) { + auto* traffic_ptr = traffic.get(); random_cross_traffics_.push_back(std::move(traffic)); + RepeatingTaskHandle::Start(task_queue_.Get(), + [this, config, traffic_ptr] { + traffic_ptr->Process(Now()); + return config.min_packet_interval; + }); })); return out; } @@ -210,8 +211,14 @@ NetworkEmulationManagerImpl::CreatePulsedPeaksCrossTraffic( PulsedPeaksCrossTraffic* out = traffic.get(); task_queue_.PostTask(CreateResourceOwningTask( std::move(traffic), - [this](std::unique_ptr traffic) { + [this, config](std::unique_ptr traffic) { + auto* traffic_ptr = traffic.get(); pulsed_cross_traffics_.push_back(std::move(traffic)); + RepeatingTaskHandle::Start(task_queue_.Get(), + [this, config, traffic_ptr] { + traffic_ptr->Process(Now()); + return config.min_packet_interval; + }); })); return out; } @@ -256,16 +263,6 @@ NetworkEmulationManagerImpl::GetNextIPv4Address() { return absl::nullopt; } -void NetworkEmulationManagerImpl::ProcessNetworkPackets() { - Timestamp current_time = Now(); - for (auto& traffic : random_cross_traffics_) { - traffic->Process(current_time); - } - for (auto& traffic : pulsed_cross_traffics_) { - traffic->Process(current_time); - } -} - Timestamp NetworkEmulationManagerImpl::Now() const { return Timestamp::us(clock_->TimeInMicroseconds()); } diff --git a/test/scenario/network/network_emulation_manager.h b/test/scenario/network/network_emulation_manager.h index c1645141dc..cb1ace7c2c 100644 --- a/test/scenario/network/network_emulation_manager.h +++ b/test/scenario/network/network_emulation_manager.h @@ -67,7 +67,6 @@ class NetworkEmulationManagerImpl : public NetworkEmulationManager { private: absl::optional GetNextIPv4Address(); - void ProcessNetworkPackets(); Timestamp Now() const; Clock* const clock_;