Only call balanced_settings_.CanAdaptUpResolution if DegradationPreference::BALANCED.

Bug: none
Change-Id: If76a3413bfdf359f79d94691b841d4056d91a80b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/195327
Reviewed-by: Evan Shrubsole <eshr@google.com>
Commit-Queue: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32699}
This commit is contained in:
Åsa Persson 2020-11-25 14:19:35 +01:00 committed by Commit Bot
parent c9a09859fc
commit d174d370fe

View File

@ -39,18 +39,20 @@ bool BalancedConstraint::IsAdaptationUpAllowed(
// Don't adapt if BalancedDegradationSettings applies and determines this will
// exceed bitrate constraints.
if (degradation_preference_provider_->degradation_preference() ==
DegradationPreference::BALANCED &&
!balanced_settings_.CanAdaptUp(input_state.video_codec_type(),
input_state.frame_size_pixels().value(),
encoder_target_bitrate_bps_.value_or(0))) {
return false;
}
if (DidIncreaseResolution(restrictions_before, restrictions_after) &&
!balanced_settings_.CanAdaptUpResolution(
input_state.video_codec_type(),
input_state.frame_size_pixels().value(),
encoder_target_bitrate_bps_.value_or(0))) {
return false;
DegradationPreference::BALANCED) {
if (!balanced_settings_.CanAdaptUp(
input_state.video_codec_type(),
input_state.frame_size_pixels().value(),
encoder_target_bitrate_bps_.value_or(0))) {
return false;
}
if (DidIncreaseResolution(restrictions_before, restrictions_after) &&
!balanced_settings_.CanAdaptUpResolution(
input_state.video_codec_type(),
input_state.frame_size_pixels().value(),
encoder_target_bitrate_bps_.value_or(0))) {
return false;
}
}
return true;
}