OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // A list of encoders that were created without being wrapped in a | 145 // A list of encoders that were created without being wrapped in a |
146 // SimulcastEncoderAdapter. | 146 // SimulcastEncoderAdapter. |
147 std::vector<webrtc::VideoEncoder*> non_simulcast_encoders_; | 147 std::vector<webrtc::VideoEncoder*> non_simulcast_encoders_; |
148 }; | 148 }; |
149 | 149 |
150 bool CodecIsInternallySupported(const std::string& codec_name) { | 150 bool CodecIsInternallySupported(const std::string& codec_name) { |
151 if (CodecNamesEq(codec_name, kVp8CodecName)) { | 151 if (CodecNamesEq(codec_name, kVp8CodecName)) { |
152 return true; | 152 return true; |
153 } | 153 } |
154 if (CodecNamesEq(codec_name, kVp9CodecName)) { | 154 if (CodecNamesEq(codec_name, kVp9CodecName)) { |
155 const std::string group_name = | 155 return true; |
156 webrtc::field_trial::FindFullName("WebRTC-SupportVP9"); | |
157 return group_name == "Enabled" || group_name == "EnabledByFlag"; | |
158 } | 156 } |
159 if (CodecNamesEq(codec_name, kH264CodecName)) { | 157 if (CodecNamesEq(codec_name, kH264CodecName)) { |
160 return webrtc::H264Encoder::IsSupported() && | 158 return webrtc::H264Encoder::IsSupported() && |
161 webrtc::H264Decoder::IsSupported(); | 159 webrtc::H264Decoder::IsSupported(); |
162 } | 160 } |
163 return false; | 161 return false; |
164 } | 162 } |
165 | 163 |
166 void AddDefaultFeedbackParams(VideoCodec* codec) { | 164 void AddDefaultFeedbackParams(VideoCodec* codec) { |
167 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamCcm, kRtcpFbCcmParamFir)); | 165 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamCcm, kRtcpFbCcmParamFir)); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 LOG(LS_WARNING) << "Conflict merging red_rtx_payload_type configs: " | 294 LOG(LS_WARNING) << "Conflict merging red_rtx_payload_type configs: " |
297 << output->red_rtx_payload_type << " and " | 295 << output->red_rtx_payload_type << " and " |
298 << other.red_rtx_payload_type; | 296 << other.red_rtx_payload_type; |
299 } | 297 } |
300 output->red_rtx_payload_type = other.red_rtx_payload_type; | 298 output->red_rtx_payload_type = other.red_rtx_payload_type; |
301 } | 299 } |
302 } | 300 } |
303 | 301 |
304 // Returns true if the given codec is disallowed from doing simulcast. | 302 // Returns true if the given codec is disallowed from doing simulcast. |
305 bool IsCodecBlacklistedForSimulcast(const std::string& codec_name) { | 303 bool IsCodecBlacklistedForSimulcast(const std::string& codec_name) { |
306 return CodecNamesEq(codec_name, kH264CodecName); | 304 return CodecNamesEq(codec_name, kH264CodecName) || |
| 305 CodecNamesEq(codec_name, kVp9CodecName); |
307 } | 306 } |
308 | 307 |
309 // The selected thresholds for QVGA and VGA corresponded to a QP around 10. | 308 // The selected thresholds for QVGA and VGA corresponded to a QP around 10. |
310 // The change in QP declined above the selected bitrates. | 309 // The change in QP declined above the selected bitrates. |
311 static int GetMaxDefaultVideoBitrateKbps(int width, int height) { | 310 static int GetMaxDefaultVideoBitrateKbps(int width, int height) { |
312 if (width * height <= 320 * 240) { | 311 if (width * height <= 320 * 240) { |
313 return 600; | 312 return 600; |
314 } else if (width * height <= 640 * 480) { | 313 } else if (width * height <= 640 * 480) { |
315 return 1700; | 314 return 1700; |
316 } else if (width * height <= 960 * 540) { | 315 } else if (width * height <= 960 * 540) { |
(...skipping 15 matching lines...) Expand all Loading... |
332 // This constant is really an on/off, lower-level configurable NACK history | 331 // This constant is really an on/off, lower-level configurable NACK history |
333 // duration hasn't been implemented. | 332 // duration hasn't been implemented. |
334 static const int kNackHistoryMs = 1000; | 333 static const int kNackHistoryMs = 1000; |
335 | 334 |
336 static const int kDefaultQpMax = 56; | 335 static const int kDefaultQpMax = 56; |
337 | 336 |
338 static const int kDefaultRtcpReceiverReportSsrc = 1; | 337 static const int kDefaultRtcpReceiverReportSsrc = 1; |
339 | 338 |
340 std::vector<VideoCodec> DefaultVideoCodecList() { | 339 std::vector<VideoCodec> DefaultVideoCodecList() { |
341 std::vector<VideoCodec> codecs; | 340 std::vector<VideoCodec> codecs; |
| 341 codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultVp8PlType, |
| 342 kVp8CodecName)); |
342 if (CodecIsInternallySupported(kVp9CodecName)) { | 343 if (CodecIsInternallySupported(kVp9CodecName)) { |
343 codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultVp9PlType, | 344 codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultVp9PlType, |
344 kVp9CodecName)); | 345 kVp9CodecName)); |
345 // TODO(andresp): Add rtx codec for vp9 and verify it works. | 346 // TODO(andresp): Add rtx codec for vp9 and verify it works. |
346 } | 347 } |
347 codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultVp8PlType, | |
348 kVp8CodecName)); | |
349 if (CodecIsInternallySupported(kH264CodecName)) { | 348 if (CodecIsInternallySupported(kH264CodecName)) { |
350 codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultH264PlType, | 349 codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultH264PlType, |
351 kH264CodecName)); | 350 kH264CodecName)); |
352 } | 351 } |
353 codecs.push_back( | 352 codecs.push_back( |
354 VideoCodec::CreateRtxCodec(kDefaultRtxVp8PlType, kDefaultVp8PlType)); | 353 VideoCodec::CreateRtxCodec(kDefaultRtxVp8PlType, kDefaultVp8PlType)); |
355 codecs.push_back(VideoCodec(kDefaultRedPlType, kRedCodecName)); | 354 codecs.push_back(VideoCodec(kDefaultRedPlType, kRedCodecName)); |
356 codecs.push_back(VideoCodec(kDefaultUlpfecType, kUlpfecCodecName)); | 355 codecs.push_back(VideoCodec(kDefaultUlpfecType, kUlpfecCodecName)); |
357 return codecs; | 356 return codecs; |
358 } | 357 } |
(...skipping 2384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2743 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2742 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2744 } | 2743 } |
2745 } | 2744 } |
2746 | 2745 |
2747 return video_codecs; | 2746 return video_codecs; |
2748 } | 2747 } |
2749 | 2748 |
2750 } // namespace cricket | 2749 } // namespace cricket |
2751 | 2750 |
2752 #endif // HAVE_WEBRTC_VIDEO | 2751 #endif // HAVE_WEBRTC_VIDEO |
OLD | NEW |