webrtc_m130/call/create_call.cc

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.3 KiB
C++
Raw Normal View History

/*
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "call/create_call.h"
#include <memory>
#include <optional>
#include "api/test/simulated_network.h"
#include "api/units/time_delta.h"
#include "call/call.h"
namespace webrtc {
std::unique_ptr<Call> CreateCall(CallConfig config) {
Add support for time-varying constraints in DegradedCall. The fake network configs are now specified using just two field trials: WebRTC-FakeNetworkSendConfig and WebRTC-FakeNetworkReceiveConfig. Both of them have the following parameters from BuiltInNetworkBehaviorConfig: * queue_length_packets // Queue length in number of packets. * queue_delay_ms // Delay in addition to capacity induced delay. * delay_standard_deviation_ms // Standard deviation of the extra delay. * link_capacity_kbps // Link capacity in kbps. * loss_percent // Random packet loss. * allow_reordering // If packets are allowed to be reordered. * avg_burst_loss_length // The average length of a burst of lost packets. * packet_overhead // Additional bytes to add to packet size. * codel_active_queue_management // Enable CoDel active queue management. Plus: * duration // For how long to use this config before progressing. Example: WebRTC-FakeNetworkSendConfig/queue_delay_ms:66|1,loss_percent:1|0,link_capacity_kbps:200|10000,queue_length_packets:10|100,duration:15s|45s/ This creates two configs: 1. For 15s, apply 66ms delay, 1% loss, 200kbps bandwidth, 10 packet queue size 2. For 45s, apply 1ms delay, 0% loss, 10Mbps bandwidth, 100 packets queue size (then repeat) Bug: webrtc:13655 Change-Id: I0524f572de480731df4d414724203772182c628b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251043 Reviewed-by: Stefan Holmer <holmer@google.com> Commit-Queue: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35952}
2022-02-08 12:35:46 +01:00
std::vector<DegradedCall::TimeScopedNetworkConfig> send_degradation_configs =
GetNetworkConfigs(config.env.field_trials(), /*send=*/true);
Add support for time-varying constraints in DegradedCall. The fake network configs are now specified using just two field trials: WebRTC-FakeNetworkSendConfig and WebRTC-FakeNetworkReceiveConfig. Both of them have the following parameters from BuiltInNetworkBehaviorConfig: * queue_length_packets // Queue length in number of packets. * queue_delay_ms // Delay in addition to capacity induced delay. * delay_standard_deviation_ms // Standard deviation of the extra delay. * link_capacity_kbps // Link capacity in kbps. * loss_percent // Random packet loss. * allow_reordering // If packets are allowed to be reordered. * avg_burst_loss_length // The average length of a burst of lost packets. * packet_overhead // Additional bytes to add to packet size. * codel_active_queue_management // Enable CoDel active queue management. Plus: * duration // For how long to use this config before progressing. Example: WebRTC-FakeNetworkSendConfig/queue_delay_ms:66|1,loss_percent:1|0,link_capacity_kbps:200|10000,queue_length_packets:10|100,duration:15s|45s/ This creates two configs: 1. For 15s, apply 66ms delay, 1% loss, 200kbps bandwidth, 10 packet queue size 2. For 45s, apply 1ms delay, 0% loss, 10Mbps bandwidth, 100 packets queue size (then repeat) Bug: webrtc:13655 Change-Id: I0524f572de480731df4d414724203772182c628b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251043 Reviewed-by: Stefan Holmer <holmer@google.com> Commit-Queue: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35952}
2022-02-08 12:35:46 +01:00
std::vector<DegradedCall::TimeScopedNetworkConfig>
receive_degradation_configs =
GetNetworkConfigs(config.env.field_trials(), /*send=*/false);
std::unique_ptr<Call> call = Call::Create(std::move(config));
Add support for time-varying constraints in DegradedCall. The fake network configs are now specified using just two field trials: WebRTC-FakeNetworkSendConfig and WebRTC-FakeNetworkReceiveConfig. Both of them have the following parameters from BuiltInNetworkBehaviorConfig: * queue_length_packets // Queue length in number of packets. * queue_delay_ms // Delay in addition to capacity induced delay. * delay_standard_deviation_ms // Standard deviation of the extra delay. * link_capacity_kbps // Link capacity in kbps. * loss_percent // Random packet loss. * allow_reordering // If packets are allowed to be reordered. * avg_burst_loss_length // The average length of a burst of lost packets. * packet_overhead // Additional bytes to add to packet size. * codel_active_queue_management // Enable CoDel active queue management. Plus: * duration // For how long to use this config before progressing. Example: WebRTC-FakeNetworkSendConfig/queue_delay_ms:66|1,loss_percent:1|0,link_capacity_kbps:200|10000,queue_length_packets:10|100,duration:15s|45s/ This creates two configs: 1. For 15s, apply 66ms delay, 1% loss, 200kbps bandwidth, 10 packet queue size 2. For 45s, apply 1ms delay, 0% loss, 10Mbps bandwidth, 100 packets queue size (then repeat) Bug: webrtc:13655 Change-Id: I0524f572de480731df4d414724203772182c628b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251043 Reviewed-by: Stefan Holmer <holmer@google.com> Commit-Queue: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35952}
2022-02-08 12:35:46 +01:00
if (!send_degradation_configs.empty() ||
!receive_degradation_configs.empty()) {
return std::make_unique<DegradedCall>(
std::move(call), send_degradation_configs, receive_degradation_configs);
}
return call;
}
} // namespace webrtc