Add ability to create EmulatedNetworkNode from BuiltInNetworkBehaviorConfig
There is no public API to create NetworkBehaviorInterface from BuiltInNetworkBehaviorConfig, so this CL will add direct method, that will allow downstream projects to use BuiltInNetworkBehaviorConfig for network emulation. Bug: webrtc:10138 Change-Id: Iaec3ea17c12bd06b1c0ff3e5bc2b32cc1c4f62f8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144628 Reviewed-by: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28494}
This commit is contained in:
parent
c8263e0638
commit
48b1b18065
@ -110,6 +110,8 @@ class NetworkEmulationManager {
|
||||
|
||||
// Creates an emulated network node, which represents single network in
|
||||
// the emulated network layer.
|
||||
virtual EmulatedNetworkNode* CreateEmulatedNode(
|
||||
BuiltInNetworkBehaviorConfig config) = 0;
|
||||
virtual EmulatedNetworkNode* CreateEmulatedNode(
|
||||
std::unique_ptr<NetworkBehaviorInterface> network_behavior) = 0;
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ rtc_source_set("emulated_network") {
|
||||
"../../api/units:data_size",
|
||||
"../../api/units:time_delta",
|
||||
"../../api/units:timestamp",
|
||||
"../../call:simulated_network",
|
||||
"../../rtc_base",
|
||||
"../../rtc_base:rtc_base_tests_utils",
|
||||
"../../rtc_base:rtc_task_queue",
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include "absl/memory/memory.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "api/units/timestamp.h"
|
||||
#include "call/simulated_network.h"
|
||||
#include "rtc_base/fake_network.h"
|
||||
#include "test/time_controller/real_time_controller.h"
|
||||
|
||||
@ -69,6 +70,11 @@ NetworkEmulationManagerImpl::NetworkEmulationManagerImpl(
|
||||
// destroyed.
|
||||
NetworkEmulationManagerImpl::~NetworkEmulationManagerImpl() = default;
|
||||
|
||||
EmulatedNetworkNode* NetworkEmulationManagerImpl::CreateEmulatedNode(
|
||||
BuiltInNetworkBehaviorConfig config) {
|
||||
return CreateEmulatedNode(absl::make_unique<SimulatedNetwork>(config));
|
||||
}
|
||||
|
||||
EmulatedNetworkNode* NetworkEmulationManagerImpl::CreateEmulatedNode(
|
||||
std::unique_ptr<NetworkBehaviorInterface> network_behavior) {
|
||||
auto node = absl::make_unique<EmulatedNetworkNode>(
|
||||
|
||||
@ -43,6 +43,8 @@ class NetworkEmulationManagerImpl : public NetworkEmulationManager {
|
||||
explicit NetworkEmulationManagerImpl(TimeController* time_controller);
|
||||
~NetworkEmulationManagerImpl();
|
||||
|
||||
EmulatedNetworkNode* CreateEmulatedNode(
|
||||
BuiltInNetworkBehaviorConfig config) override;
|
||||
EmulatedNetworkNode* CreateEmulatedNode(
|
||||
std::unique_ptr<NetworkBehaviorInterface> network_behavior) override;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user