BalancedDegradationSettings: Add option to configure QP thresholds.

Add possibility to configure low/high QP thresholds based on resolution.

Bug: none
Change-Id: Iaa3168b77678bd74feb67295d7658c0140721231
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/141867
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Commit-Queue: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28348}
diff --git a/modules/video_coding/utility/quality_scaler.cc b/modules/video_coding/utility/quality_scaler.cc
index 1f1f192..42c40c5 100644
--- a/modules/video_coding/utility/quality_scaler.cc
+++ b/modules/video_coding/utility/quality_scaler.cc
@@ -134,6 +134,11 @@
   return sampling_period_ms_ * initial_scale_factor_;
 }
 
+void QualityScaler::SetQpThresholds(VideoEncoder::QpThresholds thresholds) {
+  RTC_DCHECK_RUN_ON(&task_checker_);
+  thresholds_ = thresholds;
+}
+
 void QualityScaler::ReportDroppedFrameByMediaOpt() {
   RTC_DCHECK_RUN_ON(&task_checker_);
   framedrop_percent_media_opt_.AddSample(100);
diff --git a/modules/video_coding/utility/quality_scaler.h b/modules/video_coding/utility/quality_scaler.h
index 7886fc0..367db0e 100644
--- a/modules/video_coding/utility/quality_scaler.h
+++ b/modules/video_coding/utility/quality_scaler.h
@@ -60,6 +60,8 @@
   // Inform the QualityScaler of the last seen QP.
   void ReportQp(int qp, int64_t time_sent_us);
 
+  void SetQpThresholds(VideoEncoder::QpThresholds thresholds);
+
   // The following members declared protected for testing purposes.
  protected:
   QualityScaler(rtc::TaskQueue* task_queue,
@@ -80,7 +82,7 @@
   AdaptationObserverInterface* const observer_ RTC_GUARDED_BY(&task_checker_);
   SequenceChecker task_checker_;
 
-  const VideoEncoder::QpThresholds thresholds_;
+  VideoEncoder::QpThresholds thresholds_ RTC_GUARDED_BY(&task_checker_);
   const int64_t sampling_period_ms_;
   bool fast_rampup_ RTC_GUARDED_BY(&task_checker_);
   rtc::MovingAverage average_qp_ RTC_GUARDED_BY(&task_checker_);