Chromium Code Reviews| Index: webrtc/media/engine/videoencodersoftwarefallbackwrapper.h |
| diff --git a/webrtc/media/engine/videoencodersoftwarefallbackwrapper.h b/webrtc/media/engine/videoencodersoftwarefallbackwrapper.h |
| index 61c1a11c8d32e798b043c033c3cbecde17b91df8..f924553fda2c71edd2ec351401117f3a77eecace 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 Start(uint32_t kbps, const VideoCodec& codec); |
|
brandtr
2017/08/09 09:05:03
How about naming these ShouldStart and ShouldStop
åsapersson
2017/08/09 09:50:36
Done.
|
| + bool Stop(uint32_t kbps) const { return kbps >= high_kbps; } |
| + 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 |