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
@ -44,14 +44,15 @@ const uint32_t kLegacyScreenshareTl0BitrateKbps = 200;
|
||||
const uint32_t kLegacyScreenshareTl1BitrateKbps = 1000;
|
||||
} // namespace
|
||||
|
||||
float SimulcastRateAllocator::GetTemporalRateAllocation(int num_layers,
|
||||
int temporal_id) {
|
||||
float SimulcastRateAllocator::GetTemporalRateAllocation(
|
||||
int num_layers,
|
||||
int temporal_id,
|
||||
bool base_heavy_tl3_alloc) {
|
||||
RTC_CHECK_GT(num_layers, 0);
|
||||
RTC_CHECK_LE(num_layers, kMaxTemporalStreams);
|
||||
RTC_CHECK_GE(temporal_id, 0);
|
||||
RTC_CHECK_LT(temporal_id, num_layers);
|
||||
if (num_layers == 3 &&
|
||||
field_trial::IsEnabled("WebRTC-UseBaseHeavyVP8TL3RateAllocation")) {
|
||||
if (num_layers == 3 && base_heavy_tl3_alloc) {
|
||||
return kBaseHeavy3TlRateAllocation[temporal_id];
|
||||
}
|
||||
return kLayerRateAllocation[num_layers - 1][temporal_id];
|
||||
@ -59,8 +60,8 @@ float SimulcastRateAllocator::GetTemporalRateAllocation(int num_layers,
|
||||
|
||||
SimulcastRateAllocator::SimulcastRateAllocator(const VideoCodec& codec)
|
||||
: codec_(codec),
|
||||
stable_rate_settings_(
|
||||
StableTargetRateExperiment::ParseFromFieldTrials()) {}
|
||||
stable_rate_settings_(StableTargetRateExperiment::ParseFromFieldTrials()),
|
||||
rate_control_settings_(RateControlSettings::ParseFromFieldTrials()) {}
|
||||
|
||||
SimulcastRateAllocator::~SimulcastRateAllocator() = default;
|
||||
|
||||
@ -283,7 +284,10 @@ std::vector<uint32_t> SimulcastRateAllocator::DefaultTemporalLayerAllocation(
|
||||
std::vector<uint32_t> bitrates;
|
||||
for (size_t i = 0; i < num_temporal_layers; ++i) {
|
||||
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));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user