Implement encoder overshoot detector and rate adjuster.

The overshoot detector uses a simple pacer model to determine an
estimate of how much the encoder is overusing the target bitrate.
This utilization factor can then be adjuster for when configuring the
actual target bitrate.

Spatial layers (simulcast streams) are adjusted separately.
Temporal layers are measured separately, but are combined into a single
utilization factor per spatial layer.

Bug: webrtc:10155
Change-Id: I8ea58dc6c4871e880553d7c22202f11cb2feb216
Reviewed-on: https://webrtc-review.googlesource.com/c/114886
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26573}
This commit is contained in:
Erik Språng
2019-02-06 16:20:17 +01:00
committed by Commit Bot
parent e98954c35e
commit 7ca375c8ca
15 changed files with 1178 additions and 52 deletions

View File

@ -25,6 +25,7 @@
#include "rtc_base/fake_clock.h"
#include "rtc_base/logging.h"
#include "rtc_base/ref_counted_object.h"
#include "system_wrappers/include/field_trial.h"
#include "system_wrappers/include/metrics.h"
#include "system_wrappers/include/sleep.h"
#include "test/encoder_settings.h"
@ -3300,7 +3301,13 @@ TEST_F(VideoStreamEncoderTest, DropsFramesWhenEncoderOvershoots) {
// Make encoder produce frames at double the expected bitrate during 3 seconds
// of video, verify number of drops. Rate needs to be slightly changed in
// order to force the rate to be reconfigured.
fake_encoder_.SimulateOvershoot(2.0);
double overshoot_factor = 2.0;
if (RateControlSettings::ParseFromFieldTrials().UseEncoderBitrateAdjuster()) {
// With bitrate adjuster, when need to overshoot even more to trigger
// frame dropping.
overshoot_factor *= 2;
}
fake_encoder_.SimulateOvershoot(overshoot_factor);
video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps + 1000, 0, 0);
num_dropped = 0;
for (int i = 0; i < kNumFramesInRun; ++i) {