Add field trial for forcing partition resilience mode in libvpx.
Bug: None Change-Id: I51c90e0eef111f3aee1ef9672b3ace5a62cbdcb4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144626 Commit-Queue: Rasmus Brandt <brandtr@webrtc.org> Reviewed-by: Philip Eliasson <philipel@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28488}
This commit is contained in:
committed by
Commit Bot
parent
3fbf1e2e4a
commit
1efb4a283b
@ -51,6 +51,9 @@ const char kVP8IosMaxNumberOfThreadFieldTrial[] =
|
||||
const char kVP8IosMaxNumberOfThreadFieldTrialParameter[] = "max_thread";
|
||||
#endif
|
||||
|
||||
const char kVp8ForcePartitionResilience[] =
|
||||
"WebRTC-VP8-ForcePartitionResilience";
|
||||
|
||||
// QP is obtained from VP8-bitstream for HW, so the QP corresponds to the
|
||||
// bitstream range of [0, 127] and not the user-level range of [0,63].
|
||||
constexpr int kLowVp8QpThreshold = 29;
|
||||
@ -555,6 +558,17 @@ int LibvpxVp8Encoder::InitEncode(const VideoCodec* inst,
|
||||
? VPX_ERROR_RESILIENT_DEFAULT
|
||||
: 0;
|
||||
|
||||
// Override the error resilience mode if this is not simulcast, but we are
|
||||
// using temporal layers.
|
||||
if (field_trial::IsEnabled(kVp8ForcePartitionResilience) &&
|
||||
(number_of_streams == 1) &&
|
||||
(SimulcastUtility::NumberOfTemporalLayers(*inst, 0) > 1)) {
|
||||
RTC_LOG(LS_INFO) << "Overriding g_error_resilient from "
|
||||
<< vpx_configs_[0].g_error_resilient << " to "
|
||||
<< VPX_ERROR_RESILIENT_PARTITIONS;
|
||||
vpx_configs_[0].g_error_resilient = VPX_ERROR_RESILIENT_PARTITIONS;
|
||||
}
|
||||
|
||||
// rate control settings
|
||||
vpx_configs_[0].rc_dropframe_thresh = FrameDropThreshold(0);
|
||||
vpx_configs_[0].rc_end_usage = VPX_CBR;
|
||||
|
||||
@ -119,6 +119,51 @@ class TestVp8Impl : public VideoCodecUnitTest {
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(TestVp8Impl, ErrorResilienceDisabledForNoTemporalLayers) {
|
||||
codec_settings_.simulcastStream[0].numberOfTemporalLayers = 1;
|
||||
|
||||
auto* const vpx = new NiceMock<MockLibvpxVp8Interface>();
|
||||
LibvpxVp8Encoder encoder((std::unique_ptr<LibvpxInterface>(vpx)));
|
||||
EXPECT_CALL(*vpx,
|
||||
codec_enc_init(
|
||||
_, _, Field(&vpx_codec_enc_cfg_t::g_error_resilient, 0), _));
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
encoder.InitEncode(&codec_settings_, kSettings));
|
||||
}
|
||||
|
||||
TEST_F(TestVp8Impl, DefaultErrorResilienceEnabledForTemporalLayers) {
|
||||
codec_settings_.simulcastStream[0].numberOfTemporalLayers = 2;
|
||||
codec_settings_.VP8()->numberOfTemporalLayers = 2;
|
||||
|
||||
auto* const vpx = new NiceMock<MockLibvpxVp8Interface>();
|
||||
LibvpxVp8Encoder encoder((std::unique_ptr<LibvpxInterface>(vpx)));
|
||||
EXPECT_CALL(*vpx,
|
||||
codec_enc_init(_, _,
|
||||
Field(&vpx_codec_enc_cfg_t::g_error_resilient,
|
||||
VPX_ERROR_RESILIENT_DEFAULT),
|
||||
_));
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
encoder.InitEncode(&codec_settings_, kSettings));
|
||||
}
|
||||
|
||||
TEST_F(TestVp8Impl,
|
||||
PartitionErrorResilienceEnabledForTemporalLayersWithFieldTrial) {
|
||||
test::ScopedFieldTrials field_trials(
|
||||
"WebRTC-VP8-ForcePartitionResilience/Enabled/");
|
||||
codec_settings_.simulcastStream[0].numberOfTemporalLayers = 2;
|
||||
codec_settings_.VP8()->numberOfTemporalLayers = 2;
|
||||
|
||||
auto* const vpx = new NiceMock<MockLibvpxVp8Interface>();
|
||||
LibvpxVp8Encoder encoder((std::unique_ptr<LibvpxInterface>(vpx)));
|
||||
EXPECT_CALL(*vpx,
|
||||
codec_enc_init(_, _,
|
||||
Field(&vpx_codec_enc_cfg_t::g_error_resilient,
|
||||
VPX_ERROR_RESILIENT_PARTITIONS),
|
||||
_));
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
encoder.InitEncode(&codec_settings_, kSettings));
|
||||
}
|
||||
|
||||
TEST_F(TestVp8Impl, SetRates) {
|
||||
auto* const vpx = new NiceMock<MockLibvpxVp8Interface>();
|
||||
LibvpxVp8Encoder encoder((std::unique_ptr<LibvpxInterface>(vpx)));
|
||||
|
||||
Reference in New Issue
Block a user