Make LAYER_DROP and max_consec_drop=2 to be default settings

Based on the results of the experiment (b/335129329).

Bug: webrtc:15827, b/320629637, b/335129329, chromium:329396373
Change-Id: I1599f4c1be79ee3385aac1ff345168982c8278f8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/360960
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Auto-Submit: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42895}
This commit is contained in:
Sergey Silkin 2024-08-29 09:47:17 +02:00 committed by WebRTC LUCI CQ
parent b5f4006589
commit 058972f84e
4 changed files with 15 additions and 85 deletions

View file

@ -98,9 +98,6 @@ ACTIVE_FIELD_TRIALS: FrozenSet[FieldTrial] = frozenset([
FieldTrial('WebRTC-LibaomAv1Encoder-AdaptiveMaxConsecDrops', FieldTrial('WebRTC-LibaomAv1Encoder-AdaptiveMaxConsecDrops',
351644568, 351644568,
date(2025, 7, 1)), date(2025, 7, 1)),
FieldTrial('WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig',
42226190,
date(2024, 9, 1)),
FieldTrial('WebRTC-LibvpxVp8Encoder-AndroidSpecificThreadingSettings', FieldTrial('WebRTC-LibvpxVp8Encoder-AndroidSpecificThreadingSettings',
42226191, 42226191,
date(2024, 9, 1)), date(2024, 9, 1)),

View file

@ -263,8 +263,7 @@ LibvpxVp9Encoder::LibvpxVp9Encoder(const Environment& env,
performance_flags_(ParsePerformanceFlagsFromTrials(env.field_trials())), performance_flags_(ParsePerformanceFlagsFromTrials(env.field_trials())),
num_steady_state_frames_(0), num_steady_state_frames_(0),
config_changed_(true), config_changed_(true),
encoder_info_override_(env.field_trials()), encoder_info_override_(env.field_trials()) {
svc_frame_drop_config_(ParseSvcFrameDropConfig(env.field_trials())) {
codec_ = {}; codec_ = {};
memset(&svc_params_, 0, sizeof(vpx_svc_extra_cfg_t)); memset(&svc_params_, 0, sizeof(vpx_svc_extra_cfg_t));
} }
@ -845,8 +844,7 @@ int LibvpxVp9Encoder::InitAndSetControlSettings(const VideoCodec* inst) {
memset(&svc_drop_frame_, 0, sizeof(svc_drop_frame_)); memset(&svc_drop_frame_, 0, sizeof(svc_drop_frame_));
const bool reverse_constrained_drop_mode = const bool reverse_constrained_drop_mode =
inter_layer_pred_ == InterLayerPredMode::kOn && inter_layer_pred_ == InterLayerPredMode::kOn &&
codec_.mode == VideoCodecMode::kScreensharing && codec_.mode == VideoCodecMode::kScreensharing;
num_spatial_layers_ > 1;
if (reverse_constrained_drop_mode) { if (reverse_constrained_drop_mode) {
// Screenshare dropping mode: drop a layer only together with all lower // Screenshare dropping mode: drop a layer only together with all lower
// layers. This ensures that drops on lower layers won't reduce frame-rate // layers. This ensures that drops on lower layers won't reduce frame-rate
@ -857,9 +855,7 @@ int LibvpxVp9Encoder::InitAndSetControlSettings(const VideoCodec* inst) {
svc_drop_frame_.framedrop_thresh[i] = config_->rc_dropframe_thresh; svc_drop_frame_.framedrop_thresh[i] = config_->rc_dropframe_thresh;
} }
} else { } else {
if (svc_frame_drop_config_.enabled && if (is_flexible_mode_ && svc_controller_ &&
svc_frame_drop_config_.layer_drop_mode == LAYER_DROP &&
is_flexible_mode_ && svc_controller_ &&
(inter_layer_pred_ == InterLayerPredMode::kOff || (inter_layer_pred_ == InterLayerPredMode::kOff ||
inter_layer_pred_ == InterLayerPredMode::kOnKeyPic)) { inter_layer_pred_ == InterLayerPredMode::kOnKeyPic)) {
// SVC controller is required since it properly accounts for dropped // SVC controller is required since it properly accounts for dropped
@ -871,10 +867,7 @@ int LibvpxVp9Encoder::InitAndSetControlSettings(const VideoCodec* inst) {
// quality flickering and is not compatible with RTP non-flexible mode. // quality flickering and is not compatible with RTP non-flexible mode.
svc_drop_frame_.framedrop_mode = FULL_SUPERFRAME_DROP; svc_drop_frame_.framedrop_mode = FULL_SUPERFRAME_DROP;
} }
svc_drop_frame_.max_consec_drop = svc_drop_frame_.max_consec_drop = 2;
svc_frame_drop_config_.enabled
? svc_frame_drop_config_.max_consec_drop
: std::numeric_limits<int>::max();
for (size_t i = 0; i < num_spatial_layers_; ++i) { for (size_t i = 0; i < num_spatial_layers_; ++i) {
svc_drop_frame_.framedrop_thresh[i] = config_->rc_dropframe_thresh; svc_drop_frame_.framedrop_thresh[i] = config_->rc_dropframe_thresh;
} }
@ -1846,26 +1839,6 @@ LibvpxVp9Encoder::ParseQualityScalerConfig(const FieldTrialsView& trials) {
return config; return config;
} }
LibvpxVp9Encoder::SvcFrameDropConfig LibvpxVp9Encoder::ParseSvcFrameDropConfig(
const FieldTrialsView& trials) {
FieldTrialFlag enabled = FieldTrialFlag("Enabled");
FieldTrialParameter<int> layer_drop_mode("layer_drop_mode",
FULL_SUPERFRAME_DROP);
FieldTrialParameter<int> max_consec_drop("max_consec_drop",
std::numeric_limits<int>::max());
ParseFieldTrial({&enabled, &layer_drop_mode, &max_consec_drop},
trials.Lookup("WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig"));
SvcFrameDropConfig config;
config.enabled = enabled.Get();
config.layer_drop_mode = layer_drop_mode.Get();
config.max_consec_drop = max_consec_drop.Get();
RTC_LOG(LS_INFO) << "Libvpx VP9 encoder SVC frame drop config: "
<< (config.enabled ? "enabled" : "disabled")
<< " layer_drop_mode " << config.layer_drop_mode
<< " max_consec_drop " << config.max_consec_drop;
return config;
}
void LibvpxVp9Encoder::UpdatePerformanceFlags() { void LibvpxVp9Encoder::UpdatePerformanceFlags() {
flat_map<int, PerformanceFlags::ParameterSet> params_by_resolution; flat_map<int, PerformanceFlags::ParameterSet> params_by_resolution;
if (codec_.GetVideoEncoderComplexity() == if (codec_.GetVideoEncoderComplexity() ==

View file

@ -222,14 +222,6 @@ class LibvpxVp9Encoder : public VideoEncoder {
bool config_changed_; bool config_changed_;
const LibvpxVp9EncoderInfoSettings encoder_info_override_; const LibvpxVp9EncoderInfoSettings encoder_info_override_;
const struct SvcFrameDropConfig {
bool enabled;
int layer_drop_mode; // SVC_LAYER_DROP_MODE
int max_consec_drop;
} svc_frame_drop_config_;
static SvcFrameDropConfig ParseSvcFrameDropConfig(
const FieldTrialsView& trials);
}; };
} // namespace webrtc } // namespace webrtc

View file

@ -2480,68 +2480,36 @@ INSTANTIATE_TEST_SUITE_P(
All, All,
TestVp9ImplSvcFrameDropConfig, TestVp9ImplSvcFrameDropConfig,
::testing::Values( ::testing::Values(
// Flexible mode is disabled. Layer drop is not allowed. Ignore // Flexible mode is disabled, KSVC. Layer drop is not allowed.
// layer_drop_mode from field trial.
SvcFrameDropConfigTestParameters{ SvcFrameDropConfigTestParameters{
.flexible_mode = false, .flexible_mode = false,
.scalability_mode = ScalabilityMode::kL3T3_KEY, .scalability_mode = ScalabilityMode::kL3T3_KEY,
.field_trial = "WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig/"
"Enabled,layer_drop_mode:1,max_consec_drop:7/",
.expected_framedrop_mode = FULL_SUPERFRAME_DROP, .expected_framedrop_mode = FULL_SUPERFRAME_DROP,
.expected_max_consec_drop = 7}, .expected_max_consec_drop = 2},
// Flexible mode is enabled but the field trial is not set. Use default // Flexible mode is enabled, KSVC. Layer drop is enabled.
// settings.
SvcFrameDropConfigTestParameters{ SvcFrameDropConfigTestParameters{
.flexible_mode = true, .flexible_mode = true,
.scalability_mode = ScalabilityMode::kL3T3_KEY, .scalability_mode = ScalabilityMode::kL3T3_KEY,
.field_trial = "",
.expected_framedrop_mode = FULL_SUPERFRAME_DROP,
.expected_max_consec_drop = std::numeric_limits<int>::max()},
// Flexible mode is enabled but the field trial is disabled. Use default
// settings.
SvcFrameDropConfigTestParameters{
.flexible_mode = true,
.scalability_mode = ScalabilityMode::kL3T3_KEY,
.field_trial = "WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig/"
"Disabled,layer_drop_mode:1,max_consec_drop:7/",
.expected_framedrop_mode = FULL_SUPERFRAME_DROP,
.expected_max_consec_drop = std::numeric_limits<int>::max()},
// Flexible mode is enabled, layer drop is enabled, KSVC. Apply config
// from field trial.
SvcFrameDropConfigTestParameters{
.flexible_mode = true,
.scalability_mode = ScalabilityMode::kL3T3_KEY,
.field_trial = "WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig/"
"Enabled,layer_drop_mode:1,max_consec_drop:7/",
.expected_framedrop_mode = LAYER_DROP, .expected_framedrop_mode = LAYER_DROP,
.expected_max_consec_drop = 7}, .expected_max_consec_drop = 2},
// Flexible mode is enabled, layer drop is enabled, simulcast. Apply // Flexible mode is enabled, simulcast. Layer drop is enabled.
// config from field trial.
SvcFrameDropConfigTestParameters{ SvcFrameDropConfigTestParameters{
.flexible_mode = true, .flexible_mode = true,
.scalability_mode = ScalabilityMode::kS3T3, .scalability_mode = ScalabilityMode::kS3T3,
.field_trial = "WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig/"
"Enabled,layer_drop_mode:1,max_consec_drop:7/",
.expected_framedrop_mode = LAYER_DROP, .expected_framedrop_mode = LAYER_DROP,
.expected_max_consec_drop = 7}, .expected_max_consec_drop = 2},
// Flexible mode is enabled, layer drop is enabled, full SVC. Apply // Flexible mode is enabled, full SVC. Layer drop is not allowed.
// config from field trial.
SvcFrameDropConfigTestParameters{ SvcFrameDropConfigTestParameters{
.flexible_mode = false, .flexible_mode = false,
.scalability_mode = ScalabilityMode::kL3T3, .scalability_mode = ScalabilityMode::kL3T3,
.field_trial = "WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig/"
"Enabled,layer_drop_mode:1,max_consec_drop:7/",
.expected_framedrop_mode = FULL_SUPERFRAME_DROP, .expected_framedrop_mode = FULL_SUPERFRAME_DROP,
.expected_max_consec_drop = 7}, .expected_max_consec_drop = 2},
// Flexible mode is enabled, layer-drop is enabled, scalability mode is // Flexible mode is enabled, scalability mode is not set (i.e., SVC
// not set (i.e., SVC controller is not enabled). Ignore layer_drop_mode // controller is not enabled). Layer drop is not allowed.
// from field trial.
SvcFrameDropConfigTestParameters{ SvcFrameDropConfigTestParameters{
.flexible_mode = true, .flexible_mode = true,
.scalability_mode = absl::nullopt, .scalability_mode = absl::nullopt,
.field_trial = "WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig/"
"Enabled,layer_drop_mode:1,max_consec_drop:7/",
.expected_framedrop_mode = FULL_SUPERFRAME_DROP, .expected_framedrop_mode = FULL_SUPERFRAME_DROP,
.expected_max_consec_drop = 7})); .expected_max_consec_drop = 2}));
} // namespace webrtc } // namespace webrtc