Backed out 2 changesets (bug 1853057) for causing mda failures on test_video_low_powe...
[gecko.git] / third_party / libwebrtc / test / video_codec_settings.h
blob5ef4ed3e4ae85e7b324382ca653cba185476a8ae
1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
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 */
10 #ifndef TEST_VIDEO_CODEC_SETTINGS_H_
11 #define TEST_VIDEO_CODEC_SETTINGS_H_
13 #include "api/video_codecs/video_encoder.h"
15 namespace webrtc {
16 namespace test {
18 const uint16_t kTestWidth = 352;
19 const uint16_t kTestHeight = 288;
20 const uint32_t kTestFrameRate = 30;
21 const unsigned int kTestMinBitrateKbps = 30;
22 const unsigned int kTestStartBitrateKbps = 300;
23 const uint8_t kTestPayloadType = 100;
24 const int64_t kTestTimingFramesDelayMs = 200;
25 const uint16_t kTestOutlierFrameSizePercent = 250;
27 static void CodecSettings(VideoCodecType codec_type, VideoCodec* settings) {
28 *settings = {};
30 settings->width = kTestWidth;
31 settings->height = kTestHeight;
33 settings->startBitrate = kTestStartBitrateKbps;
34 settings->maxBitrate = 0;
35 settings->minBitrate = kTestMinBitrateKbps;
37 settings->maxFramerate = kTestFrameRate;
39 settings->active = true;
41 settings->qpMax = 56; // See webrtcvideoengine.h.
42 settings->numberOfSimulcastStreams = 0;
44 settings->timing_frame_thresholds = {
45 kTestTimingFramesDelayMs,
46 kTestOutlierFrameSizePercent,
49 settings->codecType = codec_type;
50 switch (codec_type) {
51 case kVideoCodecVP8:
52 *(settings->VP8()) = VideoEncoder::GetDefaultVp8Settings();
53 return;
54 case kVideoCodecVP9:
55 *(settings->VP9()) = VideoEncoder::GetDefaultVp9Settings();
56 return;
57 case kVideoCodecH264:
58 // TODO(brandtr): Set `qpMax` here, when the OpenH264 wrapper supports it.
59 *(settings->H264()) = VideoEncoder::GetDefaultH264Settings();
60 return;
61 default:
62 return;
65 } // namespace test
66 } // namespace webrtc
68 #endif // TEST_VIDEO_CODEC_SETTINGS_H_