blob: 82c82cd7e140ec0fc78c38cadcfa2039d629e44f [file] [log] [blame]
mflodman351424e2017-08-10 09:43:141/*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
Mirko Bonadei92ea95e2017-09-15 04:47:3110#ifndef TEST_VIDEO_CODEC_SETTINGS_H_
11#define TEST_VIDEO_CODEC_SETTINGS_H_
mflodman351424e2017-08-10 09:43:1412
Mirko Bonadei92ea95e2017-09-15 04:47:3113#include "api/video_codecs/video_encoder.h"
mflodman351424e2017-08-10 09:43:1414
15namespace webrtc {
16namespace test {
17
18const uint16_t kTestWidth = 352;
19const uint16_t kTestHeight = 288;
20const uint32_t kTestFrameRate = 30;
21const unsigned int kTestMinBitrateKbps = 30;
22const unsigned int kTestStartBitrateKbps = 300;
23const uint8_t kTestPayloadType = 100;
24const int64_t kTestTimingFramesDelayMs = 200;
25const uint16_t kTestOutlierFrameSizePercent = 250;
26
27static void CodecSettings(VideoCodecType codec_type, VideoCodec* settings) {
Danil Chapovalov9f4859e2020-10-16 15:45:4128 *settings = {};
Rasmus Brandt2b304f12018-02-05 08:52:4729
Rasmus Brandt2b304f12018-02-05 08:52:4730 settings->width = kTestWidth;
31 settings->height = kTestHeight;
32
33 settings->startBitrate = kTestStartBitrateKbps;
34 settings->maxBitrate = 0;
35 settings->minBitrate = kTestMinBitrateKbps;
Rasmus Brandt2b304f12018-02-05 08:52:4736
37 settings->maxFramerate = kTestFrameRate;
38
39 settings->active = true;
40
41 settings->qpMax = 56; // See webrtcvideoengine.h.
42 settings->numberOfSimulcastStreams = 0;
43
44 settings->timing_frame_thresholds = {
Jonas Olssona4d87372019-07-05 17:08:3345 kTestTimingFramesDelayMs,
46 kTestOutlierFrameSizePercent,
Rasmus Brandt2b304f12018-02-05 08:52:4747 };
48
Kári Tristan Helgasone8a2e6c2018-08-23 11:19:0049 settings->codecType = codec_type;
mflodman351424e2017-08-10 09:43:1450 switch (codec_type) {
51 case kVideoCodecVP8:
mflodman351424e2017-08-10 09:43:1452 *(settings->VP8()) = VideoEncoder::GetDefaultVp8Settings();
53 return;
54 case kVideoCodecVP9:
mflodman351424e2017-08-10 09:43:1455 *(settings->VP9()) = VideoEncoder::GetDefaultVp9Settings();
56 return;
57 case kVideoCodecH264:
Rasmus Brandt2b304f12018-02-05 08:52:4758 // TODO(brandtr): Set |qpMax| here, when the OpenH264 wrapper supports it.
mflodman351424e2017-08-10 09:43:1459 *(settings->H264()) = VideoEncoder::GetDefaultH264Settings();
60 return;
Kári Tristan Helgason84ccb2d2018-08-16 12:35:2661 default:
mflodman351424e2017-08-10 09:43:1462 return;
63 }
64}
65} // namespace test
66} // namespace webrtc
67
Mirko Bonadei92ea95e2017-09-15 04:47:3168#endif // TEST_VIDEO_CODEC_SETTINGS_H_