Use DataRates in QualityRampUpExperimentHelper
R=sprang@webrtc.org Bug: None Change-Id: Ia05e0bc99b98372f87d78a9a3014d7a228ce8abb Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/177342 Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Evan Shrubsole <eshr@google.com> Cr-Commit-Position: refs/heads/master@{#31542}
This commit is contained in:

committed by
Commit Bot

parent
c6d6e06a5c
commit
2c9d76a4eb
@ -29,6 +29,7 @@ rtc_library("video_adaptation") {
|
|||||||
"../../api:scoped_refptr",
|
"../../api:scoped_refptr",
|
||||||
"../../api/adaptation:resource_adaptation_api",
|
"../../api/adaptation:resource_adaptation_api",
|
||||||
"../../api/task_queue:task_queue",
|
"../../api/task_queue:task_queue",
|
||||||
|
"../../api/units:data_rate",
|
||||||
"../../api/video:video_adaptation",
|
"../../api/video:video_adaptation",
|
||||||
"../../api/video:video_frame",
|
"../../api/video:video_frame",
|
||||||
"../../api/video:video_stream_encoder",
|
"../../api/video:video_stream_encoder",
|
||||||
|
@ -45,20 +45,20 @@ QualityRampUpExperimentHelper::CreateIfEnabled(
|
|||||||
|
|
||||||
void QualityRampUpExperimentHelper::PerformQualityRampupExperiment(
|
void QualityRampUpExperimentHelper::PerformQualityRampupExperiment(
|
||||||
rtc::scoped_refptr<QualityScalerResource> quality_scaler_resource,
|
rtc::scoped_refptr<QualityScalerResource> quality_scaler_resource,
|
||||||
uint32_t bw_kbps,
|
DataRate bandwidth,
|
||||||
uint32_t encoder_target_bitrate,
|
DataRate encoder_target_bitrate,
|
||||||
uint32_t max_bitrate_bps,
|
DataRate max_bitrate,
|
||||||
int pixels) {
|
int pixels) {
|
||||||
if (!quality_scaler_resource->is_started())
|
if (!quality_scaler_resource->is_started())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int64_t now_ms = clock_->TimeInMilliseconds();
|
int64_t now_ms = clock_->TimeInMilliseconds();
|
||||||
quality_rampup_experiment_.SetMaxBitrate(pixels, max_bitrate_bps);
|
quality_rampup_experiment_.SetMaxBitrate(pixels, max_bitrate.kbps());
|
||||||
|
|
||||||
bool try_quality_rampup = false;
|
bool try_quality_rampup = false;
|
||||||
if (quality_rampup_experiment_.BwHigh(now_ms, bw_kbps)) {
|
if (quality_rampup_experiment_.BwHigh(now_ms, bandwidth.kbps())) {
|
||||||
// Verify that encoder is at max bitrate and the QP is low.
|
// Verify that encoder is at max bitrate and the QP is low.
|
||||||
if (encoder_target_bitrate == max_bitrate_bps * 1000 &&
|
if (encoder_target_bitrate == max_bitrate &&
|
||||||
quality_scaler_resource->QpFastFilterLow()) {
|
quality_scaler_resource->QpFastFilterLow()) {
|
||||||
try_quality_rampup = true;
|
try_quality_rampup = true;
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "api/scoped_refptr.h"
|
#include "api/scoped_refptr.h"
|
||||||
|
#include "api/units/data_rate.h"
|
||||||
#include "rtc_base/experiments/quality_rampup_experiment.h"
|
#include "rtc_base/experiments/quality_rampup_experiment.h"
|
||||||
#include "system_wrappers/include/clock.h"
|
#include "system_wrappers/include/clock.h"
|
||||||
#include "video/adaptation/quality_scaler_resource.h"
|
#include "video/adaptation/quality_scaler_resource.h"
|
||||||
@ -45,9 +46,9 @@ class QualityRampUpExperimentHelper {
|
|||||||
|
|
||||||
void PerformQualityRampupExperiment(
|
void PerformQualityRampupExperiment(
|
||||||
rtc::scoped_refptr<QualityScalerResource> quality_scaler_resource,
|
rtc::scoped_refptr<QualityScalerResource> quality_scaler_resource,
|
||||||
uint32_t bw_kbps,
|
DataRate bandwidth,
|
||||||
uint32_t encoder_target_bitrate,
|
DataRate encoder_target_bitrate,
|
||||||
uint32_t max_bitrate_bps,
|
DataRate max_bitrate,
|
||||||
int pixels);
|
int pixels);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -487,13 +487,13 @@ void VideoStreamEncoderResourceManager::OnMaybeEncodeFrame() {
|
|||||||
RTC_DCHECK_RUN_ON(encoder_queue_);
|
RTC_DCHECK_RUN_ON(encoder_queue_);
|
||||||
initial_frame_dropper_->OnMaybeEncodeFrame();
|
initial_frame_dropper_->OnMaybeEncodeFrame();
|
||||||
if (quality_rampup_experiment_) {
|
if (quality_rampup_experiment_) {
|
||||||
uint32_t bw_kbps = encoder_rates_.has_value()
|
DataRate bandwidth = encoder_rates_.has_value()
|
||||||
? encoder_rates_.value().bandwidth_allocation.kbps()
|
? encoder_rates_->bandwidth_allocation
|
||||||
: 0;
|
: DataRate::Zero();
|
||||||
quality_rampup_experiment_->PerformQualityRampupExperiment(
|
quality_rampup_experiment_->PerformQualityRampupExperiment(
|
||||||
quality_scaler_resource_, bw_kbps,
|
quality_scaler_resource_, bandwidth,
|
||||||
encoder_target_bitrate_bps_.value_or(0),
|
DataRate::BitsPerSec(encoder_target_bitrate_bps_.value_or(0)),
|
||||||
encoder_settings_->video_codec().maxBitrate,
|
DataRate::KilobitsPerSec(encoder_settings_->video_codec().maxBitrate),
|
||||||
LastInputFrameSizeOrDefault());
|
LastInputFrameSizeOrDefault());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user