Move the QP scaling thresholds to the relevant encoders.
Also provide a new set of thresholds for the VideoToolbox encoder. The new thresholds were experimentally determined to work well on the iPhone 6S, and also adequately on the iPhone 5S.
BUG=webrtc:5678
Review-Url: https://codereview.webrtc.org/2309743002
Cr-Original-Commit-Position: refs/heads/master@{#14420}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 478681e1e6e6c5d66366672614d58b10ad7df083
diff --git a/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.mm b/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.mm
index 2d1e2a1..8868713 100644
--- a/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.mm
+++ b/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.mm
@@ -33,6 +33,10 @@
// kVTCompressionPropertyKey_AverageBitRate. The data rate limit is set higher
// than the average bit rate to avoid undershooting the target.
const float kLimitToAverageBitRateFactor = 1.5f;
+// These thresholds deviate from the default h264 QP thresholds, as they
+// have been found to work better on devices that support VideoToolbox
+const int kLowH264QpThreshold = 28;
+const int kHighH264QpThreshold = 39;
// Convenience function for creating a dictionary.
inline CFDictionaryRef CreateCFDictionary(CFTypeRef* keys,
@@ -232,8 +236,8 @@
RTC_DCHECK_EQ(codec_settings->codecType, kVideoCodecH264);
{
rtc::CritScope lock(&quality_scaler_crit_);
- quality_scaler_.Init(QualityScaler::kLowH264QpThreshold,
- QualityScaler::kBadH264QpThreshold,
+ quality_scaler_.Init(internal::kLowH264QpThreshold,
+ internal::kHighH264QpThreshold,
codec_settings->startBitrate, codec_settings->width,
codec_settings->height, codec_settings->maxFramerate);
QualityScaler::Resolution res = quality_scaler_.GetScaledResolution();