• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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  */
10 #ifndef TEST_VIDEO_CODEC_SETTINGS_H_
11 #define TEST_VIDEO_CODEC_SETTINGS_H_
12 
13 #include "api/video_codecs/video_encoder.h"
14 
15 namespace webrtc {
16 namespace test {
17 
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;
26 
CodecSettings(VideoCodecType codec_type,VideoCodec * settings)27 static void CodecSettings(VideoCodecType codec_type, VideoCodec* settings) {
28   memset(settings, 0, sizeof(VideoCodec));
29 
30   settings->plType = kTestPayloadType;
31 
32   settings->width = kTestWidth;
33   settings->height = kTestHeight;
34 
35   settings->startBitrate = kTestStartBitrateKbps;
36   settings->maxBitrate = 0;
37   settings->minBitrate = kTestMinBitrateKbps;
38 
39   settings->maxFramerate = kTestFrameRate;
40 
41   settings->active = true;
42 
43   settings->qpMax = 56;  // See webrtcvideoengine.h.
44   settings->numberOfSimulcastStreams = 0;
45 
46   settings->timing_frame_thresholds = {
47       kTestTimingFramesDelayMs,
48       kTestOutlierFrameSizePercent,
49   };
50 
51   settings->codecType = codec_type;
52   switch (codec_type) {
53     case kVideoCodecVP8:
54       *(settings->VP8()) = VideoEncoder::GetDefaultVp8Settings();
55       return;
56     case kVideoCodecVP9:
57       *(settings->VP9()) = VideoEncoder::GetDefaultVp9Settings();
58       return;
59     case kVideoCodecH264:
60       // TODO(brandtr): Set |qpMax| here, when the OpenH264 wrapper supports it.
61       *(settings->H264()) = VideoEncoder::GetDefaultH264Settings();
62       return;
63     default:
64       return;
65   }
66 }
67 }  // namespace test
68 }  // namespace webrtc
69 
70 #endif  // TEST_VIDEO_CODEC_SETTINGS_H_
71