[Adaptation] Remove QualityScalerResource when disabled.
Bug: webrtc:11843 Change-Id: I2d3e40356c266f189db0242f3c7590e6d83e4456 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181369 Commit-Queue: Evan Shrubsole <eshr@google.com> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31924}
This commit is contained in:
committed by
Commit Bot
parent
2534e2cbf3
commit
ba8abbb630
@ -4211,6 +4211,55 @@ TEST_F(VideoStreamEncoderTest, RampsUpInQualityWhenBwIsHigh) {
|
||||
video_stream_encoder_->Stop();
|
||||
}
|
||||
|
||||
TEST_F(VideoStreamEncoderTest,
|
||||
QualityScalerAdaptationsRemovedWhenQualityScalingDisabled) {
|
||||
AdaptingFrameForwarder source;
|
||||
source.set_adaptation_enabled(true);
|
||||
video_stream_encoder_->SetSource(&source,
|
||||
DegradationPreference::MAINTAIN_FRAMERATE);
|
||||
video_stream_encoder_->OnBitrateUpdatedAndWaitForManagedResources(
|
||||
DataRate::BitsPerSec(kTargetBitrateBps),
|
||||
DataRate::BitsPerSec(kTargetBitrateBps),
|
||||
DataRate::BitsPerSec(kTargetBitrateBps), 0, 0, 0);
|
||||
fake_encoder_.SetQp(kQpHigh + 1);
|
||||
const int kWidth = 1280;
|
||||
const int kHeight = 720;
|
||||
const int64_t kFrameIntervalMs = 100;
|
||||
int64_t timestamp_ms = kFrameIntervalMs;
|
||||
for (size_t i = 1; i <= 100; i++) {
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
}
|
||||
// Wait for QualityScaler, which will wait for 2000*2.5 ms until checking QP
|
||||
// for the first time.
|
||||
// TODO(eshr): We should avoid these waits by using threads with simulated
|
||||
// time.
|
||||
EXPECT_TRUE_WAIT(stats_proxy_->GetStats().bw_limited_resolution,
|
||||
2000 * 2.5 * 2);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
video_stream_encoder_->WaitUntilTaskQueueIsIdle();
|
||||
video_stream_encoder_->WaitUntilAdaptationTaskQueueIsIdle();
|
||||
EXPECT_THAT(source.sink_wants(), WantsMaxPixels(Lt(kWidth * kHeight)));
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
|
||||
// Disable Quality scaling by turning off scaler on the encoder and
|
||||
// reconfiguring.
|
||||
fake_encoder_.SetQualityScaling(false);
|
||||
video_stream_encoder_->ConfigureEncoder(video_encoder_config_.Copy(),
|
||||
kMaxPayloadLength);
|
||||
video_stream_encoder_->WaitUntilTaskQueueIsIdle();
|
||||
video_stream_encoder_->WaitUntilAdaptationTaskQueueIsIdle();
|
||||
// Since we turned off the quality scaler, the adaptations made by it are
|
||||
// removed.
|
||||
EXPECT_THAT(source.sink_wants(), ResolutionMax());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
|
||||
video_stream_encoder_->Stop();
|
||||
}
|
||||
|
||||
TEST_F(VideoStreamEncoderTest,
|
||||
ResolutionNotAdaptedForTooSmallFrame_MaintainFramerateMode) {
|
||||
const int kTooSmallWidth = 10;
|
||||
|
||||
Reference in New Issue
Block a user