| 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/media/engine/videoencodersoftwarefallbackwrapper.h" | 11 #include "webrtc/media/engine/videoencodersoftwarefallbackwrapper.h" |
| 12 | 12 |
| 13 #include "webrtc/media/engine/internalencoderfactory.h" | 13 #include "webrtc/media/engine/internalencoderfactory.h" |
| 14 #include "webrtc/modules/video_coding/include/video_error_codes.h" | 14 #include "webrtc/modules/video_coding/include/video_error_codes.h" |
| 15 #include "webrtc/rtc_base/checks.h" | 15 #include "webrtc/rtc_base/checks.h" |
| 16 #include "webrtc/rtc_base/logging.h" | 16 #include "webrtc/rtc_base/logging.h" |
| 17 #include "webrtc/rtc_base/timeutils.h" | 17 #include "webrtc/rtc_base/timeutils.h" |
| 18 #include "webrtc/system_wrappers/include/field_trial.h" | 18 #include "webrtc/system_wrappers/include/field_trial.h" |
| 19 | 19 |
| 20 namespace webrtc { | 20 namespace webrtc { |
| 21 namespace { | 21 namespace { |
| 22 const char kVp8ForceFallbackEncoderFieldTrial[] = | 22 const char kVp8ForceFallbackEncoderFieldTrial[] = |
| 23 "WebRTC-VP8-Forced-Fallback-Encoder"; | 23 "WebRTC-VP8-Forced-Fallback-Encoder"; |
| 24 | 24 |
| 25 bool EnableForcedFallback(const cricket::VideoCodec& codec) { | 25 bool EnableForcedFallback(const cricket::VideoCodec& codec) { |
| 26 if (!webrtc::field_trial::IsEnabled(kVp8ForceFallbackEncoderFieldTrial)) | 26 if (!webrtc::field_trial::IsEnabled(kVp8ForceFallbackEncoderFieldTrial)) |
| 27 return false; | 27 return false; |
| 28 | 28 |
| 29 return (PayloadNameToCodecType(codec.name).value_or(kVideoCodecUnknown) == | 29 return (PayloadStringToCodecType(codec.name) == kVideoCodecVP8); |
| 30 kVideoCodecVP8); | |
| 31 } | 30 } |
| 32 | 31 |
| 33 bool IsForcedFallbackPossible(const VideoCodec& codec_settings) { | 32 bool IsForcedFallbackPossible(const VideoCodec& codec_settings) { |
| 34 return codec_settings.codecType == kVideoCodecVP8 && | 33 return codec_settings.codecType == kVideoCodecVP8 && |
| 35 codec_settings.numberOfSimulcastStreams <= 1 && | 34 codec_settings.numberOfSimulcastStreams <= 1 && |
| 36 codec_settings.VP8().numberOfTemporalLayers == 1; | 35 codec_settings.VP8().numberOfTemporalLayers == 1; |
| 37 } | 36 } |
| 38 | 37 |
| 39 void GetForcedFallbackParamsFromFieldTrialGroup(uint32_t* param_low_kbps, | 38 void GetForcedFallbackParamsFromFieldTrialGroup(uint32_t* param_low_kbps, |
| 40 uint32_t* param_high_kbps, | 39 uint32_t* param_high_kbps, |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 } | 348 } |
| 350 | 349 |
| 351 bool VideoEncoderSoftwareFallbackWrapper::ForcedFallbackParams::ShouldStop( | 350 bool VideoEncoderSoftwareFallbackWrapper::ForcedFallbackParams::ShouldStop( |
| 352 uint32_t bitrate_kbps, | 351 uint32_t bitrate_kbps, |
| 353 const VideoCodec& codec) const { | 352 const VideoCodec& codec) const { |
| 354 return bitrate_kbps >= high_kbps && | 353 return bitrate_kbps >= high_kbps && |
| 355 (codec.width * codec.height >= kMinPixelsStop); | 354 (codec.width * codec.height >= kMinPixelsStop); |
| 356 } | 355 } |
| 357 | 356 |
| 358 } // namespace webrtc | 357 } // namespace webrtc |
| OLD | NEW |