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
|
|
|
|
|
|
|
|
#include <memory>
|
2024-08-29 13:00:40 +00:00
|
|
|
#include <optional>
|
2017-06-15 12:52:32 -07:00
|
|
|
|
2024-08-29 13:00:40 +00:00
|
|
|
#include "api/test/simulated_network.h"
|
|
|
|
|
#include "api/units/time_delta.h"
|
2018-02-14 12:20:13 +01:00
|
|
|
#include "call/call.h"
|
|
|
|
|
|
2017-06-15 12:52:32 -07:00
|
|
|
namespace webrtc {
|
|
|
|
|
|
2024-07-29 07:54:20 +02:00
|
|
|
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 =
|
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
|
|
|
|
2024-07-29 07:54:20 +02:00
|
|
|
std::unique_ptr<Call> call = Call::Create(std::move(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
|