Change how alignment requirements are processed

Software fallback wrapper now reports least common multiple of requirements
for two encoders.

SimulcastEncoderAdapter queries actual encoder before InitEncode call
and requests alignment for all layers if simulcast is not supported by
any of the encoders.

Bug: chromium:1084702
Change-Id: Iaed8190737125d447036b6c664b863be72556a5d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225881
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34466}
This commit is contained in:
Ilya Nikolaevskiy
2021-07-13 16:27:11 +02:00
committed by WebRTC LUCI CQ
parent 2c38c9caa4
commit c98aebbbef
4 changed files with 81 additions and 17 deletions

View File

@ -25,6 +25,7 @@
#include "api/video/video_frame.h"
#include "api/video_codecs/video_codec.h"
#include "api/video_codecs/video_encoder.h"
#include "media/base/video_common.h"
#include "modules/video_coding/include/video_error_codes.h"
#include "modules/video_coding/utility/simulcast_utility.h"
#include "rtc_base/checks.h"
@ -417,6 +418,13 @@ VideoEncoder::EncoderInfo VideoEncoderSoftwareFallbackWrapper::GetEncoderInfo()
EncoderInfo info =
IsFallbackActive() ? fallback_encoder_info : default_encoder_info;
info.requested_resolution_alignment = cricket::LeastCommonMultiple(
fallback_encoder_info.requested_resolution_alignment,
default_encoder_info.requested_resolution_alignment);
info.apply_alignment_to_all_simulcast_layers =
fallback_encoder_info.apply_alignment_to_all_simulcast_layers ||
default_encoder_info.apply_alignment_to_all_simulcast_layers;
if (fallback_params_.has_value()) {
const auto settings = (encoder_state_ == EncoderState::kForcedFallback)
? fallback_encoder_info.scaling_settings