2018-09-27 13:47:01 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright 2018 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.
|
|
|
|
|
*/
|
|
|
|
|
#ifndef TEST_SCENARIO_SCENARIO_CONFIG_H_
|
|
|
|
|
#define TEST_SCENARIO_SCENARIO_CONFIG_H_
|
|
|
|
|
|
2018-11-28 16:47:49 +01:00
|
|
|
#include <stddef.h>
|
2019-07-05 19:08:33 +02:00
|
|
|
|
2018-09-27 13:47:01 +02:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
#include "absl/types/optional.h"
|
2019-04-01 13:34:55 +02:00
|
|
|
#include "api/fec_controller.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "api/rtp_parameters.h"
|
2019-12-05 15:59:00 +01:00
|
|
|
#include "api/test/frame_generator_interface.h"
|
2018-12-18 15:53:04 +01:00
|
|
|
#include "api/transport/network_control.h"
|
2018-09-27 13:47:01 +02:00
|
|
|
#include "api/units/data_rate.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "api/units/data_size.h"
|
2018-09-27 13:47:01 +02:00
|
|
|
#include "api/units/time_delta.h"
|
2019-03-22 14:25:57 +01:00
|
|
|
#include "api/video/video_codec_type.h"
|
2019-04-09 14:18:09 +02:00
|
|
|
#include "test/scenario/performance_stats.h"
|
2018-09-27 13:47:01 +02:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
namespace test {
|
|
|
|
|
struct PacketOverhead {
|
|
|
|
|
static constexpr size_t kSrtp = 10;
|
2018-10-22 11:49:03 +02:00
|
|
|
static constexpr size_t kStun = 4;
|
|
|
|
|
// TURN messages can be sent either with or without an establieshed channel.
|
|
|
|
|
// In the latter case, a TURN Send/Data Indication is sent which has
|
|
|
|
|
// significantly more overhead.
|
|
|
|
|
static constexpr size_t kTurnChannelMessage = 4;
|
|
|
|
|
static constexpr size_t kTurnIndicationMessage = 36;
|
2020-01-17 11:47:35 +01:00
|
|
|
static constexpr size_t kDefault = kSrtp;
|
2018-09-27 13:47:01 +02:00
|
|
|
};
|
|
|
|
|
struct TransportControllerConfig {
|
|
|
|
|
struct Rates {
|
|
|
|
|
Rates();
|
|
|
|
|
Rates(const Rates&);
|
|
|
|
|
~Rates();
|
2020-02-17 18:46:07 +01:00
|
|
|
DataRate min_rate = DataRate::KilobitsPerSec(30);
|
|
|
|
|
DataRate max_rate = DataRate::KilobitsPerSec(3000);
|
|
|
|
|
DataRate start_rate = DataRate::KilobitsPerSec(300);
|
2018-09-27 13:47:01 +02:00
|
|
|
} rates;
|
2018-12-18 15:53:04 +01:00
|
|
|
NetworkControllerFactoryInterface* cc_factory = nullptr;
|
2020-02-10 11:16:00 +01:00
|
|
|
TimeDelta state_log_interval = TimeDelta::Millis(100);
|
2018-09-27 13:47:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct CallClientConfig {
|
|
|
|
|
TransportControllerConfig transport;
|
2019-11-28 13:44:25 +01:00
|
|
|
const WebRtcKeyValueConfig* field_trials = nullptr;
|
2018-09-27 13:47:01 +02:00
|
|
|
};
|
|
|
|
|
|
2018-09-27 19:08:21 +02:00
|
|
|
struct PacketStreamConfig {
|
|
|
|
|
PacketStreamConfig();
|
|
|
|
|
PacketStreamConfig(const PacketStreamConfig&);
|
|
|
|
|
~PacketStreamConfig();
|
|
|
|
|
int frame_rate = 30;
|
|
|
|
|
DataRate max_data_rate = DataRate::Infinity();
|
2020-02-17 18:46:07 +01:00
|
|
|
DataSize max_packet_size = DataSize::Bytes(1400);
|
|
|
|
|
DataSize min_frame_size = DataSize::Bytes(100);
|
2018-09-27 19:08:21 +02:00
|
|
|
double keyframe_multiplier = 1;
|
2020-02-17 18:46:07 +01:00
|
|
|
DataSize packet_overhead = DataSize::Bytes(PacketOverhead::kDefault);
|
2018-09-27 19:08:21 +02:00
|
|
|
};
|
|
|
|
|
|
2018-09-27 13:47:01 +02:00
|
|
|
struct VideoStreamConfig {
|
|
|
|
|
bool autostart = true;
|
|
|
|
|
struct Source {
|
|
|
|
|
enum Capture {
|
|
|
|
|
kGenerator,
|
|
|
|
|
kVideoFile,
|
2019-02-18 16:54:55 +01:00
|
|
|
kGenerateSlides,
|
|
|
|
|
kImageSlides,
|
|
|
|
|
// Support for explicit frame triggers should be added here if needed.
|
2018-09-27 13:47:01 +02:00
|
|
|
} capture = Capture::kGenerator;
|
2019-02-18 16:54:55 +01:00
|
|
|
struct Slides {
|
2020-02-10 11:16:00 +01:00
|
|
|
TimeDelta change_interval = TimeDelta::Seconds(10);
|
2019-02-18 16:54:55 +01:00
|
|
|
struct Generator {
|
|
|
|
|
int width = 1600;
|
|
|
|
|
int height = 1200;
|
|
|
|
|
} generator;
|
|
|
|
|
struct Images {
|
|
|
|
|
struct Crop {
|
2020-02-10 11:16:00 +01:00
|
|
|
TimeDelta scroll_duration = TimeDelta::Seconds(0);
|
2019-02-18 16:54:55 +01:00
|
|
|
absl::optional<int> width;
|
|
|
|
|
absl::optional<int> height;
|
|
|
|
|
} crop;
|
|
|
|
|
int width = 1850;
|
|
|
|
|
int height = 1110;
|
|
|
|
|
std::vector<std::string> paths = {
|
|
|
|
|
"web_screenshot_1850_1110",
|
|
|
|
|
"presentation_1850_1110",
|
|
|
|
|
"photo_1850_1110",
|
|
|
|
|
"difficult_photo_1850_1110",
|
|
|
|
|
};
|
|
|
|
|
} images;
|
|
|
|
|
} slides;
|
2018-09-27 13:47:01 +02:00
|
|
|
struct Generator {
|
2019-12-05 15:59:00 +01:00
|
|
|
using PixelFormat = FrameGeneratorInterface::OutputType;
|
2019-07-26 15:58:11 +02:00
|
|
|
PixelFormat pixel_format = PixelFormat::kI420;
|
2019-02-14 13:18:42 +01:00
|
|
|
int width = 320;
|
|
|
|
|
int height = 180;
|
2018-09-27 13:47:01 +02:00
|
|
|
} generator;
|
|
|
|
|
struct VideoFile {
|
|
|
|
|
std::string name;
|
2019-02-14 13:18:42 +01:00
|
|
|
// Must be set to width and height of the source video file.
|
|
|
|
|
int width = 0;
|
|
|
|
|
int height = 0;
|
2018-09-27 13:47:01 +02:00
|
|
|
} video_file;
|
|
|
|
|
int framerate = 30;
|
|
|
|
|
} source;
|
|
|
|
|
struct Encoder {
|
|
|
|
|
Encoder();
|
|
|
|
|
Encoder(const Encoder&);
|
|
|
|
|
~Encoder();
|
2019-02-14 13:18:42 +01:00
|
|
|
enum class ContentType {
|
|
|
|
|
kVideo,
|
|
|
|
|
kScreen,
|
|
|
|
|
} content_type = ContentType::kVideo;
|
2018-09-27 13:47:01 +02:00
|
|
|
enum Implementation { kFake, kSoftware, kHardware } implementation = kFake;
|
|
|
|
|
struct Fake {
|
|
|
|
|
DataRate max_rate = DataRate::Infinity();
|
|
|
|
|
} fake;
|
|
|
|
|
|
|
|
|
|
using Codec = VideoCodecType;
|
|
|
|
|
Codec codec = Codec::kVideoCodecGeneric;
|
|
|
|
|
absl::optional<DataRate> max_data_rate;
|
2020-10-13 21:55:07 +02:00
|
|
|
absl::optional<DataRate> min_data_rate;
|
2018-11-12 16:47:43 +01:00
|
|
|
absl::optional<int> max_framerate;
|
2019-02-14 13:18:42 +01:00
|
|
|
// Counted in frame count.
|
|
|
|
|
absl::optional<int> key_frame_interval = 3000;
|
|
|
|
|
bool frame_dropping = true;
|
|
|
|
|
struct SingleLayer {
|
|
|
|
|
bool denoising = true;
|
|
|
|
|
bool automatic_scaling = true;
|
|
|
|
|
} single;
|
2019-02-18 16:55:15 +01:00
|
|
|
struct Layers {
|
|
|
|
|
int temporal = 1;
|
|
|
|
|
int spatial = 1;
|
|
|
|
|
enum class Prediction {
|
|
|
|
|
kTemporalOnly,
|
|
|
|
|
kSpatialOnKey,
|
|
|
|
|
kFull,
|
|
|
|
|
} prediction = Prediction::kFull;
|
|
|
|
|
} layers;
|
|
|
|
|
|
2018-09-27 13:47:01 +02:00
|
|
|
DegradationPreference degradation_preference =
|
|
|
|
|
DegradationPreference::MAINTAIN_FRAMERATE;
|
2020-10-13 21:55:07 +02:00
|
|
|
bool suspend_below_min_bitrate = false;
|
2018-09-27 13:47:01 +02:00
|
|
|
} encoder;
|
|
|
|
|
struct Stream {
|
|
|
|
|
Stream();
|
|
|
|
|
Stream(const Stream&);
|
|
|
|
|
~Stream();
|
2019-06-13 17:36:01 +02:00
|
|
|
bool abs_send_time = false;
|
2018-09-27 13:47:01 +02:00
|
|
|
bool packet_feedback = true;
|
|
|
|
|
bool use_rtx = true;
|
2018-11-12 16:33:29 +01:00
|
|
|
DataRate pad_to_rate = DataRate::Zero();
|
2020-02-10 11:16:00 +01:00
|
|
|
TimeDelta nack_history_time = TimeDelta::Millis(1000);
|
2018-09-27 13:47:01 +02:00
|
|
|
bool use_flexfec = false;
|
|
|
|
|
bool use_ulpfec = false;
|
2019-04-01 13:34:55 +02:00
|
|
|
FecControllerFactoryInterface* fec_controller_factory = nullptr;
|
2018-09-27 13:47:01 +02:00
|
|
|
} stream;
|
2019-04-01 13:34:55 +02:00
|
|
|
struct Rendering {
|
2018-09-27 13:47:01 +02:00
|
|
|
enum Type { kFake } type = kFake;
|
2019-04-01 13:34:55 +02:00
|
|
|
std::string sync_group;
|
|
|
|
|
} render;
|
2019-04-02 11:51:28 +02:00
|
|
|
struct Hooks {
|
|
|
|
|
std::vector<std::function<void(const VideoFramePair&)>> frame_pair_handlers;
|
|
|
|
|
} hooks;
|
2018-09-27 13:47:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct AudioStreamConfig {
|
|
|
|
|
AudioStreamConfig();
|
|
|
|
|
AudioStreamConfig(const AudioStreamConfig&);
|
|
|
|
|
~AudioStreamConfig();
|
|
|
|
|
bool autostart = true;
|
|
|
|
|
struct Source {
|
|
|
|
|
int channels = 1;
|
|
|
|
|
} source;
|
2018-10-17 16:27:55 +02:00
|
|
|
bool network_adaptation = false;
|
|
|
|
|
struct NetworkAdaptation {
|
|
|
|
|
struct FrameLength {
|
|
|
|
|
double min_packet_loss_for_decrease = 0;
|
|
|
|
|
double max_packet_loss_for_increase = 1;
|
|
|
|
|
DataRate min_rate_for_20_ms = DataRate::Zero();
|
|
|
|
|
DataRate max_rate_for_60_ms = DataRate::Infinity();
|
|
|
|
|
DataRate min_rate_for_60_ms = DataRate::Zero();
|
|
|
|
|
DataRate max_rate_for_120_ms = DataRate::Infinity();
|
|
|
|
|
} frame;
|
2020-02-27 12:04:20 +01:00
|
|
|
std::string binary_proto;
|
2018-10-17 16:27:55 +02:00
|
|
|
} adapt;
|
2018-09-27 13:47:01 +02:00
|
|
|
struct Encoder {
|
|
|
|
|
Encoder();
|
|
|
|
|
Encoder(const Encoder&);
|
|
|
|
|
~Encoder();
|
|
|
|
|
bool allocate_bitrate = false;
|
2019-01-16 17:21:28 +01:00
|
|
|
bool enable_dtx = false;
|
2018-09-27 13:47:01 +02:00
|
|
|
absl::optional<DataRate> fixed_rate;
|
|
|
|
|
absl::optional<DataRate> min_rate;
|
|
|
|
|
absl::optional<DataRate> max_rate;
|
2020-02-10 11:16:00 +01:00
|
|
|
TimeDelta initial_frame_length = TimeDelta::Millis(20);
|
2018-09-27 13:47:01 +02:00
|
|
|
} encoder;
|
|
|
|
|
struct Stream {
|
|
|
|
|
Stream();
|
|
|
|
|
Stream(const Stream&);
|
|
|
|
|
~Stream();
|
2019-06-13 17:36:01 +02:00
|
|
|
bool abs_send_time = false;
|
2018-09-27 13:47:01 +02:00
|
|
|
bool in_bandwidth_estimation = false;
|
|
|
|
|
} stream;
|
2019-04-01 13:34:55 +02:00
|
|
|
struct Rendering {
|
2018-09-27 13:47:01 +02:00
|
|
|
std::string sync_group;
|
|
|
|
|
} render;
|
|
|
|
|
};
|
|
|
|
|
|
2019-04-15 14:42:42 +02:00
|
|
|
// TODO(srte): Merge this with BuiltInNetworkBehaviorConfig.
|
|
|
|
|
struct NetworkSimulationConfig {
|
|
|
|
|
DataRate bandwidth = DataRate::Infinity();
|
|
|
|
|
TimeDelta delay = TimeDelta::Zero();
|
|
|
|
|
TimeDelta delay_std_dev = TimeDelta::Zero();
|
|
|
|
|
double loss_rate = 0;
|
|
|
|
|
bool codel_active_queue_management = false;
|
2019-10-14 15:07:58 +02:00
|
|
|
absl::optional<int> packet_queue_length_limit;
|
2018-09-27 13:47:01 +02:00
|
|
|
DataSize packet_overhead = DataSize::Zero();
|
|
|
|
|
};
|
|
|
|
|
} // namespace test
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
|
|
|
|
#endif // TEST_SCENARIO_SCENARIO_CONFIG_H_
|