Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1148)

Unified Diff: webrtc/media/engine/videoencodersoftwarefallbackwrapper.h

Issue 2988963002: Add support for a forced software encoder fallback. (Closed)
Patch Set: address comments Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/media/engine/videoencodersoftwarefallbackwrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | webrtc/media/engine/videoencodersoftwarefallbackwrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698