Tune QP-based quality thresholds.

Increases measure time for downscale back to 5 seconds, this is required
to not over-react on hand-waving or quick device rotations.

Also increase max thresholds for QP a bit to not overreact when quality
still looks somewhat OK. Min thresholds for H264 seemed very low and are
increased to be sure that we can go back up again. The window is still
quite big with the increased max QP.

Also changes libvpx thresholds to use the same thresholds as the
encoder, they were excessively low before and wouldn't adapt on bad QPs
at all before (but rely on >60% framedropping based on bitrates to go
down).

BUG=webrtc:5678
R=stefan@webrtc.org
TBR=glaznev@webrtc.org

Review URL: https://codereview.webrtc.org/1894083002 .

Cr-Commit-Position: refs/heads/master@{#12403}
diff --git a/webrtc/api/java/jni/androidmediaencoder_jni.cc b/webrtc/api/java/jni/androidmediaencoder_jni.cc
index 1530f00..69060f8 100644
--- a/webrtc/api/java/jni/androidmediaencoder_jni.cc
+++ b/webrtc/api/java/jni/androidmediaencoder_jni.cc
@@ -376,15 +376,15 @@
       // always = 127. Note that in SW, QP is that of the user-level range [0,
       // 63].
       const int kLowQpThreshold = 29;
-      const int kBadQpThreshold = 90;
+      const int kBadQpThreshold = 100;
       quality_scaler_.Init(kLowQpThreshold, kBadQpThreshold, false,
                            codec_settings->startBitrate, codec_settings->width,
                            codec_settings->height,
                            codec_settings->maxFramerate);
     } else if (codecType_ == kVideoCodecH264) {
       // H264 QP is in the range [0, 51].
-      const int kLowQpThreshold = 21;
-      const int kBadQpThreshold = 33;
+      const int kLowQpThreshold = 24;
+      const int kBadQpThreshold = 39;
       quality_scaler_.Init(kLowQpThreshold, kBadQpThreshold, false,
                            codec_settings->startBitrate, codec_settings->width,
                            codec_settings->height,