Default enable new bitrate adjuster behavior.

Only minor positive changes seen in initial testing. Let's default-
enable and monitor behavior through the normal release cycle.

Bug: b/349561566
Change-Id: Id6b39daa159068bf076acc34888b5d7eaf110329
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/356641
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Auto-Submit: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42607}
This commit is contained in:
Erik Språng 2024-07-08 17:54:13 +02:00 committed by WebRTC LUCI CQ
parent 6502bad4d6
commit 8ac4a464f0
3 changed files with 21 additions and 2 deletions

View File

@ -51,7 +51,7 @@ EncoderBitrateAdjuster::EncoderBitrateAdjuster(
Clock& clock) Clock& clock)
: utilize_bandwidth_headroom_(RateControlSettings(field_trials) : utilize_bandwidth_headroom_(RateControlSettings(field_trials)
.BitrateAdjusterCanUseNetworkHeadroom()), .BitrateAdjusterCanUseNetworkHeadroom()),
use_newfangled_headroom_adjustment_(field_trials.IsEnabled( use_newfangled_headroom_adjustment_(!field_trials.IsDisabled(
"WebRTC-BitrateAdjusterUseNewfangledHeadroomAdjustment")), "WebRTC-BitrateAdjusterUseNewfangledHeadroomAdjustment")),
frames_since_layout_change_(0), frames_since_layout_change_(0),
min_bitrates_bps_{}, min_bitrates_bps_{},

View File

@ -91,7 +91,9 @@ absl::optional<double> RateUtilizationTracker::GetRateUtilizationFactor(
if (update.produced_data.IsZero()) { if (update.produced_data.IsZero()) {
// Just a rate update past the last seen produced data. // Just a rate update past the last seen produced data.
data_allocated_for_last_data += allocated_since_previous_data_point; data_allocated_for_last_data =
std::min(size_of_last_data, data_allocated_for_last_data +
allocated_since_previous_data_point);
} else { } else {
// A newer data point with produced data, reset accumulator for rate // A newer data point with produced data, reset accumulator for rate
// allocated past the last data point. // allocated past the last data point.

View File

@ -248,5 +248,22 @@ TEST(RateUtilizationTrackerTest, EqualTimestampsTreatedAtSameDataPoint) {
PrettyCloseTo(3.0 / 4.0)); PrettyCloseTo(3.0 / 4.0));
} }
TEST(RateUtilizationTrackerTest, FullRateAfterLastDataPoint) {
RateUtilizationTracker tracker(kDefaultMaxDataPoints, kDefaultTimeWindow);
constexpr TimeDelta kFrameInterval = TimeDelta::Seconds(1) / 33;
constexpr DataRate kTargetRate = DataRate::KilobitsPerSec(100);
constexpr DataSize kIdealFrameSize = kTargetRate * kFrameInterval;
tracker.OnDataRateChanged(kTargetRate, kStartTime);
tracker.OnDataProduced(kIdealFrameSize, kStartTime);
// New rate update, but accumulated rate for last data point fully saturated
// by next to last rate update.
tracker.OnDataRateChanged(kTargetRate, kStartTime + kFrameInterval * 2);
EXPECT_THAT(tracker.GetRateUtilizationFactor(kStartTime + kFrameInterval * 3),
PrettyCloseTo(1.0 / 3.0));
}
} // namespace } // namespace
} // namespace webrtc } // namespace webrtc