OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 case VideoEncoderConfig::ContentType::kScreen: | 225 case VideoEncoderConfig::ContentType::kScreen: |
226 video_codec.mode = kScreensharing; | 226 video_codec.mode = kScreensharing; |
227 if (config.streams.size() == 1 && | 227 if (config.streams.size() == 1 && |
228 config.streams[0].temporal_layer_thresholds_bps.size() == 1) { | 228 config.streams[0].temporal_layer_thresholds_bps.size() == 1) { |
229 video_codec.targetBitrate = | 229 video_codec.targetBitrate = |
230 config.streams[0].temporal_layer_thresholds_bps[0] / 1000; | 230 config.streams[0].temporal_layer_thresholds_bps[0] / 1000; |
231 } | 231 } |
232 break; | 232 break; |
233 } | 233 } |
234 | 234 |
| 235 if (config.encoder_specific_settings) |
| 236 config.encoder_specific_settings->FillEncoderSpecificSettings(&video_codec); |
| 237 |
235 switch (video_codec.codecType) { | 238 switch (video_codec.codecType) { |
236 case kVideoCodecVP8: { | 239 case kVideoCodecVP8: { |
237 if (config.encoder_specific_settings) { | 240 if (!config.encoder_specific_settings) |
238 video_codec.codecSpecific.VP8 = *reinterpret_cast<const VideoCodecVP8*>( | |
239 config.encoder_specific_settings); | |
240 } else { | |
241 video_codec.codecSpecific.VP8 = VideoEncoder::GetDefaultVp8Settings(); | 241 video_codec.codecSpecific.VP8 = VideoEncoder::GetDefaultVp8Settings(); |
242 } | |
243 video_codec.codecSpecific.VP8.numberOfTemporalLayers = | 242 video_codec.codecSpecific.VP8.numberOfTemporalLayers = |
244 static_cast<unsigned char>( | 243 static_cast<unsigned char>( |
245 streams.back().temporal_layer_thresholds_bps.size() + 1); | 244 streams.back().temporal_layer_thresholds_bps.size() + 1); |
246 break; | 245 break; |
247 } | 246 } |
248 case kVideoCodecVP9: { | 247 case kVideoCodecVP9: { |
249 if (config.encoder_specific_settings) { | 248 if (!config.encoder_specific_settings) |
250 video_codec.codecSpecific.VP9 = *reinterpret_cast<const VideoCodecVP9*>( | |
251 config.encoder_specific_settings); | |
252 if (video_codec.mode == kScreensharing) { | |
253 video_codec.codecSpecific.VP9.flexibleMode = true; | |
254 // For now VP9 screensharing use 1 temporal and 2 spatial layers. | |
255 RTC_DCHECK_EQ(video_codec.codecSpecific.VP9.numberOfTemporalLayers, | |
256 1); | |
257 RTC_DCHECK_EQ(video_codec.codecSpecific.VP9.numberOfSpatialLayers, 2); | |
258 } | |
259 } else { | |
260 video_codec.codecSpecific.VP9 = VideoEncoder::GetDefaultVp9Settings(); | 249 video_codec.codecSpecific.VP9 = VideoEncoder::GetDefaultVp9Settings(); |
| 250 if (video_codec.mode == kScreensharing && |
| 251 config.encoder_specific_settings) { |
| 252 video_codec.codecSpecific.VP9.flexibleMode = true; |
| 253 // For now VP9 screensharing use 1 temporal and 2 spatial layers. |
| 254 RTC_DCHECK_EQ(1, video_codec.codecSpecific.VP9.numberOfTemporalLayers); |
| 255 RTC_DCHECK_EQ(2, video_codec.codecSpecific.VP9.numberOfSpatialLayers); |
261 } | 256 } |
262 video_codec.codecSpecific.VP9.numberOfTemporalLayers = | 257 video_codec.codecSpecific.VP9.numberOfTemporalLayers = |
263 static_cast<unsigned char>( | 258 static_cast<unsigned char>( |
264 streams.back().temporal_layer_thresholds_bps.size() + 1); | 259 streams.back().temporal_layer_thresholds_bps.size() + 1); |
265 break; | 260 break; |
266 } | 261 } |
267 case kVideoCodecH264: { | 262 case kVideoCodecH264: { |
268 if (config.encoder_specific_settings) { | 263 if (!config.encoder_specific_settings) |
269 video_codec.codecSpecific.H264 = | |
270 *reinterpret_cast<const VideoCodecH264*>( | |
271 config.encoder_specific_settings); | |
272 } else { | |
273 video_codec.codecSpecific.H264 = VideoEncoder::GetDefaultH264Settings(); | 264 video_codec.codecSpecific.H264 = VideoEncoder::GetDefaultH264Settings(); |
274 } | |
275 break; | 265 break; |
276 } | 266 } |
277 default: | 267 default: |
278 // TODO(pbos): Support encoder_settings codec-agnostically. | 268 // TODO(pbos): Support encoder_settings codec-agnostically. |
279 RTC_DCHECK(!config.encoder_specific_settings) | 269 RTC_DCHECK(!config.encoder_specific_settings) |
280 << "Encoder-specific settings for codec type not wired up."; | 270 << "Encoder-specific settings for codec type not wired up."; |
281 break; | 271 break; |
282 } | 272 } |
283 | 273 |
284 strncpy(video_codec.plName, payload_name.c_str(), kPayloadNameSize - 1); | 274 strncpy(video_codec.plName, payload_name.c_str(), kPayloadNameSize - 1); |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 &module_nack_rate); | 921 &module_nack_rate); |
932 *sent_video_rate_bps += module_video_rate; | 922 *sent_video_rate_bps += module_video_rate; |
933 *sent_nack_rate_bps += module_nack_rate; | 923 *sent_nack_rate_bps += module_nack_rate; |
934 *sent_fec_rate_bps += module_fec_rate; | 924 *sent_fec_rate_bps += module_fec_rate; |
935 } | 925 } |
936 return 0; | 926 return 0; |
937 } | 927 } |
938 | 928 |
939 } // namespace internal | 929 } // namespace internal |
940 } // namespace webrtc | 930 } // namespace webrtc |
OLD | NEW |