Adds UpdateConfig to SimulatedNetwork
Bug: webrtc:9510 Change-Id: Ied0e5ff291021ba4f539eee9820b8490a7004882 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170462 Reviewed-by: Ali Tofigh <alito@webrtc.org> Commit-Queue: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30803}
This commit is contained in:
committed by
Commit Bot
parent
06c7095bc7
commit
89eb0bba0c
@ -87,6 +87,8 @@ class SimulatedNetworkInterface : public NetworkBehaviorInterface {
|
||||
public:
|
||||
// Sets a new configuration. This won't affect packets already in the pipe.
|
||||
virtual void SetConfig(const BuiltInNetworkBehaviorConfig& config) = 0;
|
||||
virtual void UpdateConfig(
|
||||
std::function<void(BuiltInNetworkBehaviorConfig*)> config_modifier) = 0;
|
||||
virtual void PauseTransmissionUntil(int64_t until_us) = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -111,6 +111,12 @@ void SimulatedNetwork::SetConfig(const Config& config) {
|
||||
}
|
||||
}
|
||||
|
||||
void SimulatedNetwork::UpdateConfig(
|
||||
std::function<void(BuiltInNetworkBehaviorConfig*)> config_modifier) {
|
||||
rtc::CritScope crit(&config_lock_);
|
||||
config_modifier(&config_state_.config);
|
||||
}
|
||||
|
||||
void SimulatedNetwork::PauseTransmissionUntil(int64_t until_us) {
|
||||
rtc::CritScope crit(&config_lock_);
|
||||
config_state_.pause_transmission_until_us = until_us;
|
||||
|
||||
@ -62,6 +62,8 @@ class SimulatedNetwork : public SimulatedNetworkInterface {
|
||||
|
||||
// Sets a new configuration. This won't affect packets already in the pipe.
|
||||
void SetConfig(const Config& config) override;
|
||||
void UpdateConfig(std::function<void(BuiltInNetworkBehaviorConfig*)>
|
||||
config_modifier) override;
|
||||
void PauseTransmissionUntil(int64_t until_us) override;
|
||||
|
||||
// NetworkBehaviorInterface
|
||||
|
||||
Reference in New Issue
Block a user