Index: webrtc/modules/video_coding/utility/quality_scaler.cc |
diff --git a/webrtc/modules/video_coding/utility/quality_scaler.cc b/webrtc/modules/video_coding/utility/quality_scaler.cc |
index 0e1f1d4248bd7e97a66542da765e12b18a3c5464..b9190bb245b165994cd6c0c3fdcf0623c3dcc315 100644 |
--- a/webrtc/modules/video_coding/utility/quality_scaler.cc |
+++ b/webrtc/modules/video_coding/utility/quality_scaler.cc |
@@ -18,8 +18,6 @@ static const int kMeasureSecondsFastUpscale = 2; |
static const int kMeasureSecondsUpscale = 5; |
static const int kMeasureSecondsDownscale = 5; |
static const int kFramedropPercentThreshold = 60; |
-static const int kHdResolutionThreshold = 700 * 500; |
-static const int kHdBitrateThresholdKbps = 500; |
// Min width/height to downscale to, set to not go below QVGA, but with some |
// margin to permit "almost-QVGA" resolutions, such as QCIF. |
static const int kMinDownscaleDimension = 140; |
@@ -46,12 +44,19 @@ void QualityScaler::Init(int low_qp_threshold, |
measure_seconds_upscale_ = kMeasureSecondsFastUpscale; |
const int init_width = width; |
const int init_height = height; |
- // TODO(glaznev): Investigate using thresholds for other resolutions |
- // or threshold tables. |
- if (initial_bitrate_kbps > 0 && |
- initial_bitrate_kbps < kHdBitrateThresholdKbps) { |
- // Start scaling to roughly VGA. |
- while (width * height > kHdResolutionThreshold) { |
+ if (initial_bitrate_kbps > 0) { |
+ // Resolutions a bit above their actual values to permit near-VGA and |
+ // near-QVGA resolutions to use the same mechanism. |
+ int init_num_pixels = width * height; |
+ static const int kVgaBitrateThresholdKbps = 500; |
AlexG
2016/04/18 20:30:03
Why not to keep all these constants at the start w
pbos-webrtc
2016/04/18 20:41:44
Done.
|
+ static const int kVgaNumPixels = 700 * 500; // 640x480 |
+ if (initial_bitrate_kbps < kVgaBitrateThresholdKbps) |
+ init_num_pixels = kVgaNumPixels; |
+ static const int kQvgaBitrateThresholdKbps = 250; |
+ static const int kQvgaNumPixels = 400 * 300; // 320x240 |
+ if (initial_bitrate_kbps < kQvgaBitrateThresholdKbps) |
+ init_num_pixels = kQvgaNumPixels; |
+ while (width * height > init_num_pixels) { |
++downscale_shift_; |
width /= 2; |
height /= 2; |