Stop checking VP8BaseHeavyTl3RateAllocation field trial on every frame.
- Centralize field trial string reading to RateControlSettings - Cache RateControlSettings at all production code use sites Bug: None Change-Id: I0dbce9cc97fea0bc780982e7ef270b417a8c15bf Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158664 Commit-Queue: Rasmus Brandt <brandtr@webrtc.org> Reviewed-by: Elad Alon <eladalon@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29680}
This commit is contained in:

committed by
Commit Bot

parent
a06048a41e
commit
2b9317ad76
@ -306,6 +306,7 @@ rtc_library("rtc_audio_video") {
|
|||||||
"../rtc_base/experiments:field_trial_parser",
|
"../rtc_base/experiments:field_trial_parser",
|
||||||
"../rtc_base/experiments:min_video_bitrate_experiment",
|
"../rtc_base/experiments:min_video_bitrate_experiment",
|
||||||
"../rtc_base/experiments:normalize_simulcast_size_experiment",
|
"../rtc_base/experiments:normalize_simulcast_size_experiment",
|
||||||
|
"../rtc_base/experiments:rate_control_settings",
|
||||||
"../rtc_base/system:rtc_export",
|
"../rtc_base/system:rtc_export",
|
||||||
"../rtc_base/third_party/base64",
|
"../rtc_base/third_party/base64",
|
||||||
"../system_wrappers",
|
"../system_wrappers",
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "rtc_base/experiments/experimental_screenshare_settings.h"
|
#include "rtc_base/experiments/experimental_screenshare_settings.h"
|
||||||
#include "rtc_base/experiments/min_video_bitrate_experiment.h"
|
#include "rtc_base/experiments/min_video_bitrate_experiment.h"
|
||||||
#include "rtc_base/experiments/normalize_simulcast_size_experiment.h"
|
#include "rtc_base/experiments/normalize_simulcast_size_experiment.h"
|
||||||
|
#include "rtc_base/experiments/rate_control_settings.h"
|
||||||
#include "rtc_base/logging.h"
|
#include "rtc_base/logging.h"
|
||||||
#include "system_wrappers/include/field_trial.h"
|
#include "system_wrappers/include/field_trial.h"
|
||||||
|
|
||||||
@ -32,9 +33,6 @@ namespace cricket {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
constexpr char kUseBaseHeavyVP8TL3RateAllocationFieldTrial[] =
|
|
||||||
"WebRTC-UseBaseHeavyVP8TL3RateAllocation";
|
|
||||||
|
|
||||||
constexpr char kUseLegacySimulcastLayerLimitFieldTrial[] =
|
constexpr char kUseLegacySimulcastLayerLimitFieldTrial[] =
|
||||||
"WebRTC-LegacySimulcastLayerLimit";
|
"WebRTC-LegacySimulcastLayerLimit";
|
||||||
|
|
||||||
@ -233,9 +231,13 @@ std::vector<webrtc::VideoStream> GetSimulcastConfig(
|
|||||||
bool temporal_layers_supported) {
|
bool temporal_layers_supported) {
|
||||||
RTC_DCHECK(max_layers > 1 || is_screenshare_with_conference_mode);
|
RTC_DCHECK(max_layers > 1 || is_screenshare_with_conference_mode);
|
||||||
|
|
||||||
|
const bool base_heavy_tl3_rate_alloc =
|
||||||
|
webrtc::RateControlSettings::ParseFromFieldTrials()
|
||||||
|
.Vp8BaseHeavyTl3RateAllocation();
|
||||||
if (is_screenshare_with_conference_mode) {
|
if (is_screenshare_with_conference_mode) {
|
||||||
return GetScreenshareLayers(max_layers, width, height, bitrate_priority,
|
return GetScreenshareLayers(max_layers, width, height, bitrate_priority,
|
||||||
max_qp, temporal_layers_supported);
|
max_qp, temporal_layers_supported,
|
||||||
|
base_heavy_tl3_rate_alloc);
|
||||||
} else {
|
} else {
|
||||||
// Some applications rely on the old behavior limiting the simulcast layer
|
// Some applications rely on the old behavior limiting the simulcast layer
|
||||||
// count based on the resolution automatically, which they can get through
|
// count based on the resolution automatically, which they can get through
|
||||||
@ -243,7 +245,8 @@ std::vector<webrtc::VideoStream> GetSimulcastConfig(
|
|||||||
max_layers = LimitSimulcastLayerCount(width, height, max_layers);
|
max_layers = LimitSimulcastLayerCount(width, height, max_layers);
|
||||||
|
|
||||||
return GetNormalSimulcastLayers(max_layers, width, height, bitrate_priority,
|
return GetNormalSimulcastLayers(max_layers, width, height, bitrate_priority,
|
||||||
max_qp, temporal_layers_supported);
|
max_qp, temporal_layers_supported,
|
||||||
|
base_heavy_tl3_rate_alloc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +256,8 @@ std::vector<webrtc::VideoStream> GetNormalSimulcastLayers(
|
|||||||
int height,
|
int height,
|
||||||
double bitrate_priority,
|
double bitrate_priority,
|
||||||
int max_qp,
|
int max_qp,
|
||||||
bool temporal_layers_supported) {
|
bool temporal_layers_supported,
|
||||||
|
bool base_heavy_tl3_rate_alloc) {
|
||||||
std::vector<webrtc::VideoStream> layers(layer_count);
|
std::vector<webrtc::VideoStream> layers(layer_count);
|
||||||
|
|
||||||
// Format width and height has to be divisible by |2 ^ num_simulcast_layers -
|
// Format width and height has to be divisible by |2 ^ num_simulcast_layers -
|
||||||
@ -280,16 +284,16 @@ std::vector<webrtc::VideoStream> GetNormalSimulcastLayers(
|
|||||||
// higher threshold for receiving a feed at all.
|
// higher threshold for receiving a feed at all.
|
||||||
float rate_factor = 1.0;
|
float rate_factor = 1.0;
|
||||||
if (num_temporal_layers == 3) {
|
if (num_temporal_layers == 3) {
|
||||||
if (webrtc::field_trial::IsEnabled(
|
if (base_heavy_tl3_rate_alloc) {
|
||||||
kUseBaseHeavyVP8TL3RateAllocationFieldTrial)) {
|
|
||||||
// Base heavy allocation increases TL0 bitrate from 40% to 60%.
|
// Base heavy allocation increases TL0 bitrate from 40% to 60%.
|
||||||
rate_factor = 0.4 / 0.6;
|
rate_factor = 0.4 / 0.6;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rate_factor =
|
rate_factor =
|
||||||
webrtc::SimulcastRateAllocator::GetTemporalRateAllocation(3, 0) /
|
|
||||||
webrtc::SimulcastRateAllocator::GetTemporalRateAllocation(
|
webrtc::SimulcastRateAllocator::GetTemporalRateAllocation(
|
||||||
num_temporal_layers, 0);
|
3, 0, /*base_heavy_tl3_rate_alloc=*/false) /
|
||||||
|
webrtc::SimulcastRateAllocator::GetTemporalRateAllocation(
|
||||||
|
num_temporal_layers, 0, /*base_heavy_tl3_rate_alloc=*/false);
|
||||||
}
|
}
|
||||||
|
|
||||||
layers[s].max_bitrate_bps =
|
layers[s].max_bitrate_bps =
|
||||||
@ -322,7 +326,8 @@ std::vector<webrtc::VideoStream> GetScreenshareLayers(
|
|||||||
int height,
|
int height,
|
||||||
double bitrate_priority,
|
double bitrate_priority,
|
||||||
int max_qp,
|
int max_qp,
|
||||||
bool temporal_layers_supported) {
|
bool temporal_layers_supported,
|
||||||
|
bool base_heavy_tl3_rate_alloc) {
|
||||||
auto max_screenshare_layers = kMaxScreenshareSimulcastLayers;
|
auto max_screenshare_layers = kMaxScreenshareSimulcastLayers;
|
||||||
size_t num_simulcast_layers =
|
size_t num_simulcast_layers =
|
||||||
std::min<int>(max_layers, max_screenshare_layers);
|
std::min<int>(max_layers, max_screenshare_layers);
|
||||||
@ -361,10 +366,9 @@ std::vector<webrtc::VideoStream> GetScreenshareLayers(
|
|||||||
max_bitrate_bps = static_cast<int>(
|
max_bitrate_bps = static_cast<int>(
|
||||||
kScreenshareHighStreamMaxBitrateBps *
|
kScreenshareHighStreamMaxBitrateBps *
|
||||||
webrtc::SimulcastRateAllocator::GetTemporalRateAllocation(
|
webrtc::SimulcastRateAllocator::GetTemporalRateAllocation(
|
||||||
num_temporal_layers, 0));
|
num_temporal_layers, 0, base_heavy_tl3_rate_alloc));
|
||||||
} else if (DefaultNumberOfTemporalLayers(1, true) != 3 ||
|
} else if (DefaultNumberOfTemporalLayers(1, true) != 3 ||
|
||||||
webrtc::field_trial::IsEnabled(
|
base_heavy_tl3_rate_alloc) {
|
||||||
kUseBaseHeavyVP8TL3RateAllocationFieldTrial)) {
|
|
||||||
// Experimental temporal layer mode used, use increased max bitrate.
|
// Experimental temporal layer mode used, use increased max bitrate.
|
||||||
max_bitrate_bps = experimental_settings.TopLayerMaxBitrate().value_or(
|
max_bitrate_bps = experimental_settings.TopLayerMaxBitrate().value_or(
|
||||||
kScreenshareHighStreamMaxBitrateBps);
|
kScreenshareHighStreamMaxBitrateBps);
|
||||||
|
@ -47,7 +47,8 @@ std::vector<webrtc::VideoStream> GetNormalSimulcastLayers(
|
|||||||
int height,
|
int height,
|
||||||
double bitrate_priority,
|
double bitrate_priority,
|
||||||
int max_qp,
|
int max_qp,
|
||||||
bool temporal_layers_supported = true);
|
bool temporal_layers_supported,
|
||||||
|
bool base_heavy_tl3_rate_alloc);
|
||||||
|
|
||||||
// Gets simulcast config layers for screenshare settings.
|
// Gets simulcast config layers for screenshare settings.
|
||||||
std::vector<webrtc::VideoStream> GetScreenshareLayers(
|
std::vector<webrtc::VideoStream> GetScreenshareLayers(
|
||||||
@ -56,7 +57,8 @@ std::vector<webrtc::VideoStream> GetScreenshareLayers(
|
|||||||
int height,
|
int height,
|
||||||
double bitrate_priority,
|
double bitrate_priority,
|
||||||
int max_qp,
|
int max_qp,
|
||||||
bool temporal_layers_supported = true);
|
bool temporal_layers_supported,
|
||||||
|
bool base_heavy_tl3_rate_alloc);
|
||||||
|
|
||||||
} // namespace cricket
|
} // namespace cricket
|
||||||
|
|
||||||
|
@ -167,6 +167,7 @@ rtc_library("video_coding") {
|
|||||||
"../../rtc_base/experiments:field_trial_parser",
|
"../../rtc_base/experiments:field_trial_parser",
|
||||||
"../../rtc_base/experiments:jitter_upper_bound_experiment",
|
"../../rtc_base/experiments:jitter_upper_bound_experiment",
|
||||||
"../../rtc_base/experiments:min_video_bitrate_experiment",
|
"../../rtc_base/experiments:min_video_bitrate_experiment",
|
||||||
|
"../../rtc_base/experiments:rate_control_settings",
|
||||||
"../../rtc_base/experiments:rtt_mult_experiment",
|
"../../rtc_base/experiments:rtt_mult_experiment",
|
||||||
"../../rtc_base/synchronization:sequence_checker",
|
"../../rtc_base/synchronization:sequence_checker",
|
||||||
"../../rtc_base/system:fallthrough",
|
"../../rtc_base/system:fallthrough",
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "modules/video_coding/internal_defines.h"
|
#include "modules/video_coding/internal_defines.h"
|
||||||
#include "modules/video_coding/utility/simulcast_rate_allocator.h"
|
#include "modules/video_coding/utility/simulcast_rate_allocator.h"
|
||||||
#include "rtc_base/checks.h"
|
#include "rtc_base/checks.h"
|
||||||
|
#include "rtc_base/experiments/rate_control_settings.h"
|
||||||
#include "rtc_base/numerics/safe_conversions.h"
|
#include "rtc_base/numerics/safe_conversions.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -244,12 +245,13 @@ bool VCMNackMethod::UpdateParameters(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMFecMethod::VCMFecMethod() : VCMProtectionMethod() {
|
VCMFecMethod::VCMFecMethod()
|
||||||
|
: VCMProtectionMethod(),
|
||||||
|
rate_control_settings_(RateControlSettings::ParseFromFieldTrials()) {
|
||||||
_type = kFec;
|
_type = kFec;
|
||||||
}
|
}
|
||||||
VCMFecMethod::~VCMFecMethod() {
|
|
||||||
//
|
VCMFecMethod::~VCMFecMethod() = default;
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t VCMFecMethod::BoostCodeRateKey(uint8_t packetFrameDelta,
|
uint8_t VCMFecMethod::BoostCodeRateKey(uint8_t packetFrameDelta,
|
||||||
uint8_t packetFrameKey) const {
|
uint8_t packetFrameKey) const {
|
||||||
@ -443,7 +445,8 @@ int VCMFecMethod::BitsPerFrame(const VCMProtectionParameters* parameters) {
|
|||||||
// layer.
|
// layer.
|
||||||
const float bitRateRatio =
|
const float bitRateRatio =
|
||||||
webrtc::SimulcastRateAllocator::GetTemporalRateAllocation(
|
webrtc::SimulcastRateAllocator::GetTemporalRateAllocation(
|
||||||
parameters->numLayers, 0);
|
parameters->numLayers, 0,
|
||||||
|
rate_control_settings_.Vp8BaseHeavyTl3RateAllocation());
|
||||||
float frameRateRatio = powf(1 / 2.0, parameters->numLayers - 1);
|
float frameRateRatio = powf(1 / 2.0, parameters->numLayers - 1);
|
||||||
float bitRate = parameters->bitRate * bitRateRatio;
|
float bitRate = parameters->bitRate * bitRateRatio;
|
||||||
float frameRate = parameters->frameRate * frameRateRatio;
|
float frameRate = parameters->frameRate * frameRateRatio;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "modules/video_coding/internal_defines.h"
|
#include "modules/video_coding/internal_defines.h"
|
||||||
|
#include "rtc_base/experiments/rate_control_settings.h"
|
||||||
#include "rtc_base/numerics/exp_filter.h"
|
#include "rtc_base/numerics/exp_filter.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -183,6 +184,8 @@ class VCMFecMethod : public VCMProtectionMethod {
|
|||||||
enum { kMaxBytesPerFrameForFecLow = 400 };
|
enum { kMaxBytesPerFrameForFecLow = 400 };
|
||||||
// Max bytes/frame for frame size larger than VGA, ~200k at 25fps.
|
// Max bytes/frame for frame size larger than VGA, ~200k at 25fps.
|
||||||
enum { kMaxBytesPerFrameForFecHigh = 1000 };
|
enum { kMaxBytesPerFrameForFecHigh = 1000 };
|
||||||
|
|
||||||
|
const RateControlSettings rate_control_settings_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class VCMNackFecMethod : public VCMFecMethod {
|
class VCMNackFecMethod : public VCMFecMethod {
|
||||||
|
@ -44,14 +44,15 @@ const uint32_t kLegacyScreenshareTl0BitrateKbps = 200;
|
|||||||
const uint32_t kLegacyScreenshareTl1BitrateKbps = 1000;
|
const uint32_t kLegacyScreenshareTl1BitrateKbps = 1000;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
float SimulcastRateAllocator::GetTemporalRateAllocation(int num_layers,
|
float SimulcastRateAllocator::GetTemporalRateAllocation(
|
||||||
int temporal_id) {
|
int num_layers,
|
||||||
|
int temporal_id,
|
||||||
|
bool base_heavy_tl3_alloc) {
|
||||||
RTC_CHECK_GT(num_layers, 0);
|
RTC_CHECK_GT(num_layers, 0);
|
||||||
RTC_CHECK_LE(num_layers, kMaxTemporalStreams);
|
RTC_CHECK_LE(num_layers, kMaxTemporalStreams);
|
||||||
RTC_CHECK_GE(temporal_id, 0);
|
RTC_CHECK_GE(temporal_id, 0);
|
||||||
RTC_CHECK_LT(temporal_id, num_layers);
|
RTC_CHECK_LT(temporal_id, num_layers);
|
||||||
if (num_layers == 3 &&
|
if (num_layers == 3 && base_heavy_tl3_alloc) {
|
||||||
field_trial::IsEnabled("WebRTC-UseBaseHeavyVP8TL3RateAllocation")) {
|
|
||||||
return kBaseHeavy3TlRateAllocation[temporal_id];
|
return kBaseHeavy3TlRateAllocation[temporal_id];
|
||||||
}
|
}
|
||||||
return kLayerRateAllocation[num_layers - 1][temporal_id];
|
return kLayerRateAllocation[num_layers - 1][temporal_id];
|
||||||
@ -59,8 +60,8 @@ float SimulcastRateAllocator::GetTemporalRateAllocation(int num_layers,
|
|||||||
|
|
||||||
SimulcastRateAllocator::SimulcastRateAllocator(const VideoCodec& codec)
|
SimulcastRateAllocator::SimulcastRateAllocator(const VideoCodec& codec)
|
||||||
: codec_(codec),
|
: codec_(codec),
|
||||||
stable_rate_settings_(
|
stable_rate_settings_(StableTargetRateExperiment::ParseFromFieldTrials()),
|
||||||
StableTargetRateExperiment::ParseFromFieldTrials()) {}
|
rate_control_settings_(RateControlSettings::ParseFromFieldTrials()) {}
|
||||||
|
|
||||||
SimulcastRateAllocator::~SimulcastRateAllocator() = default;
|
SimulcastRateAllocator::~SimulcastRateAllocator() = default;
|
||||||
|
|
||||||
@ -283,7 +284,10 @@ std::vector<uint32_t> SimulcastRateAllocator::DefaultTemporalLayerAllocation(
|
|||||||
std::vector<uint32_t> bitrates;
|
std::vector<uint32_t> bitrates;
|
||||||
for (size_t i = 0; i < num_temporal_layers; ++i) {
|
for (size_t i = 0; i < num_temporal_layers; ++i) {
|
||||||
float layer_bitrate =
|
float layer_bitrate =
|
||||||
bitrate_kbps * GetTemporalRateAllocation(num_temporal_layers, i);
|
bitrate_kbps *
|
||||||
|
GetTemporalRateAllocation(
|
||||||
|
num_temporal_layers, i,
|
||||||
|
rate_control_settings_.Vp8BaseHeavyTl3RateAllocation());
|
||||||
bitrates.push_back(static_cast<uint32_t>(layer_bitrate + 0.5));
|
bitrates.push_back(static_cast<uint32_t>(layer_bitrate + 0.5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "api/video/video_bitrate_allocator.h"
|
#include "api/video/video_bitrate_allocator.h"
|
||||||
#include "api/video_codecs/video_codec.h"
|
#include "api/video_codecs/video_codec.h"
|
||||||
#include "rtc_base/constructor_magic.h"
|
#include "rtc_base/constructor_magic.h"
|
||||||
|
#include "rtc_base/experiments/rate_control_settings.h"
|
||||||
#include "rtc_base/experiments/stable_target_rate_experiment.h"
|
#include "rtc_base/experiments/stable_target_rate_experiment.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -33,7 +34,9 @@ class SimulcastRateAllocator : public VideoBitrateAllocator {
|
|||||||
VideoBitrateAllocationParameters parameters) override;
|
VideoBitrateAllocationParameters parameters) override;
|
||||||
const VideoCodec& GetCodec() const;
|
const VideoCodec& GetCodec() const;
|
||||||
|
|
||||||
static float GetTemporalRateAllocation(int num_layers, int temporal_id);
|
static float GetTemporalRateAllocation(int num_layers,
|
||||||
|
int temporal_id,
|
||||||
|
bool base_heavy_tl3_alloc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DistributeAllocationToSimulcastLayers(
|
void DistributeAllocationToSimulcastLayers(
|
||||||
@ -53,6 +56,7 @@ class SimulcastRateAllocator : public VideoBitrateAllocator {
|
|||||||
|
|
||||||
const VideoCodec codec_;
|
const VideoCodec codec_;
|
||||||
const StableTargetRateExperiment stable_rate_settings_;
|
const StableTargetRateExperiment stable_rate_settings_;
|
||||||
|
const RateControlSettings rate_control_settings_;
|
||||||
std::vector<bool> stream_enabled_;
|
std::vector<bool> stream_enabled_;
|
||||||
|
|
||||||
RTC_DISALLOW_COPY_AND_ASSIGN(SimulcastRateAllocator);
|
RTC_DISALLOW_COPY_AND_ASSIGN(SimulcastRateAllocator);
|
||||||
|
@ -32,6 +32,9 @@ const char kVp8TrustedRateControllerFieldTrialName[] =
|
|||||||
const char kVp9TrustedRateControllerFieldTrialName[] =
|
const char kVp9TrustedRateControllerFieldTrialName[] =
|
||||||
"WebRTC-LibvpxVp9TrustedRateController";
|
"WebRTC-LibvpxVp9TrustedRateController";
|
||||||
|
|
||||||
|
const char kUseBaseHeavyVp8Tl3RateAllocationFieldTrialName[] =
|
||||||
|
"WebRTC-UseBaseHeavyVP8TL3RateAllocation";
|
||||||
|
|
||||||
const char* kVideoHysteresisFieldTrialname =
|
const char* kVideoHysteresisFieldTrialname =
|
||||||
"WebRTC-SimulcastUpswitchHysteresisPercent";
|
"WebRTC-SimulcastUpswitchHysteresisPercent";
|
||||||
const char* kScreenshareHysteresisFieldTrialname =
|
const char* kScreenshareHysteresisFieldTrialname =
|
||||||
@ -74,19 +77,20 @@ constexpr char VideoRateControlConfig::kKey[];
|
|||||||
std::unique_ptr<StructParametersParser> VideoRateControlConfig::Parser() {
|
std::unique_ptr<StructParametersParser> VideoRateControlConfig::Parser() {
|
||||||
// The empty comments ensures that each pair is on a separate line.
|
// The empty comments ensures that each pair is on a separate line.
|
||||||
return StructParametersParser::Create(
|
return StructParametersParser::Create(
|
||||||
"pacing_factor", &pacing_factor, //
|
"pacing_factor", &pacing_factor, //
|
||||||
"alr_probing", &alr_probing, //
|
"alr_probing", &alr_probing, //
|
||||||
"vp8_qp_max", &vp8_qp_max, //
|
"vp8_qp_max", &vp8_qp_max, //
|
||||||
"vp8_min_pixels", &vp8_min_pixels, //
|
"vp8_min_pixels", &vp8_min_pixels, //
|
||||||
"trust_vp8", &trust_vp8, //
|
"trust_vp8", &trust_vp8, //
|
||||||
"trust_vp9", &trust_vp9, //
|
"trust_vp9", &trust_vp9, //
|
||||||
"video_hysteresis", &video_hysteresis, //
|
"video_hysteresis", &video_hysteresis, //
|
||||||
"screenshare_hysteresis", &screenshare_hysteresis, //
|
"screenshare_hysteresis", &screenshare_hysteresis, //
|
||||||
"probe_max_allocation", &probe_max_allocation, //
|
"probe_max_allocation", &probe_max_allocation, //
|
||||||
"bitrate_adjuster", &bitrate_adjuster, //
|
"bitrate_adjuster", &bitrate_adjuster, //
|
||||||
"adjuster_use_headroom", &adjuster_use_headroom, //
|
"adjuster_use_headroom", &adjuster_use_headroom, //
|
||||||
"vp8_s0_boost", &vp8_s0_boost, //
|
"vp8_s0_boost", &vp8_s0_boost, //
|
||||||
"vp8_dynamic_rate", &vp8_dynamic_rate, //
|
"vp8_base_heavy_tl3_alloc", &vp8_base_heavy_tl3_alloc, //
|
||||||
|
"vp8_dynamic_rate", &vp8_dynamic_rate, //
|
||||||
"vp9_dynamic_rate", &vp9_dynamic_rate);
|
"vp9_dynamic_rate", &vp9_dynamic_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,6 +102,8 @@ RateControlSettings::RateControlSettings(
|
|||||||
IsEnabled(key_value_config, kVp8TrustedRateControllerFieldTrialName);
|
IsEnabled(key_value_config, kVp8TrustedRateControllerFieldTrialName);
|
||||||
video_config_.trust_vp9 =
|
video_config_.trust_vp9 =
|
||||||
IsEnabled(key_value_config, kVp9TrustedRateControllerFieldTrialName);
|
IsEnabled(key_value_config, kVp9TrustedRateControllerFieldTrialName);
|
||||||
|
video_config_.vp8_base_heavy_tl3_alloc = IsEnabled(
|
||||||
|
key_value_config, kUseBaseHeavyVp8Tl3RateAllocationFieldTrialName);
|
||||||
ParseHysteresisFactor(key_value_config, kVideoHysteresisFieldTrialname,
|
ParseHysteresisFactor(key_value_config, kVideoHysteresisFieldTrialname,
|
||||||
&video_config_.video_hysteresis);
|
&video_config_.video_hysteresis);
|
||||||
ParseHysteresisFactor(key_value_config, kScreenshareHysteresisFieldTrialname,
|
ParseHysteresisFactor(key_value_config, kScreenshareHysteresisFieldTrialname,
|
||||||
@ -201,6 +207,10 @@ double RateControlSettings::GetSimulcastHysteresisFactor(
|
|||||||
return video_config_.video_hysteresis;
|
return video_config_.video_hysteresis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RateControlSettings::Vp8BaseHeavyTl3RateAllocation() const {
|
||||||
|
return video_config_.vp8_base_heavy_tl3_alloc;
|
||||||
|
}
|
||||||
|
|
||||||
bool RateControlSettings::TriggerProbeOnMaxAllocatedBitrateChange() const {
|
bool RateControlSettings::TriggerProbeOnMaxAllocatedBitrateChange() const {
|
||||||
return video_config_.probe_max_allocation;
|
return video_config_.probe_max_allocation;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ struct VideoRateControlConfig {
|
|||||||
bool bitrate_adjuster = false;
|
bool bitrate_adjuster = false;
|
||||||
bool adjuster_use_headroom = false;
|
bool adjuster_use_headroom = false;
|
||||||
bool vp8_s0_boost = true;
|
bool vp8_s0_boost = true;
|
||||||
|
bool vp8_base_heavy_tl3_alloc = false;
|
||||||
bool vp8_dynamic_rate = false;
|
bool vp8_dynamic_rate = false;
|
||||||
bool vp9_dynamic_rate = false;
|
bool vp9_dynamic_rate = false;
|
||||||
|
|
||||||
@ -82,6 +83,8 @@ class RateControlSettings final {
|
|||||||
double GetSimulcastHysteresisFactor(
|
double GetSimulcastHysteresisFactor(
|
||||||
VideoEncoderConfig::ContentType content_type) const;
|
VideoEncoderConfig::ContentType content_type) const;
|
||||||
|
|
||||||
|
bool Vp8BaseHeavyTl3RateAllocation() const;
|
||||||
|
|
||||||
bool TriggerProbeOnMaxAllocatedBitrateChange() const;
|
bool TriggerProbeOnMaxAllocatedBitrateChange() const;
|
||||||
bool UseEncoderBitrateAdjuster() const;
|
bool UseEncoderBitrateAdjuster() const;
|
||||||
bool BitrateAdjusterCanUseNetworkHeadroom() const;
|
bool BitrateAdjusterCanUseNetworkHeadroom() const;
|
||||||
|
@ -110,6 +110,45 @@ TEST(RateControlSettingsTest, LibvpxTrustedRateController) {
|
|||||||
EXPECT_TRUE(settings_after.LibvpxVp9TrustedRateController());
|
EXPECT_TRUE(settings_after.LibvpxVp9TrustedRateController());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(RateControlSettingsTest, Vp8BaseHeavyTl3RateAllocationLegacyKey) {
|
||||||
|
const RateControlSettings settings_before =
|
||||||
|
RateControlSettings::ParseFromFieldTrials();
|
||||||
|
EXPECT_FALSE(settings_before.Vp8BaseHeavyTl3RateAllocation());
|
||||||
|
|
||||||
|
test::ScopedFieldTrials field_trials(
|
||||||
|
"WebRTC-UseBaseHeavyVP8TL3RateAllocation/Enabled/");
|
||||||
|
const RateControlSettings settings_after =
|
||||||
|
RateControlSettings::ParseFromFieldTrials();
|
||||||
|
EXPECT_TRUE(settings_after.Vp8BaseHeavyTl3RateAllocation());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(RateControlSettingsTest,
|
||||||
|
Vp8BaseHeavyTl3RateAllocationVideoRateControlKey) {
|
||||||
|
const RateControlSettings settings_before =
|
||||||
|
RateControlSettings::ParseFromFieldTrials();
|
||||||
|
EXPECT_FALSE(settings_before.Vp8BaseHeavyTl3RateAllocation());
|
||||||
|
|
||||||
|
test::ScopedFieldTrials field_trials(
|
||||||
|
"WebRTC-VideoRateControl/vp8_base_heavy_tl3_alloc:1/");
|
||||||
|
const RateControlSettings settings_after =
|
||||||
|
RateControlSettings::ParseFromFieldTrials();
|
||||||
|
EXPECT_TRUE(settings_after.Vp8BaseHeavyTl3RateAllocation());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(RateControlSettingsTest,
|
||||||
|
Vp8BaseHeavyTl3RateAllocationVideoRateControlKeyOverridesLegacyKey) {
|
||||||
|
const RateControlSettings settings_before =
|
||||||
|
RateControlSettings::ParseFromFieldTrials();
|
||||||
|
EXPECT_FALSE(settings_before.Vp8BaseHeavyTl3RateAllocation());
|
||||||
|
|
||||||
|
test::ScopedFieldTrials field_trials(
|
||||||
|
"WebRTC-UseBaseHeavyVP8TL3RateAllocation/Enabled/WebRTC-VideoRateControl/"
|
||||||
|
"vp8_base_heavy_tl3_alloc:0/");
|
||||||
|
const RateControlSettings settings_after =
|
||||||
|
RateControlSettings::ParseFromFieldTrials();
|
||||||
|
EXPECT_FALSE(settings_after.Vp8BaseHeavyTl3RateAllocation());
|
||||||
|
}
|
||||||
|
|
||||||
TEST(RateControlSettingsTest, GetSimulcastHysteresisFactor) {
|
TEST(RateControlSettingsTest, GetSimulcastHysteresisFactor) {
|
||||||
const RateControlSettings settings_before =
|
const RateControlSettings settings_before =
|
||||||
RateControlSettings::ParseFromFieldTrials();
|
RateControlSettings::ParseFromFieldTrials();
|
||||||
|
@ -3302,10 +3302,12 @@ TEST_F(VideoStreamEncoderTest, TemporalLayersNotDisabledIfSupported) {
|
|||||||
// Bitrate allocated across temporal layers.
|
// Bitrate allocated across temporal layers.
|
||||||
const int kTl0Bps = kTargetBitrateBps *
|
const int kTl0Bps = kTargetBitrateBps *
|
||||||
webrtc::SimulcastRateAllocator::GetTemporalRateAllocation(
|
webrtc::SimulcastRateAllocator::GetTemporalRateAllocation(
|
||||||
kNumTemporalLayers, /*temporal_id*/ 0);
|
kNumTemporalLayers, /*temporal_id*/ 0,
|
||||||
|
/*base_heavy_tl3_alloc*/ false);
|
||||||
const int kTl1Bps = kTargetBitrateBps *
|
const int kTl1Bps = kTargetBitrateBps *
|
||||||
webrtc::SimulcastRateAllocator::GetTemporalRateAllocation(
|
webrtc::SimulcastRateAllocator::GetTemporalRateAllocation(
|
||||||
kNumTemporalLayers, /*temporal_id*/ 1);
|
kNumTemporalLayers, /*temporal_id*/ 1,
|
||||||
|
/*base_heavy_tl3_alloc*/ false);
|
||||||
VideoBitrateAllocation expected_bitrate;
|
VideoBitrateAllocation expected_bitrate;
|
||||||
expected_bitrate.SetBitrate(/*si*/ 0, /*ti*/ 0, kTl0Bps);
|
expected_bitrate.SetBitrate(/*si*/ 0, /*ti*/ 0, kTl0Bps);
|
||||||
expected_bitrate.SetBitrate(/*si*/ 0, /*ti*/ 1, kTl1Bps - kTl0Bps);
|
expected_bitrate.SetBitrate(/*si*/ 0, /*ti*/ 1, kTl1Bps - kTl0Bps);
|
||||||
@ -3336,11 +3338,13 @@ TEST_F(VideoStreamEncoderTest, VerifyBitrateAllocationForTwoStreams) {
|
|||||||
|
|
||||||
const int kS0Bps = 150000;
|
const int kS0Bps = 150000;
|
||||||
const int kS0Tl0Bps =
|
const int kS0Tl0Bps =
|
||||||
kS0Bps * webrtc::SimulcastRateAllocator::GetTemporalRateAllocation(
|
kS0Bps *
|
||||||
/*num_layers*/ 2, /*temporal_id*/ 0);
|
webrtc::SimulcastRateAllocator::GetTemporalRateAllocation(
|
||||||
|
/*num_layers*/ 2, /*temporal_id*/ 0, /*base_heavy_tl3_alloc*/ false);
|
||||||
const int kS0Tl1Bps =
|
const int kS0Tl1Bps =
|
||||||
kS0Bps * webrtc::SimulcastRateAllocator::GetTemporalRateAllocation(
|
kS0Bps *
|
||||||
/*num_layers*/ 2, /*temporal_id*/ 1);
|
webrtc::SimulcastRateAllocator::GetTemporalRateAllocation(
|
||||||
|
/*num_layers*/ 2, /*temporal_id*/ 1, /*base_heavy_tl3_alloc*/ false);
|
||||||
const int kS1Bps = kTargetBitrateBps - kS0Tl1Bps;
|
const int kS1Bps = kTargetBitrateBps - kS0Tl1Bps;
|
||||||
// Temporal layers not supported by si:1.
|
// Temporal layers not supported by si:1.
|
||||||
VideoBitrateAllocation expected_bitrate;
|
VideoBitrateAllocation expected_bitrate;
|
||||||
|
Reference in New Issue
Block a user