Add rtt_mult_experiment to evaluate video robustness vs. latency

Bug: webrtc:9670
Change-Id: Idb4ca130bfa652b2d0bddb5bee9ed8e34c97150a
Reviewed-on: https://webrtc-review.googlesource.com/96060
Commit-Queue: Michael Horowitz <mhoro@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24457}
This commit is contained in:
“Michael 2018-08-27 10:08:58 -05:00 committed by Commit Bot
parent 8227659075
commit f9fc171568
7 changed files with 147 additions and 1 deletions

View File

@ -25,6 +25,7 @@ rtc_static_library("encoded_frame") {
"../../rtc_base:checks",
"../../rtc_base:rtc_base_approved",
"../../rtc_base/experiments:alr_experiment",
"../../rtc_base/experiments:rtt_mult_experiment",
"../../system_wrappers:field_trial_api",
"../../system_wrappers:system_wrappers",
"//third_party/abseil-cpp/absl/types:optional",
@ -169,6 +170,7 @@ rtc_static_library("video_coding") {
"../../rtc_base:rtc_task_queue",
"../../rtc_base:sequenced_task_checker",
"../../rtc_base/experiments:alr_experiment",
"../../rtc_base/experiments:rtt_mult_experiment",
"../../rtc_base/system:fallthrough",
"../../rtc_base/third_party/base64",
"../../rtc_base/time:timestamp_extrapolator",

View File

@ -153,10 +153,14 @@ FrameBuffer::ReturnReason FrameBuffer::NextFrame(
}
float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0;
if (RttMultExperiment::RttMultEnabled()) {
rtt_mult = RttMultExperiment::GetRttMultValue();
}
timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult));
timing_->UpdateCurrentDelay(frame->RenderTime(), now_ms);
} else {
if (webrtc::field_trial::IsEnabled("WebRTC-AddRttToPlayoutDelay"))
if (RttMultExperiment::RttMultEnabled() ||
webrtc::field_trial::IsEnabled("WebRTC-AddRttToPlayoutDelay"))
jitter_estimator_->FrameNacked();
}

View File

@ -22,6 +22,7 @@
#include "rtc_base/constructormagic.h"
#include "rtc_base/criticalsection.h"
#include "rtc_base/event.h"
#include "rtc_base/experiments/rtt_mult_experiment.h"
#include "rtc_base/numerics/sequence_number_util.h"
#include "rtc_base/thread_annotations.h"

View File

@ -63,6 +63,17 @@ rtc_static_library("quality_scaling_experiment") {
]
}
rtc_static_library("rtt_mult_experiment") {
sources = [
"rtt_mult_experiment.cc",
"rtt_mult_experiment.h",
]
deps = [
"../:rtc_base_approved",
"../../system_wrappers:field_trial_api",
]
}
if (rtc_include_tests) {
rtc_source_set("experiments_unittests") {
testonly = true
@ -72,11 +83,13 @@ if (rtc_include_tests) {
"field_trial_parser_unittest.cc",
"field_trial_units_unittest.cc",
"quality_scaling_experiment_unittest.cc",
"rtt_mult_experiment_unittest.cc",
]
deps = [
":congestion_controller_experiment",
":field_trial_parser",
":quality_scaling_experiment",
":rtt_mult_experiment",
"../:rtc_base_tests_main",
"../:rtc_base_tests_utils",
"../../system_wrappers:field_trial_api",

View File

@ -0,0 +1,49 @@
/*
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/experiments/rtt_mult_experiment.h"
#include <algorithm>
#include <string>
#include "rtc_base/logging.h"
#include "system_wrappers/include/field_trial.h"
namespace webrtc {
namespace {
const char kRttMultExperiment[] = "WebRTC-RttMult";
const float max_rtt_mult_setting = 1.0;
const float min_rtt_mult_setting = 0.0;
} // namespace
bool RttMultExperiment::RttMultEnabled() {
return field_trial::IsEnabled(kRttMultExperiment);
}
float RttMultExperiment::GetRttMultValue() {
const std::string group =
webrtc::field_trial::FindFullName(kRttMultExperiment);
if (group.empty()) {
RTC_LOG(LS_WARNING) << "Could not find rtt_mult_experiment.";
return 0.0;
}
float rtt_mult_setting;
if (sscanf(group.c_str(), "Enabled-%f", &rtt_mult_setting) != 1) {
RTC_LOG(LS_WARNING) << "Invalid number of parameters provided.";
return 0.0;
}
// Bounds check rtt_mult_setting value.
rtt_mult_setting = std::min(rtt_mult_setting, max_rtt_mult_setting);
rtt_mult_setting = std::max(rtt_mult_setting, min_rtt_mult_setting);
return rtt_mult_setting;
}
} // namespace webrtc

View File

@ -0,0 +1,26 @@
/*
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef RTC_BASE_EXPERIMENTS_RTT_MULT_EXPERIMENT_H_
#define RTC_BASE_EXPERIMENTS_RTT_MULT_EXPERIMENT_H_
namespace webrtc {
class RttMultExperiment {
public:
// Returns true if the experiment is enabled.
static bool RttMultEnabled();
// Returns rtt_mult value from field trial.
static float GetRttMultValue();
};
} // namespace webrtc
#endif // RTC_BASE_EXPERIMENTS_RTT_MULT_EXPERIMENT_H_

View File

@ -0,0 +1,51 @@
/*
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/experiments/rtt_mult_experiment.h"
#include "rtc_base/gunit.h"
#include "test/field_trial.h"
namespace webrtc {
TEST(RttMultExperimentTest, RttMultDisabledByDefault) {
EXPECT_FALSE(RttMultExperiment::RttMultEnabled());
}
TEST(RttMultExperimentTest, RttMultEnabledByFieldTrial) {
webrtc::test::ScopedFieldTrials field_trials("WebRTC-RttMult/Enabled-0.25/");
EXPECT_TRUE(RttMultExperiment::RttMultEnabled());
}
TEST(RttMultExperimentTest, RttMultTestValue) {
webrtc::test::ScopedFieldTrials field_trials("WebRTC-RttMult/Enabled-0.25/");
EXPECT_EQ(0.25, RttMultExperiment::GetRttMultValue());
}
TEST(RttMultExperimentTest, RttMultTestMalformedEnabled) {
webrtc::test::ScopedFieldTrials field_trials("WebRTC-RttMult/Enable-0.25/");
EXPECT_FALSE(RttMultExperiment::RttMultEnabled());
}
TEST(RttMultExperimentTest, RttMultTestValueOutOfBoundsPositive) {
webrtc::test::ScopedFieldTrials field_trials("WebRTC-RttMult/Enabled-1.5/");
EXPECT_EQ(1.0, RttMultExperiment::GetRttMultValue());
}
TEST(RttMultExperimentTest, RttMultTestValueOutOfBoundsNegative) {
webrtc::test::ScopedFieldTrials field_trials("WebRTC-RttMult/Enabled--0.5/");
EXPECT_EQ(0.0, RttMultExperiment::GetRttMultValue());
}
TEST(RttMultExperimentTest, RttMultTestMalformedValue) {
webrtc::test::ScopedFieldTrials field_trials("WebRTC-RttMult/Enabled-0.2a5/");
EXPECT_NE(0.25, RttMultExperiment::GetRttMultValue());
}
} // namespace webrtc