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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 case VideoEncoderConfig::ContentType::kScreen: | 221 case VideoEncoderConfig::ContentType::kScreen: |
222 video_codec.mode = kScreensharing; | 222 video_codec.mode = kScreensharing; |
223 if (config.streams.size() == 1 && | 223 if (config.streams.size() == 1 && |
224 config.streams[0].temporal_layer_thresholds_bps.size() == 1) { | 224 config.streams[0].temporal_layer_thresholds_bps.size() == 1) { |
225 video_codec.targetBitrate = | 225 video_codec.targetBitrate = |
226 config.streams[0].temporal_layer_thresholds_bps[0] / 1000; | 226 config.streams[0].temporal_layer_thresholds_bps[0] / 1000; |
227 } | 227 } |
228 break; | 228 break; |
229 } | 229 } |
230 | 230 |
| 231 if (config.encoder_specific_settings) |
| 232 config.encoder_specific_settings->FillEncoderSpecificSettings(&video_codec); |
| 233 |
231 switch (video_codec.codecType) { | 234 switch (video_codec.codecType) { |
232 case kVideoCodecVP8: { | 235 case kVideoCodecVP8: { |
233 if (config.encoder_specific_settings) { | 236 if (!config.encoder_specific_settings) |
234 video_codec.codecSpecific.VP8 = *reinterpret_cast<const VideoCodecVP8*>( | |
235 config.encoder_specific_settings); | |
236 } else { | |
237 video_codec.codecSpecific.VP8 = VideoEncoder::GetDefaultVp8Settings(); | 237 video_codec.codecSpecific.VP8 = VideoEncoder::GetDefaultVp8Settings(); |
238 } | |
239 video_codec.codecSpecific.VP8.numberOfTemporalLayers = | 238 video_codec.codecSpecific.VP8.numberOfTemporalLayers = |
240 static_cast<unsigned char>( | 239 static_cast<unsigned char>( |
241 streams.back().temporal_layer_thresholds_bps.size() + 1); | 240 streams.back().temporal_layer_thresholds_bps.size() + 1); |
242 break; | 241 break; |
243 } | 242 } |
244 case kVideoCodecVP9: { | 243 case kVideoCodecVP9: { |
245 if (config.encoder_specific_settings) { | 244 if (!config.encoder_specific_settings) |
246 video_codec.codecSpecific.VP9 = *reinterpret_cast<const VideoCodecVP9*>( | |
247 config.encoder_specific_settings); | |
248 if (video_codec.mode == kScreensharing) { | |
249 video_codec.codecSpecific.VP9.flexibleMode = true; | |
250 // For now VP9 screensharing use 1 temporal and 2 spatial layers. | |
251 RTC_DCHECK_EQ(video_codec.codecSpecific.VP9.numberOfTemporalLayers, | |
252 1); | |
253 RTC_DCHECK_EQ(video_codec.codecSpecific.VP9.numberOfSpatialLayers, 2); | |
254 } | |
255 } else { | |
256 video_codec.codecSpecific.VP9 = VideoEncoder::GetDefaultVp9Settings(); | 245 video_codec.codecSpecific.VP9 = VideoEncoder::GetDefaultVp9Settings(); |
| 246 if (video_codec.mode == kScreensharing && |
| 247 config.encoder_specific_settings) { |
| 248 video_codec.codecSpecific.VP9.flexibleMode = true; |
| 249 // For now VP9 screensharing use 1 temporal and 2 spatial layers. |
| 250 RTC_DCHECK_EQ(1, video_codec.codecSpecific.VP9.numberOfTemporalLayers); |
| 251 RTC_DCHECK_EQ(2, video_codec.codecSpecific.VP9.numberOfSpatialLayers); |
257 } | 252 } |
258 video_codec.codecSpecific.VP9.numberOfTemporalLayers = | 253 video_codec.codecSpecific.VP9.numberOfTemporalLayers = |
259 static_cast<unsigned char>( | 254 static_cast<unsigned char>( |
260 streams.back().temporal_layer_thresholds_bps.size() + 1); | 255 streams.back().temporal_layer_thresholds_bps.size() + 1); |
261 break; | 256 break; |
262 } | 257 } |
263 case kVideoCodecH264: { | 258 case kVideoCodecH264: { |
264 if (config.encoder_specific_settings) { | 259 if (!config.encoder_specific_settings) |
265 video_codec.codecSpecific.H264 = | |
266 *reinterpret_cast<const VideoCodecH264*>( | |
267 config.encoder_specific_settings); | |
268 } else { | |
269 video_codec.codecSpecific.H264 = VideoEncoder::GetDefaultH264Settings(); | 260 video_codec.codecSpecific.H264 = VideoEncoder::GetDefaultH264Settings(); |
270 } | |
271 break; | 261 break; |
272 } | 262 } |
273 default: | 263 default: |
274 // TODO(pbos): Support encoder_settings codec-agnostically. | 264 // TODO(pbos): Support encoder_settings codec-agnostically. |
275 RTC_DCHECK(!config.encoder_specific_settings) | 265 RTC_DCHECK(!config.encoder_specific_settings) |
276 << "Encoder-specific settings for codec type not wired up."; | 266 << "Encoder-specific settings for codec type not wired up."; |
277 break; | 267 break; |
278 } | 268 } |
279 | 269 |
280 strncpy(video_codec.plName, payload_name.c_str(), kPayloadNameSize - 1); | 270 strncpy(video_codec.plName, payload_name.c_str(), kPayloadNameSize - 1); |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 &module_nack_rate); | 815 &module_nack_rate); |
826 *sent_video_rate_bps += module_video_rate; | 816 *sent_video_rate_bps += module_video_rate; |
827 *sent_nack_rate_bps += module_nack_rate; | 817 *sent_nack_rate_bps += module_nack_rate; |
828 *sent_fec_rate_bps += module_fec_rate; | 818 *sent_fec_rate_bps += module_fec_rate; |
829 } | 819 } |
830 return 0; | 820 return 0; |
831 } | 821 } |
832 | 822 |
833 } // namespace internal | 823 } // namespace internal |
834 } // namespace webrtc | 824 } // namespace webrtc |
OLD | NEW |