| Index: webrtc/media/engine/videoencodersoftwarefallbackwrapper.h
|
| diff --git a/webrtc/media/engine/videoencodersoftwarefallbackwrapper.h b/webrtc/media/engine/videoencodersoftwarefallbackwrapper.h
|
| index 61c1a11c8d32e798b043c033c3cbecde17b91df8..ea7e13d353ba3846ae669b35e413f617bda8f78c 100644
|
| --- a/webrtc/media/engine/videoencodersoftwarefallbackwrapper.h
|
| +++ b/webrtc/media/engine/videoencodersoftwarefallbackwrapper.h
|
| @@ -49,6 +49,33 @@ class VideoEncoderSoftwareFallbackWrapper : public VideoEncoder {
|
| private:
|
| bool InitFallbackEncoder();
|
|
|
| + // If |forced_fallback_possible_| is true:
|
| + // The forced fallback is requested if the target bitrate is below |low_kbps|
|
| + // for more than |min_low_ms| and the input video resolution is not larger
|
| + // than |kMaxPixels|.
|
| + // If the bitrate is above |high_kbps|, the forced fallback is requested to
|
| + // immediately be stopped.
|
| + class ForcedFallbackParams {
|
| + public:
|
| + bool ShouldStart(uint32_t bitrate_kbps, const VideoCodec& codec);
|
| + bool ShouldStop(uint32_t bitrate_kbps) const;
|
| + void Reset() { start_ms.reset(); }
|
| + bool IsValid(const VideoCodec& codec) const {
|
| + return codec.width * codec.height <= kMaxPixels;
|
| + }
|
| + rtc::Optional<int64_t> start_ms; // Set when bitrate is below |low_kbps|.
|
| + uint32_t low_kbps = 100;
|
| + uint32_t high_kbps = 150;
|
| + int64_t min_low_ms = 10000;
|
| + const int kMaxPixels = 320 * 240;
|
| + };
|
| +
|
| + bool RequestForcedFallback();
|
| + bool TryReleaseForcedFallbackEncoder();
|
| + bool TryReInitForcedFallbackEncoder();
|
| + void ValidateSettingsForForcedFallback();
|
| + bool IsForcedFallbackActive() const;
|
| +
|
| // Settings used in the last InitEncode call and used if a dynamic fallback to
|
| // software is required.
|
| VideoCodec codec_settings_;
|
| @@ -71,6 +98,9 @@ class VideoEncoderSoftwareFallbackWrapper : public VideoEncoder {
|
| std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_;
|
| std::string fallback_implementation_name_;
|
| EncodedImageCallback* callback_;
|
| +
|
| + bool forced_fallback_possible_;
|
| + ForcedFallbackParams forced_fallback_;
|
| };
|
|
|
| } // namespace webrtc
|
|
|