OLD | NEW |
---|---|
(Empty) | |
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 WEBRTC_TEST_VIDEO_CODEC_SETTINGS_H_ | |
11 #define WEBRTC_TEST_VIDEO_CODEC_SETTINGS_H_ | |
12 | |
13 #include "webrtc/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 | |
27 static void CodecSettings(VideoCodecType codec_type, VideoCodec* settings) { | |
28 memset(settings, 0, sizeof(VideoCodec)); | |
29 switch (codec_type) { | |
30 case kVideoCodecVP8: | |
31 strncpy(settings->plName, "VP8", 4); | |
32 settings->codecType = kVideoCodecVP8; | |
33 // 96 to 127 dynamic payload types for video codecs. | |
34 settings->plType = kTestPayloadType; | |
35 settings->startBitrate = kTestStartBitrateKbps; | |
36 settings->minBitrate = kTestMinBitrateKbps; | |
37 settings->maxBitrate = 0; | |
38 settings->maxFramerate = kTestFrameRate; | |
39 settings->width = kTestWidth; | |
40 settings->height = kTestHeight; | |
41 settings->numberOfSimulcastStreams = 0; | |
42 settings->qpMax = 56; | |
43 settings->timing_frame_thresholds = { | |
44 kTestTimingFramesDelayMs, kTestOutlierFrameSizePercent, | |
45 }; | |
46 *(settings->VP8()) = VideoEncoder::GetDefaultVp8Settings(); | |
47 return; | |
48 case kVideoCodecVP9: | |
49 strncpy(settings->plName, "VP9", 4); | |
50 settings->codecType = kVideoCodecVP9; | |
51 // 96 to 127 dynamic payload types for video codecs. | |
52 settings->plType = kTestPayloadType; | |
53 settings->startBitrate = 100; | |
54 settings->minBitrate = kTestMinBitrateKbps; | |
55 settings->maxBitrate = 0; | |
56 settings->maxFramerate = kTestFrameRate; | |
57 settings->width = kTestWidth; | |
58 settings->height = kTestHeight; | |
59 settings->numberOfSimulcastStreams = 0; | |
60 settings->qpMax = 56; | |
61 settings->timing_frame_thresholds = { | |
62 kTestTimingFramesDelayMs, kTestOutlierFrameSizePercent, | |
63 }; | |
64 *(settings->VP9()) = VideoEncoder::GetDefaultVp9Settings(); | |
65 return; | |
66 case kVideoCodecH264: | |
67 strncpy(settings->plName, "H264", 5); | |
68 settings->codecType = kVideoCodecH264; | |
69 // 96 to 127 dynamic payload types for video codecs. | |
70 settings->plType = kTestPayloadType; | |
71 settings->startBitrate = kTestStartBitrateKbps; | |
72 settings->minBitrate = kTestMinBitrateKbps; | |
73 settings->maxBitrate = 0; | |
74 settings->maxFramerate = kTestFrameRate; | |
75 settings->width = kTestWidth; | |
76 settings->height = kTestHeight; | |
77 settings->numberOfSimulcastStreams = 0; | |
78 settings->qpMax = 56; | |
brandtr
2017/08/10 08:05:35
This is unrelated to this CL, but does it really m
mflodman
2017/08/10 08:23:56
Good point, likely not.
| |
79 settings->timing_frame_thresholds = { | |
80 kTestTimingFramesDelayMs, kTestOutlierFrameSizePercent, | |
81 }; | |
82 *(settings->H264()) = VideoEncoder::GetDefaultH264Settings(); | |
83 return; | |
84 case kVideoCodecI420: | |
85 strncpy(settings->plName, "I420", 5); | |
86 settings->codecType = kVideoCodecI420; | |
87 // 96 to 127 dynamic payload types for video codecs. | |
88 settings->plType = kTestPayloadType; | |
89 // Bitrate needed for this size and framerate. | |
90 settings->startBitrate = | |
91 3 * kTestWidth * kTestHeight * 8 * kTestFrameRate / 1000 / 2; | |
92 settings->maxBitrate = settings->startBitrate; | |
93 settings->maxFramerate = kTestFrameRate; | |
94 settings->width = kTestWidth; | |
95 settings->height = kTestHeight; | |
96 settings->minBitrate = kTestMinBitrateKbps; | |
97 settings->numberOfSimulcastStreams = 0; | |
98 return; | |
99 case kVideoCodecRED: | |
100 case kVideoCodecULPFEC: | |
101 case kVideoCodecFlexfec: | |
102 case kVideoCodecGeneric: | |
103 case kVideoCodecUnknown: | |
104 RTC_NOTREACHED(); | |
105 return; | |
106 } | |
107 } | |
108 } // namespace test | |
109 } // namespace webrtc | |
110 | |
111 #endif // WEBRTC_TEST_VIDEO_CODEC_SETTINGS_H_ | |
OLD | NEW |