Allow temporal based switch if temporal layers are undefined.
Bug: webrtc:11324 Change-Id: Iee4717f453bb9883683d752832fbc7bf999a96c2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/193704 Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32630}
This commit is contained in:
parent
1bed90b80e
commit
a9961b3839
@ -853,11 +853,15 @@ class PreferTemporalLayersFallbackTest : public ::testing::Test {
|
||||
|
||||
protected:
|
||||
void SetSupportsLayers(VideoEncoder::EncoderInfo* info, bool tl_enabled) {
|
||||
info->fps_allocation[0].clear();
|
||||
int num_layers = 1;
|
||||
if (tl_enabled) {
|
||||
num_layers = codec_settings.VP8()->numberOfTemporalLayers;
|
||||
}
|
||||
SetNumLayers(info, num_layers);
|
||||
}
|
||||
|
||||
void SetNumLayers(VideoEncoder::EncoderInfo* info, int num_layers) {
|
||||
info->fps_allocation[0].clear();
|
||||
for (int i = 0; i < num_layers; ++i) {
|
||||
info->fps_allocation[0].push_back(
|
||||
VideoEncoder::EncoderInfo::kMaxFramerateFraction >>
|
||||
@ -910,6 +914,15 @@ TEST_F(PreferTemporalLayersFallbackTest, UsesMainWhenNeitherSupportsTemporal) {
|
||||
EXPECT_EQ(wrapper_->GetEncoderInfo().implementation_name, "hw");
|
||||
}
|
||||
|
||||
TEST_F(PreferTemporalLayersFallbackTest, UsesFallbackWhenLayersAreUndefined) {
|
||||
codec_settings.VP8()->numberOfTemporalLayers = 2;
|
||||
SetNumLayers(&hw_info_, 1);
|
||||
SetNumLayers(&sw_info_, 0);
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
wrapper_->InitEncode(&codec_settings, kSettings));
|
||||
EXPECT_EQ(wrapper_->GetEncoderInfo().implementation_name, "sw");
|
||||
}
|
||||
|
||||
TEST_F(PreferTemporalLayersFallbackTest, PrimesEncoderOnSwitch) {
|
||||
codec_settings.VP8()->numberOfTemporalLayers = 2;
|
||||
// Both support temporal layers, will use main one.
|
||||
|
||||
@ -56,7 +56,7 @@ struct ForcedFallbackParams {
|
||||
|
||||
bool SupportsTemporalBasedSwitch(const VideoCodec& codec) const {
|
||||
return enable_temporal_based_switch &&
|
||||
SimulcastUtility::NumberOfTemporalLayers(codec, 0) > 1;
|
||||
SimulcastUtility::NumberOfTemporalLayers(codec, 0) != 1;
|
||||
}
|
||||
|
||||
bool enable_temporal_based_switch = false;
|
||||
@ -462,7 +462,7 @@ bool VideoEncoderSoftwareFallbackWrapper::TryInitForcedFallbackEncoder() {
|
||||
}
|
||||
|
||||
if (encoder_state_ == EncoderState::kMainEncoderUsed &&
|
||||
encoder_->GetEncoderInfo().fps_allocation[0].size() > 1) {
|
||||
encoder_->GetEncoderInfo().fps_allocation[0].size() != 1) {
|
||||
// Primary encoder already supports temporal layers, use that instead.
|
||||
return true;
|
||||
}
|
||||
@ -471,7 +471,7 @@ bool VideoEncoderSoftwareFallbackWrapper::TryInitForcedFallbackEncoder() {
|
||||
if (fallback_encoder_->InitEncode(&codec_settings_,
|
||||
encoder_settings_.value()) ==
|
||||
WEBRTC_VIDEO_CODEC_OK) {
|
||||
if (fallback_encoder_->GetEncoderInfo().fps_allocation[0].size() > 1) {
|
||||
if (fallback_encoder_->GetEncoderInfo().fps_allocation[0].size() != 1) {
|
||||
// Fallback encoder available and supports temporal layers, use it!
|
||||
if (encoder_state_ == EncoderState::kMainEncoderUsed) {
|
||||
// Main encoder initialized but does not support temporal layers,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user