2017-06-15 12:52:32 -07:00
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2023-12-05 11:07:54 +01:00
|
|
|
#include "call/create_call.h"
|
2017-06-15 12:52:32 -07:00
|
|
|
|
2018-11-28 16:47:49 +01:00
|
|
|
#include <stdio.h>
|
2019-07-05 19:08:33 +02:00
|
|
|
|
2017-06-15 12:52:32 -07:00
|
|
|
#include <memory>
|
2018-03-14 15:16:50 +01:00
|
|
|
#include <string>
|
2021-05-31 14:02:28 +02:00
|
|
|
#include <utility>
|
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
|
|
|
#include <vector>
|
2017-06-15 12:52:32 -07:00
|
|
|
|
2018-06-15 12:28:07 +02:00
|
|
|
#include "absl/types/optional.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "api/test/simulated_network.h"
|
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
|
|
|
#include "api/units/time_delta.h"
|
2018-02-14 12:20:13 +01:00
|
|
|
#include "call/call.h"
|
2018-03-14 15:16:50 +01:00
|
|
|
#include "call/degraded_call.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "rtc_base/checks.h"
|
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
|
|
|
#include "rtc_base/experiments/field_trial_list.h"
|
|
|
|
|
#include "rtc_base/experiments/field_trial_parser.h"
|
2018-02-14 12:20:13 +01:00
|
|
|
|
2017-06-15 12:52:32 -07:00
|
|
|
namespace webrtc {
|
2018-03-14 15:16:50 +01:00
|
|
|
namespace {
|
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
|
|
|
using TimeScopedNetworkConfig = DegradedCall::TimeScopedNetworkConfig;
|
|
|
|
|
|
|
|
|
|
std::vector<TimeScopedNetworkConfig> GetNetworkConfigs(
|
2022-03-29 11:04:48 +02:00
|
|
|
const FieldTrialsView& trials,
|
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
|
|
|
bool send) {
|
|
|
|
|
FieldTrialStructList<TimeScopedNetworkConfig> trials_list(
|
|
|
|
|
{FieldTrialStructMember("queue_length_packets",
|
|
|
|
|
[](TimeScopedNetworkConfig* p) {
|
|
|
|
|
// FieldTrialParser does not natively support
|
|
|
|
|
// size_t type, so use this ugly cast as
|
|
|
|
|
// workaround.
|
|
|
|
|
return reinterpret_cast<unsigned*>(
|
|
|
|
|
&p->queue_length_packets);
|
|
|
|
|
}),
|
|
|
|
|
FieldTrialStructMember(
|
|
|
|
|
"queue_delay_ms",
|
|
|
|
|
[](TimeScopedNetworkConfig* p) { return &p->queue_delay_ms; }),
|
|
|
|
|
FieldTrialStructMember("delay_standard_deviation_ms",
|
|
|
|
|
[](TimeScopedNetworkConfig* p) {
|
|
|
|
|
return &p->delay_standard_deviation_ms;
|
|
|
|
|
}),
|
|
|
|
|
FieldTrialStructMember(
|
|
|
|
|
"link_capacity_kbps",
|
|
|
|
|
[](TimeScopedNetworkConfig* p) { return &p->link_capacity_kbps; }),
|
|
|
|
|
FieldTrialStructMember(
|
|
|
|
|
"loss_percent",
|
|
|
|
|
[](TimeScopedNetworkConfig* p) { return &p->loss_percent; }),
|
|
|
|
|
FieldTrialStructMember(
|
|
|
|
|
"allow_reordering",
|
|
|
|
|
[](TimeScopedNetworkConfig* p) { return &p->allow_reordering; }),
|
|
|
|
|
FieldTrialStructMember("avg_burst_loss_length",
|
|
|
|
|
[](TimeScopedNetworkConfig* p) {
|
|
|
|
|
return &p->avg_burst_loss_length;
|
|
|
|
|
}),
|
|
|
|
|
FieldTrialStructMember(
|
|
|
|
|
"packet_overhead",
|
|
|
|
|
[](TimeScopedNetworkConfig* p) { return &p->packet_overhead; }),
|
|
|
|
|
FieldTrialStructMember(
|
|
|
|
|
"duration",
|
|
|
|
|
[](TimeScopedNetworkConfig* p) { return &p->duration; })},
|
|
|
|
|
{});
|
|
|
|
|
ParseFieldTrial({&trials_list},
|
|
|
|
|
trials.Lookup(send ? "WebRTC-FakeNetworkSendConfig"
|
|
|
|
|
: "WebRTC-FakeNetworkReceiveConfig"));
|
2022-07-26 14:49:31 +02:00
|
|
|
return trials_list.Get();
|
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
|
|
|
}
|
|
|
|
|
|
2018-03-14 15:16:50 +01:00
|
|
|
} // namespace
|
2017-06-15 12:52:32 -07:00
|
|
|
|
2023-12-05 11:07:54 +01:00
|
|
|
std::unique_ptr<Call> CreateCall(const 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 =
|
2023-12-04 18:53:09 +01:00
|
|
|
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 =
|
2023-12-04 18:53:09 +01:00
|
|
|
GetNetworkConfigs(config.env.field_trials(), /*send=*/false);
|
2018-03-14 15:16:50 +01:00
|
|
|
|
2023-12-05 17:11:15 +01:00
|
|
|
std::unique_ptr<Call> call = Call::Create(config);
|
2022-06-20 19:59:11 +02:00
|
|
|
|
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()) {
|
2023-10-13 13:53:00 +02:00
|
|
|
return std::make_unique<DegradedCall>(
|
|
|
|
|
std::move(call), send_degradation_configs, receive_degradation_configs);
|
2020-05-25 17:44:55 +02:00
|
|
|
}
|
|
|
|
|
|
2022-06-20 19:59:11 +02:00
|
|
|
return call;
|
2017-06-15 12:52:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|