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

Unified Diff: webrtc/video/video_stream_encoder.cc

Issue 3000693003: Move kMinPixelsPerFrame constant in VideoStreamEncoder to VideoEncoder::ScalingSettings. (Closed)
Patch Set: 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
Index: webrtc/video/video_stream_encoder.cc
diff --git a/webrtc/video/video_stream_encoder.cc b/webrtc/video/video_stream_encoder.cc
index 51fb1d43d61de933dc0ec35b7d43ee1379daebbf..7e25df09b42128c737c823c0e6fc31cbdab35217 100644
--- a/webrtc/video/video_stream_encoder.cc
+++ b/webrtc/video/video_stream_encoder.cc
@@ -38,12 +38,6 @@ namespace {
// Time interval for logging frame counts.
const int64_t kFrameLogIntervalMs = 60000;
-
-// We will never ask for a resolution lower than this.
-// TODO(kthelgason): Lower this limit when better testing
-// on MediaCodec and fallback implementations are in place.
-// See https://bugs.chromium.org/p/webrtc/issues/detail?id=7206
-const int kMinPixelsPerFrame = 320 * 180;
const int kMinFramerateFps = 2;
const int kMaxFramerateFps = 120;
@@ -233,7 +227,7 @@ class VideoStreamEncoder::VideoSourceProxy {
source_->AddOrUpdateSink(video_stream_encoder_, sink_wants_);
}
- bool RequestResolutionLowerThan(int pixel_count) {
+ bool RequestResolutionLowerThan(int pixel_count, int min_pixels_per_frame) {
// Called on the encoder task queue.
rtc::CritScope lock(&crit_);
if (!source_ || !IsResolutionScalingEnabled(degradation_preference_)) {
@@ -244,7 +238,7 @@ class VideoStreamEncoder::VideoSourceProxy {
// The input video frame size will have a resolution less than or equal to
// |max_pixel_count| depending on how the source can scale the frame size.
const int pixels_wanted = (pixel_count * 3) / 5;
- if (pixels_wanted < kMinPixelsPerFrame ||
+ if (pixels_wanted < min_pixels_per_frame ||
pixels_wanted >= sink_wants_.max_pixel_count) {
return false;
}
@@ -990,7 +984,8 @@ void VideoStreamEncoder::AdaptDown(AdaptReason reason) {
case VideoSendStream::DegradationPreference::kMaintainFramerate:
// Scale down resolution.
if (!source_proxy_->RequestResolutionLowerThan(
- adaptation_request.input_pixel_count_)) {
+ adaptation_request.input_pixel_count_,
+ settings_.encoder->GetScalingSettings().min_pixels_per_frame)) {
return;
}
GetAdaptCounter().IncrementResolution(reason);

Powered by Google App Engine
This is Rietveld 408576698