Adds functionality to add delay spikes in SimulatedNetwork.
Bug: webrtc:9467 Change-Id: Ifddafa65a9e18a3131fc0415764599740fab2db4 Reviewed-on: https://webrtc-review.googlesource.com/92089 Commit-Queue: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Reviewed-by: Björn Terelius <terelius@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24213}
This commit is contained in:
parent
5ca90f55ae
commit
9129565879
@ -194,6 +194,11 @@ void SimulatedNetwork::SetConfig(const SimulatedNetwork::Config& config) {
|
||||
}
|
||||
}
|
||||
|
||||
void SimulatedNetwork::PauseTransmissionUntil(int64_t until_us) {
|
||||
rtc::CritScope crit(&config_lock_);
|
||||
pause_transmission_until_us_ = until_us;
|
||||
}
|
||||
|
||||
bool SimulatedNetwork::EnqueuePacket(PacketInFlightInfo packet) {
|
||||
Config config;
|
||||
{
|
||||
@ -222,6 +227,14 @@ bool SimulatedNetwork::EnqueuePacket(PacketInFlightInfo packet) {
|
||||
}
|
||||
int64_t network_start_time_us = packet.send_time_us;
|
||||
|
||||
{
|
||||
rtc::CritScope crit(&config_lock_);
|
||||
if (pause_transmission_until_us_) {
|
||||
network_start_time_us =
|
||||
std::max(network_start_time_us, *pause_transmission_until_us_);
|
||||
pause_transmission_until_us_.reset();
|
||||
}
|
||||
}
|
||||
// Check if there already are packets on the link and change network start
|
||||
// time forward if there is.
|
||||
if (!capacity_link_.empty() &&
|
||||
|
||||
@ -109,6 +109,7 @@ class SimulatedNetwork : public NetworkSimulationInterface {
|
||||
|
||||
// Sets a new configuration. This won't affect packets already in the pipe.
|
||||
void SetConfig(const Config& config);
|
||||
void PauseTransmissionUntil(int64_t until_us);
|
||||
|
||||
// NetworkSimulationInterface
|
||||
bool EnqueuePacket(PacketInFlightInfo packet) override;
|
||||
@ -134,6 +135,8 @@ class SimulatedNetwork : public NetworkSimulationInterface {
|
||||
|
||||
// Link configuration.
|
||||
Config config_ RTC_GUARDED_BY(config_lock_);
|
||||
absl::optional<int64_t> pause_transmission_until_us_
|
||||
RTC_GUARDED_BY(config_lock_);
|
||||
|
||||
// Are we currently dropping a burst of packets?
|
||||
bool bursting_;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user