diff --git a/call/fake_network_pipe.cc b/call/fake_network_pipe.cc index e2fa2f4e99..dd8d5d7552 100644 --- a/call/fake_network_pipe.cc +++ b/call/fake_network_pipe.cc @@ -43,6 +43,7 @@ NetworkPacket::NetworkPacket(rtc::CopyOnWriteBuffer packet, is_rtcp_(is_rtcp), media_type_(media_type), packet_time_us_(packet_time_us) {} + NetworkPacket::NetworkPacket(rtc::CopyOnWriteBuffer packet, int64_t send_time, int64_t arrival_time, @@ -87,6 +88,20 @@ FakeNetworkPipe::FakeNetworkPipe(Clock* clock, const FakeNetworkPipe::Config& config) : FakeNetworkPipe(clock, config, nullptr, 1) {} +FakeNetworkPipe::FakeNetworkPipe( + Clock* clock, + std::unique_ptr network_simulation) + : clock_(clock), + network_simulation_(std::move(network_simulation)), + receiver_(nullptr), + transport_(nullptr), + clock_offset_ms_(0), + dropped_packets_(0), + sent_packets_(0), + total_packet_delay_us_(0), + next_process_time_us_(clock_->TimeInMicroseconds()), + last_log_time_us_(clock_->TimeInMicroseconds()) {} + FakeNetworkPipe::FakeNetworkPipe(Clock* clock, const FakeNetworkPipe::Config& config, PacketReceiver* receiver) diff --git a/call/fake_network_pipe.h b/call/fake_network_pipe.h index 531329ee72..6a2ff3548d 100644 --- a/call/fake_network_pipe.h +++ b/call/fake_network_pipe.h @@ -105,6 +105,10 @@ class FakeNetworkPipe : public Transport, public PacketReceiver, public Module { // Use these constructors if you plan to insert packets using DeliverPacket(). FakeNetworkPipe(Clock* clock, const FakeNetworkPipe::Config& config); + // Will keep |network_simulation| alive while pipe is alive itself. + FakeNetworkPipe( + Clock* clock, + std::unique_ptr network_simulation); FakeNetworkPipe(Clock* clock, const FakeNetworkPipe::Config& config, PacketReceiver* receiver);