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

Unified Diff: webrtc/modules/video_coding/utility/quality_scaler.cc

Issue 2764143002: Add field trial to update quality scaler QP thresholds for Android HW encoder. (Closed)
Patch Set: Address comments Created 3 years, 9 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
« no previous file with comments | « no previous file | webrtc/sdk/android/src/jni/androidmediaencoder_jni.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3dd3dde93a92b0a7f84357a20e1e6b6db95a3d8e..ff22862bb53bb8dd767ba229ad4a38a527b70565 100644
--- a/webrtc/modules/video_coding/utility/quality_scaler.cc
+++ b/webrtc/modules/video_coding/utility/quality_scaler.cc
@@ -112,6 +112,8 @@ QualityScaler::QualityScaler(AdaptationObserverInterface* observer,
RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
RTC_DCHECK(observer_ != nullptr);
check_qp_task_ = new CheckQPTask(this);
+ LOG(LS_INFO) << "QP thresholds: low: " << thresholds_.low
+ << ", high: " << thresholds_.high;
}
QualityScaler::~QualityScaler() {
@@ -140,7 +142,6 @@ void QualityScaler::CheckQP() {
RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
// Should be set through InitEncode -> Should be set by now.
RTC_DCHECK_GE(thresholds_.low, 0);
- LOG(LS_INFO) << "Checking if average QP exceeds threshold";
// Check if we should scale down due to high frame drop.
const rtc::Optional<int> drop_rate = framedrop_percent_.GetAverage();
if (drop_rate && *drop_rate >= kFramedropPercentThreshold) {
@@ -150,27 +151,28 @@ void QualityScaler::CheckQP() {
// Check if we should scale up or down based on QP.
const rtc::Optional<int> avg_qp = average_qp_.GetAverage();
- if (avg_qp && *avg_qp > thresholds_.high) {
- ReportQPHigh();
- return;
- }
- if (avg_qp && *avg_qp <= thresholds_.low) {
- // QP has been low. We want to try a higher resolution.
- ReportQPLow();
- return;
+ if (avg_qp) {
+ LOG(LS_INFO) << "Checking average QP " << *avg_qp;
+ if (*avg_qp > thresholds_.high) {
+ ReportQPHigh();
+ return;
+ }
+ if (*avg_qp <= thresholds_.low) {
+ // QP has been low. We want to try a higher resolution.
+ ReportQPLow();
+ return;
+ }
}
}
void QualityScaler::ReportQPLow() {
RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
- LOG(LS_INFO) << "QP has been low, asking for higher resolution.";
ClearSamples();
observer_->AdaptUp(AdaptationObserverInterface::AdaptReason::kQuality);
}
void QualityScaler::ReportQPHigh() {
RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
- LOG(LS_INFO) << "QP has been high , asking for lower resolution.";
ClearSamples();
observer_->AdaptDown(AdaptationObserverInterface::AdaptReason::kQuality);
// If we've scaled down, wait longer before scaling up again.
« no previous file with comments | « no previous file | webrtc/sdk/android/src/jni/androidmediaencoder_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698