OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/modules/video_coding/include/video_codec_initializer.h" | 11 #include "webrtc/modules/video_coding/include/video_codec_initializer.h" |
12 | 12 |
13 #include "webrtc/base/basictypes.h" | 13 #include "webrtc/base/basictypes.h" |
14 #include "webrtc/base/logging.h" | 14 #include "webrtc/base/logging.h" |
| 15 #include "webrtc/common_types.h" |
15 #include "webrtc/common_video/include/video_bitrate_allocator.h" | 16 #include "webrtc/common_video/include/video_bitrate_allocator.h" |
16 #include "webrtc/common_types.h" | |
17 #include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h" | 17 #include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h" |
18 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_rate_allocator.h" | 18 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_rate_allocator.h" |
19 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" | 19 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" |
| 20 #include "webrtc/modules/video_coding/include/video_coding_defines.h" |
20 #include "webrtc/modules/video_coding/utility/default_video_bitrate_allocator.h" | 21 #include "webrtc/modules/video_coding/utility/default_video_bitrate_allocator.h" |
21 #include "webrtc/system_wrappers/include/clock.h" | 22 #include "webrtc/system_wrappers/include/clock.h" |
22 | 23 |
23 namespace webrtc { | 24 namespace webrtc { |
24 | 25 |
25 bool VideoCodecInitializer::SetupCodec( | 26 bool VideoCodecInitializer::SetupCodec( |
26 const VideoEncoderConfig& config, | 27 const VideoEncoderConfig& config, |
27 const VideoSendStream::Config::EncoderSettings settings, | 28 const VideoSendStream::Config::EncoderSettings settings, |
28 const std::vector<VideoStream>& streams, | 29 const std::vector<VideoStream>& streams, |
29 bool nack_enabled, | 30 bool nack_enabled, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 159 } |
159 | 160 |
160 strncpy(video_codec.plName, payload_name.c_str(), kPayloadNameSize - 1); | 161 strncpy(video_codec.plName, payload_name.c_str(), kPayloadNameSize - 1); |
161 video_codec.plName[kPayloadNameSize - 1] = '\0'; | 162 video_codec.plName[kPayloadNameSize - 1] = '\0'; |
162 video_codec.plType = payload_type; | 163 video_codec.plType = payload_type; |
163 video_codec.numberOfSimulcastStreams = | 164 video_codec.numberOfSimulcastStreams = |
164 static_cast<unsigned char>(streams.size()); | 165 static_cast<unsigned char>(streams.size()); |
165 video_codec.minBitrate = streams[0].min_bitrate_bps / 1000; | 166 video_codec.minBitrate = streams[0].min_bitrate_bps / 1000; |
166 if (video_codec.minBitrate < kEncoderMinBitrateKbps) | 167 if (video_codec.minBitrate < kEncoderMinBitrateKbps) |
167 video_codec.minBitrate = kEncoderMinBitrateKbps; | 168 video_codec.minBitrate = kEncoderMinBitrateKbps; |
| 169 video_codec.timing_frame_thresholds = {kDefaultTimingFramesDelayMs, |
| 170 kDefaultOutlierFrameSizePercent}; |
168 RTC_DCHECK_LE(streams.size(), kMaxSimulcastStreams); | 171 RTC_DCHECK_LE(streams.size(), kMaxSimulcastStreams); |
169 if (video_codec.codecType == kVideoCodecVP9) { | 172 if (video_codec.codecType == kVideoCodecVP9) { |
170 // If the vector is empty, bitrates will be configured automatically. | 173 // If the vector is empty, bitrates will be configured automatically. |
171 RTC_DCHECK(config.spatial_layers.empty() || | 174 RTC_DCHECK(config.spatial_layers.empty() || |
172 config.spatial_layers.size() == | 175 config.spatial_layers.size() == |
173 video_codec.VP9()->numberOfSpatialLayers); | 176 video_codec.VP9()->numberOfSpatialLayers); |
174 RTC_DCHECK_LE(video_codec.VP9()->numberOfSpatialLayers, | 177 RTC_DCHECK_LE(video_codec.VP9()->numberOfSpatialLayers, |
175 kMaxSimulcastStreams); | 178 kMaxSimulcastStreams); |
176 for (size_t i = 0; i < config.spatial_layers.size(); ++i) | 179 for (size_t i = 0; i < config.spatial_layers.size(); ++i) |
177 video_codec.spatialLayers[i] = config.spatial_layers[i]; | 180 video_codec.spatialLayers[i] = config.spatial_layers[i]; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 224 } |
222 if (video_codec.maxBitrate < kEncoderMinBitrateKbps) | 225 if (video_codec.maxBitrate < kEncoderMinBitrateKbps) |
223 video_codec.maxBitrate = kEncoderMinBitrateKbps; | 226 video_codec.maxBitrate = kEncoderMinBitrateKbps; |
224 | 227 |
225 RTC_DCHECK_GT(streams[0].max_framerate, 0); | 228 RTC_DCHECK_GT(streams[0].max_framerate, 0); |
226 video_codec.maxFramerate = streams[0].max_framerate; | 229 video_codec.maxFramerate = streams[0].max_framerate; |
227 return video_codec; | 230 return video_codec; |
228 } | 231 } |
229 | 232 |
230 } // namespace webrtc | 233 } // namespace webrtc |
OLD | NEW |