[Adaptation] Make QuailtyScalerResourse to report underuse if quality scaling is off
Bug: chromium:1080789 Change-Id: I3aefb746fd6f4adae4b32db322af6b787e8ede1d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174804 Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Evan Shrubsole <eshr@google.com> Cr-Commit-Position: refs/heads/master@{#31213}
This commit is contained in:
parent
a270250426
commit
8e321cd690
@ -325,4 +325,26 @@ TEST_F(ResourceAdaptationProcessorTest,
|
||||
EXPECT_FALSE(resource_.usage_state().has_value());
|
||||
}
|
||||
|
||||
TEST_F(ResourceAdaptationProcessorTest,
|
||||
AdaptsDownWhenOtherResourceIsAlwaysUnderused) {
|
||||
processor_.SetDegradationPreference(
|
||||
DegradationPreference::MAINTAIN_FRAMERATE);
|
||||
processor_.StartResourceAdaptation();
|
||||
SetInputStates(true, kDefaultFrameRate, kDefaultFrameSize);
|
||||
other_resource_.set_usage_state(ResourceUsageState::kUnderuse);
|
||||
// Does not trigger adapataion because there's no restriction.
|
||||
EXPECT_EQ(0, processor_listener_.adaptation_counters().Total());
|
||||
|
||||
RestrictSource(processor_listener_.restrictions());
|
||||
resource_.set_usage_state(ResourceUsageState::kOveruse);
|
||||
// Adapts down even if other resource asked for adapting up.
|
||||
EXPECT_EQ(1, processor_listener_.adaptation_counters().Total());
|
||||
|
||||
RestrictSource(processor_listener_.restrictions());
|
||||
other_resource_.set_usage_state(ResourceUsageState::kUnderuse);
|
||||
// Doesn't adapt up because adaptation is due to another resource.
|
||||
EXPECT_EQ(1, processor_listener_.adaptation_counters().Total());
|
||||
RestrictSource(processor_listener_.restrictions());
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -50,8 +50,16 @@ bool QualityScalerResource::QpFastFilterLow() {
|
||||
|
||||
void QualityScalerResource::OnEncodeCompleted(const EncodedImage& encoded_image,
|
||||
int64_t time_sent_in_us) {
|
||||
if (quality_scaler_ && encoded_image.qp_ >= 0)
|
||||
if (quality_scaler_ && encoded_image.qp_ >= 0) {
|
||||
quality_scaler_->ReportQp(encoded_image.qp_, time_sent_in_us);
|
||||
} else if (!quality_scaler_) {
|
||||
// TODO(webrtc:11553): this is a workaround to ensure that all quality
|
||||
// scaler imposed limitations are removed once qualty scaler is disabled
|
||||
// mid call.
|
||||
// Instead it should be done at a higher layer in the same way for all
|
||||
// resources.
|
||||
OnResourceUsageStateMeasured(ResourceUsageState::kUnderuse);
|
||||
}
|
||||
}
|
||||
|
||||
void QualityScalerResource::OnFrameDropped(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user