WebRTC-DeprecateGlobalFieldTrialString/Enabled/ - part 4/inf
convert almost all of video/ (and the collateral) Bug: webrtc:10335 Change-Id: Ic94e05937f54d11ee8a635b6b66fd146962d9f11 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/254601 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Jonas Oreland <jonaso@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36192}
This commit is contained in:
parent
83240ac0bc
commit
8ca06137dc
@ -766,8 +766,8 @@ TEST_F(CallPerfTest, MAYBE_KeepsHighBitrateWhenReconfiguringSender) {
|
||||
|
||||
// We get lower bitrate than expected by this test if the following field
|
||||
// trial is enabled.
|
||||
test::ScopedFieldTrials field_trials(
|
||||
"WebRTC-SendSideBwe-WithOverhead/Disabled/");
|
||||
test::ScopedKeyValueConfig field_trials(
|
||||
field_trials_, "WebRTC-SendSideBwe-WithOverhead/Disabled/");
|
||||
|
||||
class VideoStreamFactory
|
||||
: public VideoEncoderConfig::VideoStreamFactoryInterface {
|
||||
|
||||
@ -138,7 +138,8 @@ class RtpVideoSenderTestFixture {
|
||||
field_trials ? field_trials : &field_trials_),
|
||||
stats_proxy_(time_controller_.GetClock(),
|
||||
config_,
|
||||
VideoEncoderConfig::ContentType::kRealtimeVideo),
|
||||
VideoEncoderConfig::ContentType::kRealtimeVideo,
|
||||
field_trials ? *field_trials : field_trials_),
|
||||
retransmission_rate_limiter_(time_controller_.GetClock(),
|
||||
kRetransmitWindowSizeMs) {
|
||||
transport_controller_.EnsureStarted();
|
||||
|
||||
@ -525,6 +525,7 @@ if (rtc_include_tests) {
|
||||
"../rtc_base:threading",
|
||||
"../rtc_base/synchronization:mutex",
|
||||
"../rtc_base/third_party/sigslot",
|
||||
"../test:scoped_key_value_config",
|
||||
"../test:test_support",
|
||||
"//testing/gtest",
|
||||
]
|
||||
|
||||
@ -416,17 +416,19 @@ void FakeFlexfecReceiveStream::OnRtpPacket(const webrtc::RtpPacketReceived&) {
|
||||
RTC_DCHECK_NOTREACHED() << "Not implemented.";
|
||||
}
|
||||
|
||||
FakeCall::FakeCall()
|
||||
: FakeCall(rtc::Thread::Current(), rtc::Thread::Current()) {}
|
||||
FakeCall::FakeCall(webrtc::test::ScopedKeyValueConfig* field_trials)
|
||||
: FakeCall(rtc::Thread::Current(), rtc::Thread::Current(), field_trials) {}
|
||||
|
||||
FakeCall::FakeCall(webrtc::TaskQueueBase* worker_thread,
|
||||
webrtc::TaskQueueBase* network_thread)
|
||||
webrtc::TaskQueueBase* network_thread,
|
||||
webrtc::test::ScopedKeyValueConfig* field_trials)
|
||||
: network_thread_(network_thread),
|
||||
worker_thread_(worker_thread),
|
||||
audio_network_state_(webrtc::kNetworkUp),
|
||||
video_network_state_(webrtc::kNetworkUp),
|
||||
num_created_send_streams_(0),
|
||||
num_created_receive_streams_(0) {}
|
||||
num_created_receive_streams_(0),
|
||||
trials_(field_trials ? field_trials : &fallback_trials_) {}
|
||||
|
||||
FakeCall::~FakeCall() {
|
||||
EXPECT_EQ(0u, video_send_streams_.size());
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
#include "call/video_send_stream.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
|
||||
#include "rtc_base/buffer.h"
|
||||
#include "test/scoped_key_value_config.h"
|
||||
|
||||
namespace cricket {
|
||||
class FakeAudioSendStream final : public webrtc::AudioSendStream {
|
||||
@ -313,9 +314,10 @@ class FakeFlexfecReceiveStream final : public webrtc::FlexfecReceiveStream {
|
||||
|
||||
class FakeCall final : public webrtc::Call, public webrtc::PacketReceiver {
|
||||
public:
|
||||
FakeCall();
|
||||
explicit FakeCall(webrtc::test::ScopedKeyValueConfig* field_trials = nullptr);
|
||||
FakeCall(webrtc::TaskQueueBase* worker_thread,
|
||||
webrtc::TaskQueueBase* network_thread);
|
||||
webrtc::TaskQueueBase* network_thread,
|
||||
webrtc::test::ScopedKeyValueConfig* field_trials = nullptr);
|
||||
~FakeCall() override;
|
||||
|
||||
webrtc::MockRtpTransportControllerSend* GetMockTransportControllerSend() {
|
||||
@ -353,6 +355,11 @@ class FakeCall final : public webrtc::Call, public webrtc::PacketReceiver {
|
||||
void SetClientBitratePreferences(
|
||||
const webrtc::BitrateSettings& preferences) override {}
|
||||
|
||||
void SetFieldTrial(const std::string& field_trial_string) {
|
||||
trials_overrides_ = std::make_unique<webrtc::test::ScopedKeyValueConfig>(
|
||||
*trials_, field_trial_string);
|
||||
}
|
||||
|
||||
private:
|
||||
webrtc::AudioSendStream* CreateAudioSendStream(
|
||||
const webrtc::AudioSendStream::Config& config) override;
|
||||
@ -395,7 +402,7 @@ class FakeCall final : public webrtc::Call, public webrtc::PacketReceiver {
|
||||
webrtc::Call::Stats GetStats() const override;
|
||||
|
||||
const webrtc::WebRtcKeyValueConfig& trials() const override {
|
||||
return trials_;
|
||||
return *trials_;
|
||||
}
|
||||
|
||||
webrtc::TaskQueueBase* network_thread() const override;
|
||||
@ -432,7 +439,16 @@ class FakeCall final : public webrtc::Call, public webrtc::PacketReceiver {
|
||||
|
||||
int num_created_send_streams_;
|
||||
int num_created_receive_streams_;
|
||||
webrtc::FieldTrialBasedConfig trials_;
|
||||
|
||||
// The field trials that are in use, either supplied by caller
|
||||
// or pointer to &fallback_trials_.
|
||||
webrtc::test::ScopedKeyValueConfig* trials_;
|
||||
|
||||
// fallback_trials_ is used if caller does not provide any field trials.
|
||||
webrtc::test::ScopedKeyValueConfig fallback_trials_;
|
||||
|
||||
// An extra field trial that can be set using SetFieldTrial.
|
||||
std::unique_ptr<webrtc::test::ScopedKeyValueConfig> trials_overrides_;
|
||||
};
|
||||
|
||||
} // namespace cricket
|
||||
|
||||
@ -1731,6 +1731,7 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
|
||||
|
||||
webrtc::RtcEventLogNull event_log_;
|
||||
webrtc::test::ScopedKeyValueConfig field_trials_;
|
||||
std::unique_ptr<webrtc::test::ScopedKeyValueConfig> override_field_trials_;
|
||||
std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory_;
|
||||
std::unique_ptr<webrtc::Call> call_;
|
||||
std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
|
||||
@ -1785,7 +1786,7 @@ TEST_F(WebRtcVideoChannelBaseTest, OverridesRecvBufferSize) {
|
||||
// Set field trial to override the default recv buffer size, and then re-run
|
||||
// setup where the interface is created and configured.
|
||||
const int kCustomRecvBufferSize = 123456;
|
||||
webrtc::test::ScopedKeyValueConfig override_field_trials(
|
||||
override_field_trials_ = std::make_unique<webrtc::test::ScopedKeyValueConfig>(
|
||||
field_trials_, "WebRTC-IncreasedReceivebuffers/123456/");
|
||||
|
||||
ResetTest();
|
||||
@ -1802,7 +1803,7 @@ TEST_F(WebRtcVideoChannelBaseTest, OverridesRecvBufferSizeWithSuffix) {
|
||||
// Set field trial to override the default recv buffer size, and then re-run
|
||||
// setup where the interface is created and configured.
|
||||
const int kCustomRecvBufferSize = 123456;
|
||||
webrtc::test::ScopedKeyValueConfig override_field_trials(
|
||||
override_field_trials_ = std::make_unique<webrtc::test::ScopedKeyValueConfig>(
|
||||
field_trials_, "WebRTC-IncreasedReceivebuffers/123456_Dogfood/");
|
||||
ResetTest();
|
||||
|
||||
@ -1812,54 +1813,32 @@ TEST_F(WebRtcVideoChannelBaseTest, OverridesRecvBufferSizeWithSuffix) {
|
||||
EXPECT_EQ(kCustomRecvBufferSize, network_interface_.recvbuf_size());
|
||||
}
|
||||
|
||||
class InvalidRecvBufferSizeFieldTrial
|
||||
: public WebRtcVideoChannelBaseTest,
|
||||
public ::testing::WithParamInterface<const char*> {};
|
||||
|
||||
// Test that we properly set the send and recv buffer sizes when overriding
|
||||
// via field trials that don't make any sense.
|
||||
TEST_F(WebRtcVideoChannelBaseTest, InvalidRecvBufferSize) {
|
||||
TEST_P(InvalidRecvBufferSizeFieldTrial, InvalidRecvBufferSize) {
|
||||
// Set bogus field trial values to override the default recv buffer size, and
|
||||
// then re-run setup where the interface is created and configured. The
|
||||
// default value should still be used.
|
||||
override_field_trials_ = std::make_unique<webrtc::test::ScopedKeyValueConfig>(
|
||||
field_trials_,
|
||||
std::string("WebRTC-IncreasedReceivebuffers/") + GetParam() + "/");
|
||||
|
||||
std::string field_trial_string;
|
||||
for (std::string group : {" ", "NotANumber", "-1", "0"}) {
|
||||
std::string trial_string = "WebRTC-IncreasedReceivebuffers/";
|
||||
trial_string += group;
|
||||
trial_string += "/";
|
||||
ResetTest();
|
||||
|
||||
// Dear reader. Sorry for this... it's a bit of a mess.
|
||||
// TODO(bugs.webrtc.org/12854): This test needs to be rewritten to not use
|
||||
// ResetTest and changing global field trials in a loop.
|
||||
TearDown();
|
||||
// This is a hack to appease tsan. Because of the way the test is written
|
||||
// active state within Call, including running task queues may race with
|
||||
// the test changing the global field trial variable.
|
||||
// This particular hack, pauses the transport controller TQ while we
|
||||
// change the field trial.
|
||||
rtc::TaskQueue* tq = call_->GetTransportControllerSend()->GetWorkerQueue();
|
||||
rtc::Event waiting, resume, conclude;
|
||||
tq->PostTask([&waiting, &resume, &conclude]() {
|
||||
waiting.Set();
|
||||
resume.Wait(rtc::Event::kForever);
|
||||
conclude.Set();
|
||||
});
|
||||
|
||||
waiting.Wait(rtc::Event::kForever);
|
||||
webrtc::test::ScopedKeyValueConfig field_trial_override(field_trials_,
|
||||
trial_string);
|
||||
|
||||
SetUp();
|
||||
resume.Set();
|
||||
// Ensure we don't cause a UAF as the test scope exits.
|
||||
conclude.Wait(rtc::Event::kForever);
|
||||
|
||||
// OK, now the test can carry on.
|
||||
|
||||
EXPECT_TRUE(SetOneCodec(DefaultCodec()));
|
||||
EXPECT_TRUE(SetSend(true));
|
||||
EXPECT_EQ(64 * 1024, network_interface_.sendbuf_size());
|
||||
EXPECT_EQ(256 * 1024, network_interface_.recvbuf_size());
|
||||
}
|
||||
EXPECT_TRUE(SetOneCodec(DefaultCodec()));
|
||||
EXPECT_TRUE(SetSend(true));
|
||||
EXPECT_EQ(64 * 1024, network_interface_.sendbuf_size());
|
||||
EXPECT_EQ(256 * 1024, network_interface_.recvbuf_size());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(All,
|
||||
InvalidRecvBufferSizeFieldTrial,
|
||||
Values("NotANumber", "-1", " ", "0"));
|
||||
|
||||
// Test that stats work properly for a 1-1 call.
|
||||
TEST_F(WebRtcVideoChannelBaseTest, GetStats) {
|
||||
const int kDurationSec = 3;
|
||||
@ -2480,7 +2459,7 @@ class WebRtcVideoChannelTest : public WebRtcVideoEngineTest {
|
||||
AddSupportedVideoCodecType("H264");
|
||||
#endif
|
||||
|
||||
fake_call_.reset(new FakeCall());
|
||||
fake_call_.reset(new FakeCall(&field_trials_));
|
||||
channel_.reset(engine_.CreateMediaChannel(
|
||||
fake_call_.get(), GetMediaConfig(), VideoOptions(),
|
||||
webrtc::CryptoOptions(), video_bitrate_allocator_factory_.get()));
|
||||
@ -2494,6 +2473,7 @@ class WebRtcVideoChannelTest : public WebRtcVideoEngineTest {
|
||||
void TearDown() override {
|
||||
channel_->SetInterface(nullptr);
|
||||
channel_ = nullptr;
|
||||
fake_call_ = nullptr;
|
||||
}
|
||||
|
||||
void ResetTest() {
|
||||
@ -2932,8 +2912,8 @@ TEST_F(WebRtcVideoChannelTest, RecvAbsoluteSendTimeHeaderExtensions) {
|
||||
}
|
||||
|
||||
TEST_F(WebRtcVideoChannelTest, FiltersExtensionsPicksTransportSeqNum) {
|
||||
webrtc::test::ScopedFieldTrials override_field_trials(
|
||||
"WebRTC-FilterAbsSendTimeExtension/Enabled/");
|
||||
webrtc::test::ScopedKeyValueConfig override_field_trials(
|
||||
field_trials_, "WebRTC-FilterAbsSendTimeExtension/Enabled/");
|
||||
// Enable three redundant extensions.
|
||||
std::vector<std::string> extensions;
|
||||
extensions.push_back(RtpExtension::kAbsSendTimeUri);
|
||||
@ -7400,8 +7380,8 @@ TEST_F(WebRtcVideoChannelTest,
|
||||
// so that the bottom layer has width and height divisible by 2.
|
||||
// TODO(bugs.webrtc.org/8785): Remove this field trial when we fully trust
|
||||
// the number of simulcast layers set by the app.
|
||||
webrtc::test::ScopedFieldTrials field_trial(
|
||||
"WebRTC-NormalizeSimulcastResolution/Enabled-3/");
|
||||
webrtc::test::ScopedKeyValueConfig field_trial(
|
||||
field_trials_, "WebRTC-NormalizeSimulcastResolution/Enabled-3/");
|
||||
|
||||
// Set up WebRtcVideoChannel for 3-layer VP8 simulcast.
|
||||
VideoSendParameters parameters;
|
||||
@ -7555,8 +7535,8 @@ TEST_F(WebRtcVideoChannelTest,
|
||||
// so that the bottom layer has width and height divisible by 2.
|
||||
// TODO(bugs.webrtc.org/8785): Remove this field trial when we fully trust
|
||||
// the number of simulcast layers set by the app.
|
||||
webrtc::test::ScopedFieldTrials field_trial(
|
||||
"WebRTC-NormalizeSimulcastResolution/Enabled-3/");
|
||||
webrtc::test::ScopedKeyValueConfig field_trial(
|
||||
field_trials_, "WebRTC-NormalizeSimulcastResolution/Enabled-3/");
|
||||
|
||||
// Set up WebRtcVideoChannel for 3-layer H264 simulcast.
|
||||
encoder_factory_->AddSupportedVideoCodecType(kH264CodecName);
|
||||
@ -8830,13 +8810,13 @@ class WebRtcVideoChannelSimulcastTest : public ::testing::Test {
|
||||
return streams[streams.size() - 1];
|
||||
}
|
||||
|
||||
webrtc::test::ScopedKeyValueConfig field_trials_;
|
||||
webrtc::RtcEventLogNull event_log_;
|
||||
FakeCall fake_call_;
|
||||
cricket::FakeWebRtcVideoEncoderFactory* encoder_factory_;
|
||||
cricket::FakeWebRtcVideoDecoderFactory* decoder_factory_;
|
||||
std::unique_ptr<webrtc::MockVideoBitrateAllocatorFactory>
|
||||
mock_rate_allocator_factory_;
|
||||
webrtc::test::ScopedKeyValueConfig field_trials_;
|
||||
WebRtcVideoEngine engine_;
|
||||
std::unique_ptr<VideoMediaChannel> channel_;
|
||||
uint32_t last_ssrc_;
|
||||
|
||||
@ -188,7 +188,7 @@ class WebRtcVoiceEngineTestFake : public ::testing::TestWithParam<bool> {
|
||||
? nullptr
|
||||
: rtc::make_ref_counted<
|
||||
StrictMock<webrtc::test::MockAudioProcessing>>()),
|
||||
call_() {
|
||||
call_(&field_trials_) {
|
||||
// AudioDeviceModule.
|
||||
AdmSetupExpectations(adm_);
|
||||
|
||||
@ -787,6 +787,7 @@ class WebRtcVoiceEngineTestFake : public ::testing::TestWithParam<bool> {
|
||||
|
||||
protected:
|
||||
const bool use_null_apm_;
|
||||
webrtc::test::ScopedKeyValueConfig field_trials_;
|
||||
std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory_;
|
||||
rtc::scoped_refptr<webrtc::test::MockAudioDeviceModule> adm_;
|
||||
rtc::scoped_refptr<StrictMock<webrtc::test::MockAudioProcessing>> apm_;
|
||||
@ -797,7 +798,6 @@ class WebRtcVoiceEngineTestFake : public ::testing::TestWithParam<bool> {
|
||||
cricket::AudioRecvParameters recv_parameters_;
|
||||
FakeAudioSource fake_source_;
|
||||
webrtc::AudioProcessing::Config apm_config_;
|
||||
webrtc::test::ScopedKeyValueConfig field_trials_;
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(TestBothWithAndWithoutNullApm,
|
||||
|
||||
@ -861,6 +861,7 @@ rtc_library("test_common") {
|
||||
":fake_video_codecs",
|
||||
":fileutils",
|
||||
":mock_transport",
|
||||
":scoped_key_value_config",
|
||||
":test_support",
|
||||
":video_test_common",
|
||||
"../api:array_view",
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
#include "api/task_queue/task_queue_factory.h"
|
||||
#include "api/test/video/function_video_decoder_factory.h"
|
||||
#include "api/test/video/function_video_encoder_factory.h"
|
||||
#include "api/transport/field_trial_based_config.h"
|
||||
#include "api/video/video_bitrate_allocator_factory.h"
|
||||
#include "call/call.h"
|
||||
#include "modules/audio_device/include/test_audio_device.h"
|
||||
@ -32,6 +31,7 @@
|
||||
#include "test/frame_generator_capturer.h"
|
||||
#include "test/rtp_rtcp_observer.h"
|
||||
#include "test/run_loop.h"
|
||||
#include "test/scoped_key_value_config.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
@ -180,7 +180,7 @@ class CallTest : public ::testing::Test, public RtpPacketSinkInterface {
|
||||
test::RunLoop loop_;
|
||||
|
||||
Clock* const clock_;
|
||||
const FieldTrialBasedConfig field_trials_;
|
||||
test::ScopedKeyValueConfig field_trials_;
|
||||
|
||||
std::unique_ptr<TaskQueueFactory> task_queue_factory_;
|
||||
std::unique_ptr<webrtc::RtcEventLog> send_event_log_;
|
||||
|
||||
@ -66,8 +66,11 @@ ScopedKeyValueConfig::ScopedKeyValueConfig(ScopedKeyValueConfig* parent,
|
||||
const std::string& s)
|
||||
: parent_(parent), leaf_(nullptr) {
|
||||
InsertIntoMap(key_value_map_, s);
|
||||
// Also store field trials in global string (until we get rid of it).
|
||||
scoped_field_trials_ = std::make_unique<ScopedFieldTrials>(s);
|
||||
|
||||
if (!s.empty()) {
|
||||
// Also store field trials in global string (until we get rid of it).
|
||||
scoped_field_trials_ = std::make_unique<ScopedFieldTrials>(s);
|
||||
}
|
||||
|
||||
if (parent == nullptr) {
|
||||
// We are root, set leaf_.
|
||||
|
||||
@ -171,8 +171,10 @@ rtc_source_set("video_legacy") {
|
||||
"../api:array_view",
|
||||
"../api:scoped_refptr",
|
||||
"../api:sequence_checker",
|
||||
"../api:webrtc_key_value_config",
|
||||
"../api/crypto:frame_decryptor_interface",
|
||||
"../api/task_queue",
|
||||
"../api/transport:field_trial_based_config",
|
||||
"../api/units:timestamp",
|
||||
"../api/video:encoded_image",
|
||||
"../api/video:recordable_encoded_frame",
|
||||
@ -275,6 +277,7 @@ rtc_library("frame_cadence_adapter") {
|
||||
|
||||
deps = [
|
||||
"../api:sequence_checker",
|
||||
"../api:webrtc_key_value_config",
|
||||
"../api/task_queue",
|
||||
"../api/units:time_delta",
|
||||
"../api/video:video_frame",
|
||||
@ -307,6 +310,7 @@ rtc_library("frame_buffer_proxy") {
|
||||
":task_queue_frame_decode_scheduler",
|
||||
":video_receive_stream_timeout_tracker",
|
||||
"../api:sequence_checker",
|
||||
"../api:webrtc_key_value_config",
|
||||
"../api/metronome",
|
||||
"../api/task_queue",
|
||||
"../api/units:data_size",
|
||||
@ -952,6 +956,7 @@ if (rtc_include_tests) {
|
||||
"../test:field_trial",
|
||||
"../test:mock_frame_transformer",
|
||||
"../test:mock_transport",
|
||||
"../test:scoped_key_value_config",
|
||||
"../test:test_support",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
|
||||
@ -33,7 +33,6 @@
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
#include "rtc_base/trace_event.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "video/adaptation/quality_scaler_resource.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -268,7 +267,8 @@ VideoStreamEncoderResourceManager::VideoStreamEncoderResourceManager(
|
||||
std::unique_ptr<OveruseFrameDetector> overuse_detector,
|
||||
DegradationPreferenceProvider* degradation_preference_provider,
|
||||
const WebRtcKeyValueConfig& field_trials)
|
||||
: degradation_preference_provider_(degradation_preference_provider),
|
||||
: field_trials_(field_trials),
|
||||
degradation_preference_provider_(degradation_preference_provider),
|
||||
bitrate_constraint_(std::make_unique<BitrateConstraint>()),
|
||||
balanced_constraint_(
|
||||
std::make_unique<BalancedConstraint>(degradation_preference_provider_,
|
||||
@ -292,7 +292,7 @@ VideoStreamEncoderResourceManager::VideoStreamEncoderResourceManager(
|
||||
std::make_unique<InitialFrameDropper>(quality_scaler_resource_)),
|
||||
quality_scaling_experiment_enabled_(QualityScalingExperiment::Enabled()),
|
||||
pixel_limit_resource_experiment_enabled_(
|
||||
field_trial::IsEnabled(kPixelLimitResourceFieldTrialName)),
|
||||
field_trials.IsEnabled(kPixelLimitResourceFieldTrialName)),
|
||||
encoder_target_bitrate_bps_(absl::nullopt),
|
||||
quality_rampup_experiment_(
|
||||
QualityRampUpExperimentHelper::CreateIfEnabled(this, clock_)),
|
||||
@ -361,7 +361,7 @@ void VideoStreamEncoderResourceManager::MaybeInitializePixelLimitResource() {
|
||||
}
|
||||
int max_pixels = 0;
|
||||
std::string pixel_limit_field_trial =
|
||||
field_trial::FindFullName(kPixelLimitResourceFieldTrialName);
|
||||
field_trials_.Lookup(kPixelLimitResourceFieldTrialName);
|
||||
if (sscanf(pixel_limit_field_trial.c_str(), "Enabled-%d", &max_pixels) != 1) {
|
||||
RTC_LOG(LS_ERROR) << "Couldn't parse " << kPixelLimitResourceFieldTrialName
|
||||
<< " trial config: " << pixel_limit_field_trial;
|
||||
|
||||
@ -183,6 +183,7 @@ class VideoStreamEncoderResourceManager
|
||||
const std::map<VideoAdaptationReason, VideoAdaptationCounters>&
|
||||
active_counts);
|
||||
|
||||
const WebRtcKeyValueConfig& field_trials_;
|
||||
DegradationPreferenceProvider* const degradation_preference_provider_;
|
||||
std::unique_ptr<BitrateConstraint> bitrate_constraint_
|
||||
RTC_GUARDED_BY(encoder_queue_);
|
||||
|
||||
@ -22,9 +22,10 @@ namespace webrtc {
|
||||
|
||||
BufferedFrameDecryptor::BufferedFrameDecryptor(
|
||||
OnDecryptedFrameCallback* decrypted_frame_callback,
|
||||
OnDecryptionStatusChangeCallback* decryption_status_change_callback)
|
||||
OnDecryptionStatusChangeCallback* decryption_status_change_callback,
|
||||
const WebRtcKeyValueConfig& field_trials)
|
||||
: generic_descriptor_auth_experiment_(
|
||||
!field_trial::IsDisabled("WebRTC-GenericDescriptorAuth")),
|
||||
!field_trials.IsDisabled("WebRTC-GenericDescriptorAuth")),
|
||||
decrypted_frame_callback_(decrypted_frame_callback),
|
||||
decryption_status_change_callback_(decryption_status_change_callback) {}
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
|
||||
#include "api/crypto/crypto_options.h"
|
||||
#include "api/crypto/frame_decryptor_interface.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "modules/video_coding/frame_object.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -57,7 +58,9 @@ class BufferedFrameDecryptor final {
|
||||
// Constructs a new BufferedFrameDecryptor that can hold
|
||||
explicit BufferedFrameDecryptor(
|
||||
OnDecryptedFrameCallback* decrypted_frame_callback,
|
||||
OnDecryptionStatusChangeCallback* decryption_status_change_callback);
|
||||
OnDecryptionStatusChangeCallback* decryption_status_change_callback,
|
||||
const WebRtcKeyValueConfig& field_trials);
|
||||
|
||||
~BufferedFrameDecryptor();
|
||||
// This object cannot be copied.
|
||||
BufferedFrameDecryptor(const BufferedFrameDecryptor&) = delete;
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/scoped_key_value_config.h"
|
||||
|
||||
using ::testing::Return;
|
||||
|
||||
@ -88,12 +89,13 @@ class BufferedFrameDecryptorTest : public ::testing::Test,
|
||||
seq_num_ = 0;
|
||||
mock_frame_decryptor_ = rtc::make_ref_counted<MockFrameDecryptor>();
|
||||
buffered_frame_decryptor_ =
|
||||
std::make_unique<BufferedFrameDecryptor>(this, this);
|
||||
std::make_unique<BufferedFrameDecryptor>(this, this, field_trials_);
|
||||
buffered_frame_decryptor_->SetFrameDecryptor(mock_frame_decryptor_);
|
||||
}
|
||||
|
||||
static const size_t kMaxStashedFrames;
|
||||
|
||||
test::ScopedKeyValueConfig field_trials_;
|
||||
std::vector<uint8_t> fake_packet_data_;
|
||||
rtc::scoped_refptr<MockFrameDecryptor> mock_frame_decryptor_;
|
||||
std::unique_ptr<BufferedFrameDecryptor> buffered_frame_decryptor_;
|
||||
|
||||
@ -247,7 +247,8 @@ TEST_F(ExtendedReportsEndToEndTest,
|
||||
|
||||
TEST_F(ExtendedReportsEndToEndTest,
|
||||
TestExtendedReportsWithoutRrtrWithTargetBitrateExplicitlySet) {
|
||||
test::ScopedFieldTrials field_trials("WebRTC-Target-Bitrate-Rtcp/Enabled/");
|
||||
test::ScopedKeyValueConfig field_trials(
|
||||
field_trials_, "WebRTC-Target-Bitrate-Rtcp/Enabled/");
|
||||
RtcpXrObserver test(/*enable_rrtr=*/false, /*expect_target_bitrate=*/true,
|
||||
/*enable_zero_target_bitrate=*/false,
|
||||
VideoEncoderConfig::ContentType::kRealtimeVideo);
|
||||
|
||||
@ -50,7 +50,7 @@ void MultiStreamTester::RunTest() {
|
||||
auto task_queue = task_queue_factory->CreateTaskQueue(
|
||||
"TaskQueue", TaskQueueFactory::Priority::HIGH);
|
||||
Call::Config config(&event_log);
|
||||
FieldTrialBasedConfig field_trials;
|
||||
test::ScopedKeyValueConfig field_trials;
|
||||
config.trials = &field_trials;
|
||||
config.task_queue_factory = task_queue_factory.get();
|
||||
std::unique_ptr<Call> sender_call;
|
||||
|
||||
@ -26,7 +26,6 @@
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/thread_annotations.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "video/frame_decode_timing.h"
|
||||
#include "video/task_queue_frame_decode_scheduler.h"
|
||||
#include "video/video_receive_stream_timeout_tracker.h"
|
||||
@ -181,7 +180,8 @@ class FrameBuffer3Proxy : public FrameBufferProxy {
|
||||
FrameSchedulingReceiver* receiver,
|
||||
TimeDelta max_wait_for_keyframe,
|
||||
TimeDelta max_wait_for_frame,
|
||||
std::unique_ptr<FrameDecodeScheduler> frame_decode_scheduler)
|
||||
std::unique_ptr<FrameDecodeScheduler> frame_decode_scheduler,
|
||||
const WebRtcKeyValueConfig& field_trials)
|
||||
: max_wait_for_keyframe_(max_wait_for_keyframe),
|
||||
max_wait_for_frame_(max_wait_for_frame),
|
||||
clock_(clock),
|
||||
@ -214,7 +214,7 @@ class FrameBuffer3Proxy : public FrameBufferProxy {
|
||||
RTC_LOG(LS_WARNING) << "Using FrameBuffer3";
|
||||
|
||||
ParseFieldTrial({&zero_playout_delay_max_decode_queue_size_},
|
||||
field_trial::FindFullName("WebRTC-ZeroPlayoutDelay"));
|
||||
field_trials.Lookup("WebRTC-ZeroPlayoutDelay"));
|
||||
}
|
||||
|
||||
// FrameBufferProxy implementation.
|
||||
@ -546,7 +546,8 @@ enum class FrameBufferArm {
|
||||
|
||||
constexpr const char* kFrameBufferFieldTrial = "WebRTC-FrameBuffer3";
|
||||
|
||||
FrameBufferArm ParseFrameBufferFieldTrial() {
|
||||
FrameBufferArm ParseFrameBufferFieldTrial(
|
||||
const WebRtcKeyValueConfig& field_trials) {
|
||||
webrtc::FieldTrialEnum<FrameBufferArm> arm(
|
||||
"arm", FrameBufferArm::kFrameBuffer2,
|
||||
{
|
||||
@ -554,7 +555,7 @@ FrameBufferArm ParseFrameBufferFieldTrial() {
|
||||
{"FrameBuffer3", FrameBufferArm::kFrameBuffer3},
|
||||
{"SyncDecoding", FrameBufferArm::kSyncDecode},
|
||||
});
|
||||
ParseFieldTrial({&arm}, field_trial::FindFullName(kFrameBufferFieldTrial));
|
||||
ParseFieldTrial({&arm}, field_trials.Lookup(kFrameBufferFieldTrial));
|
||||
return arm.Get();
|
||||
}
|
||||
|
||||
@ -569,14 +570,16 @@ std::unique_ptr<FrameBufferProxy> FrameBufferProxy::CreateFromFieldTrial(
|
||||
FrameSchedulingReceiver* receiver,
|
||||
TimeDelta max_wait_for_keyframe,
|
||||
TimeDelta max_wait_for_frame,
|
||||
DecodeSynchronizer* decode_sync) {
|
||||
switch (ParseFrameBufferFieldTrial()) {
|
||||
DecodeSynchronizer* decode_sync,
|
||||
const WebRtcKeyValueConfig& field_trials) {
|
||||
switch (ParseFrameBufferFieldTrial(field_trials)) {
|
||||
case FrameBufferArm::kFrameBuffer3: {
|
||||
auto scheduler =
|
||||
std::make_unique<TaskQueueFrameDecodeScheduler>(clock, worker_queue);
|
||||
return std::make_unique<FrameBuffer3Proxy>(
|
||||
clock, worker_queue, timing, stats_proxy, decode_queue, receiver,
|
||||
max_wait_for_keyframe, max_wait_for_frame, std::move(scheduler));
|
||||
max_wait_for_keyframe, max_wait_for_frame, std::move(scheduler),
|
||||
field_trials);
|
||||
}
|
||||
case FrameBufferArm::kSyncDecode: {
|
||||
std::unique_ptr<FrameDecodeScheduler> scheduler;
|
||||
@ -592,7 +595,8 @@ std::unique_ptr<FrameBufferProxy> FrameBufferProxy::CreateFromFieldTrial(
|
||||
}
|
||||
return std::make_unique<FrameBuffer3Proxy>(
|
||||
clock, worker_queue, timing, stats_proxy, decode_queue, receiver,
|
||||
max_wait_for_keyframe, max_wait_for_frame, std::move(scheduler));
|
||||
max_wait_for_keyframe, max_wait_for_frame, std::move(scheduler),
|
||||
field_trials);
|
||||
}
|
||||
case FrameBufferArm::kFrameBuffer2:
|
||||
ABSL_FALLTHROUGH_INTENDED;
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include "api/metronome/metronome.h"
|
||||
#include "api/task_queue/task_queue_base.h"
|
||||
#include "api/video/encoded_frame.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "modules/video_coding/include/video_coding_defines.h"
|
||||
#include "modules/video_coding/timing.h"
|
||||
#include "rtc_base/task_queue.h"
|
||||
@ -47,7 +48,8 @@ class FrameBufferProxy {
|
||||
FrameSchedulingReceiver* receiver,
|
||||
TimeDelta max_wait_for_keyframe,
|
||||
TimeDelta max_wait_for_frame,
|
||||
DecodeSynchronizer* decode_sync);
|
||||
DecodeSynchronizer* decode_sync,
|
||||
const WebRtcKeyValueConfig& field_trials);
|
||||
virtual ~FrameBufferProxy() = default;
|
||||
|
||||
// Run on the worker thread.
|
||||
|
||||
@ -28,11 +28,10 @@
|
||||
#include "api/video/video_timing.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/event.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/run_loop.h"
|
||||
#include "test/scoped_key_value_config.h"
|
||||
#include "test/time_controller/simulated_time_controller.h"
|
||||
#include "video/decode_synchronizer.h"
|
||||
|
||||
@ -199,9 +198,9 @@ class VCMReceiveStatisticsCallbackMock : public VCMReceiveStatisticsCallback {
|
||||
(override));
|
||||
};
|
||||
|
||||
bool IsFrameBuffer2Enabled() {
|
||||
return field_trial::FindFullName("WebRTC-FrameBuffer3")
|
||||
.find("arm:FrameBuffer2") != std::string::npos;
|
||||
bool IsFrameBuffer2Enabled(const WebRtcKeyValueConfig& field_trials) {
|
||||
return field_trials.Lookup("WebRTC-FrameBuffer3").find("arm:FrameBuffer2") !=
|
||||
std::string::npos;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@ -231,7 +230,8 @@ class FrameBufferProxyFixture
|
||||
this,
|
||||
kMaxWaitForKeyframe,
|
||||
kMaxWaitForFrame,
|
||||
&decode_sync_)) {
|
||||
&decode_sync_,
|
||||
field_trials_)) {
|
||||
// Avoid starting with negative render times.
|
||||
timing_.set_min_playout_delay(TimeDelta::Millis(10));
|
||||
|
||||
@ -302,7 +302,7 @@ class FrameBufferProxyFixture
|
||||
int dropped_frames() const { return dropped_frames_; }
|
||||
|
||||
protected:
|
||||
test::ScopedFieldTrials field_trials_;
|
||||
test::ScopedKeyValueConfig field_trials_;
|
||||
GlobalSimulatedTimeController time_controller_;
|
||||
Clock* const clock_;
|
||||
test::RunLoop run_loop_;
|
||||
@ -676,7 +676,7 @@ TEST_P(FrameBufferProxyTest, FrameCompleteCalledOnceForSingleTemporalUnit) {
|
||||
|
||||
TEST_P(FrameBufferProxyTest, FrameCompleteCalledOnceForCompleteTemporalUnit) {
|
||||
// FrameBuffer2 logs the complete frame on the arrival of the last layer.
|
||||
if (IsFrameBuffer2Enabled())
|
||||
if (IsFrameBuffer2Enabled(field_trials_))
|
||||
return;
|
||||
StartNextDecodeForceKeyframe();
|
||||
|
||||
@ -753,7 +753,7 @@ TEST_P(FrameBufferProxyTest, NextFrameWithOldTimestamp) {
|
||||
.AsLast()
|
||||
.Build());
|
||||
// FrameBuffer2 drops the frame, while FrameBuffer3 will continue the stream.
|
||||
if (!IsFrameBuffer2Enabled()) {
|
||||
if (!IsFrameBuffer2Enabled(field_trials_)) {
|
||||
EXPECT_THAT(WaitForFrameOrTimeout(kFps30Delay), Frame(WithId(2)));
|
||||
} else {
|
||||
EXPECT_THAT(WaitForFrameOrTimeout(kMaxWaitForFrame), TimedOut());
|
||||
|
||||
@ -33,7 +33,6 @@
|
||||
#include "rtc_base/thread_annotations.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
#include "system_wrappers/include/ntp_time.h"
|
||||
|
||||
@ -209,7 +208,9 @@ class ZeroHertzAdapterMode : public AdapterMode {
|
||||
|
||||
class FrameCadenceAdapterImpl : public FrameCadenceAdapterInterface {
|
||||
public:
|
||||
FrameCadenceAdapterImpl(Clock* clock, TaskQueueBase* queue);
|
||||
FrameCadenceAdapterImpl(Clock* clock,
|
||||
TaskQueueBase* queue,
|
||||
const WebRtcKeyValueConfig& field_trials);
|
||||
~FrameCadenceAdapterImpl();
|
||||
|
||||
// FrameCadenceAdapterInterface overrides.
|
||||
@ -542,12 +543,14 @@ TimeDelta ZeroHertzAdapterMode::RepeatDuration(bool idle_repeat) const {
|
||||
: frame_delay_;
|
||||
}
|
||||
|
||||
FrameCadenceAdapterImpl::FrameCadenceAdapterImpl(Clock* clock,
|
||||
TaskQueueBase* queue)
|
||||
FrameCadenceAdapterImpl::FrameCadenceAdapterImpl(
|
||||
Clock* clock,
|
||||
TaskQueueBase* queue,
|
||||
const WebRtcKeyValueConfig& field_trials)
|
||||
: clock_(clock),
|
||||
queue_(queue),
|
||||
zero_hertz_screenshare_enabled_(
|
||||
!field_trial::IsDisabled("WebRTC-ZeroHertzScreenshare")) {}
|
||||
!field_trials.IsDisabled("WebRTC-ZeroHertzScreenshare")) {}
|
||||
|
||||
FrameCadenceAdapterImpl::~FrameCadenceAdapterImpl() {
|
||||
RTC_DLOG(LS_VERBOSE) << __func__ << " this " << this;
|
||||
@ -737,8 +740,10 @@ void FrameCadenceAdapterImpl::MaybeReportFrameRateConstraintUmas() {
|
||||
} // namespace
|
||||
|
||||
std::unique_ptr<FrameCadenceAdapterInterface>
|
||||
FrameCadenceAdapterInterface::Create(Clock* clock, TaskQueueBase* queue) {
|
||||
return std::make_unique<FrameCadenceAdapterImpl>(clock, queue);
|
||||
FrameCadenceAdapterInterface::Create(Clock* clock,
|
||||
TaskQueueBase* queue,
|
||||
const WebRtcKeyValueConfig& field_trials) {
|
||||
return std::make_unique<FrameCadenceAdapterImpl>(clock, queue, field_trials);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
#include "api/units/time_delta.h"
|
||||
#include "api/video/video_frame.h"
|
||||
#include "api/video/video_sink_interface.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/synchronization/mutex.h"
|
||||
#include "rtc_base/thread_annotations.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
@ -79,7 +80,8 @@ class FrameCadenceAdapterInterface
|
||||
// Callback::OnFrame on the |queue|.
|
||||
static std::unique_ptr<FrameCadenceAdapterInterface> Create(
|
||||
Clock* clock,
|
||||
TaskQueueBase* queue);
|
||||
TaskQueueBase* queue,
|
||||
const WebRtcKeyValueConfig& field_trials);
|
||||
|
||||
// Call before using the rest of the API.
|
||||
virtual void Initialize(Callback* callback) = 0;
|
||||
|
||||
@ -27,9 +27,9 @@
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
#include "system_wrappers/include/ntp_time.h"
|
||||
#include "system_wrappers/include/sleep.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/scoped_key_value_config.h"
|
||||
#include "test/time_controller/simulated_time_controller.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -59,8 +59,11 @@ VideoFrame CreateFrameWithTimestamps(
|
||||
.build();
|
||||
}
|
||||
|
||||
std::unique_ptr<FrameCadenceAdapterInterface> CreateAdapter(Clock* clock) {
|
||||
return FrameCadenceAdapterInterface::Create(clock, TaskQueueBase::Current());
|
||||
std::unique_ptr<FrameCadenceAdapterInterface> CreateAdapter(
|
||||
const WebRtcKeyValueConfig& field_trials,
|
||||
Clock* clock) {
|
||||
return FrameCadenceAdapterInterface::Create(clock, TaskQueueBase::Current(),
|
||||
field_trials);
|
||||
}
|
||||
|
||||
class MockCallback : public FrameCadenceAdapterInterface::Callback {
|
||||
@ -70,25 +73,28 @@ class MockCallback : public FrameCadenceAdapterInterface::Callback {
|
||||
MOCK_METHOD(void, RequestRefreshFrame, (), (override));
|
||||
};
|
||||
|
||||
class ZeroHertzFieldTrialDisabler : public test::ScopedFieldTrials {
|
||||
class ZeroHertzFieldTrialDisabler : public test::ScopedKeyValueConfig {
|
||||
public:
|
||||
ZeroHertzFieldTrialDisabler()
|
||||
: test::ScopedFieldTrials("WebRTC-ZeroHertzScreenshare/Disabled/") {}
|
||||
: test::ScopedKeyValueConfig("WebRTC-ZeroHertzScreenshare/Disabled/") {}
|
||||
};
|
||||
|
||||
class ZeroHertzFieldTrialEnabler : public test::ScopedFieldTrials {
|
||||
class ZeroHertzFieldTrialEnabler : public test::ScopedKeyValueConfig {
|
||||
public:
|
||||
ZeroHertzFieldTrialEnabler()
|
||||
: test::ScopedFieldTrials("WebRTC-ZeroHertzScreenshare/Enabled/") {}
|
||||
: test::ScopedKeyValueConfig("WebRTC-ZeroHertzScreenshare/Enabled/") {}
|
||||
};
|
||||
|
||||
TEST(FrameCadenceAdapterTest,
|
||||
ForwardsFramesOnConstructionAndUnderDisabledFieldTrial) {
|
||||
GlobalSimulatedTimeController time_controller(Timestamp::Millis(1));
|
||||
auto disabler = std::make_unique<ZeroHertzFieldTrialDisabler>();
|
||||
ZeroHertzFieldTrialDisabler disabled_field_trials;
|
||||
test::ScopedKeyValueConfig no_field_trials;
|
||||
for (int i = 0; i != 2; i++) {
|
||||
MockCallback callback;
|
||||
auto adapter = CreateAdapter(time_controller.GetClock());
|
||||
auto adapter =
|
||||
CreateAdapter(i == 0 ? disabled_field_trials : no_field_trials,
|
||||
time_controller.GetClock());
|
||||
adapter->Initialize(&callback);
|
||||
VideoFrame frame = CreateFrame();
|
||||
EXPECT_CALL(callback, OnFrame).Times(1);
|
||||
@ -98,15 +104,14 @@ TEST(FrameCadenceAdapterTest,
|
||||
EXPECT_CALL(callback, OnDiscardedFrame).Times(1);
|
||||
adapter->OnDiscardedFrame();
|
||||
Mock::VerifyAndClearExpectations(&callback);
|
||||
|
||||
disabler = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
TEST(FrameCadenceAdapterTest, CountsOutstandingFramesToProcess) {
|
||||
test::ScopedKeyValueConfig no_field_trials;
|
||||
GlobalSimulatedTimeController time_controller(Timestamp::Millis(1));
|
||||
MockCallback callback;
|
||||
auto adapter = CreateAdapter(time_controller.GetClock());
|
||||
auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
|
||||
adapter->Initialize(&callback);
|
||||
EXPECT_CALL(callback, OnFrame(_, 2, _)).Times(1);
|
||||
EXPECT_CALL(callback, OnFrame(_, 1, _)).Times(1);
|
||||
@ -120,8 +125,9 @@ TEST(FrameCadenceAdapterTest, CountsOutstandingFramesToProcess) {
|
||||
}
|
||||
|
||||
TEST(FrameCadenceAdapterTest, FrameRateFollowsRateStatisticsByDefault) {
|
||||
test::ScopedKeyValueConfig no_field_trials;
|
||||
GlobalSimulatedTimeController time_controller(Timestamp::Millis(0));
|
||||
auto adapter = CreateAdapter(time_controller.GetClock());
|
||||
auto adapter = CreateAdapter(no_field_trials, time_controller.GetClock());
|
||||
adapter->Initialize(nullptr);
|
||||
|
||||
// Create an "oracle" rate statistics which should be followed on a sequence
|
||||
@ -143,7 +149,7 @@ TEST(FrameCadenceAdapterTest,
|
||||
FrameRateFollowsRateStatisticsWhenFeatureDisabled) {
|
||||
ZeroHertzFieldTrialDisabler feature_disabler;
|
||||
GlobalSimulatedTimeController time_controller(Timestamp::Millis(0));
|
||||
auto adapter = CreateAdapter(time_controller.GetClock());
|
||||
auto adapter = CreateAdapter(feature_disabler, time_controller.GetClock());
|
||||
adapter->Initialize(nullptr);
|
||||
|
||||
// Create an "oracle" rate statistics which should be followed on a sequence
|
||||
@ -165,7 +171,7 @@ TEST(FrameCadenceAdapterTest, FrameRateFollowsMaxFpsWhenZeroHertzActivated) {
|
||||
ZeroHertzFieldTrialEnabler enabler;
|
||||
MockCallback callback;
|
||||
GlobalSimulatedTimeController time_controller(Timestamp::Millis(0));
|
||||
auto adapter = CreateAdapter(time_controller.GetClock());
|
||||
auto adapter = CreateAdapter(enabler, time_controller.GetClock());
|
||||
adapter->Initialize(nullptr);
|
||||
adapter->SetZeroHertzModeEnabled(
|
||||
FrameCadenceAdapterInterface::ZeroHertzModeParams{});
|
||||
@ -182,7 +188,7 @@ TEST(FrameCadenceAdapterTest,
|
||||
ZeroHertzFieldTrialEnabler enabler;
|
||||
MockCallback callback;
|
||||
GlobalSimulatedTimeController time_controller(Timestamp::Millis(0));
|
||||
auto adapter = CreateAdapter(time_controller.GetClock());
|
||||
auto adapter = CreateAdapter(enabler, time_controller.GetClock());
|
||||
adapter->Initialize(nullptr);
|
||||
adapter->SetZeroHertzModeEnabled(
|
||||
FrameCadenceAdapterInterface::ZeroHertzModeParams{});
|
||||
@ -211,7 +217,7 @@ TEST(FrameCadenceAdapterTest, ForwardsFramesDelayed) {
|
||||
ZeroHertzFieldTrialEnabler enabler;
|
||||
MockCallback callback;
|
||||
GlobalSimulatedTimeController time_controller(Timestamp::Millis(0));
|
||||
auto adapter = CreateAdapter(time_controller.GetClock());
|
||||
auto adapter = CreateAdapter(enabler, time_controller.GetClock());
|
||||
adapter->Initialize(&callback);
|
||||
adapter->SetZeroHertzModeEnabled(
|
||||
FrameCadenceAdapterInterface::ZeroHertzModeParams{});
|
||||
@ -246,7 +252,7 @@ TEST(FrameCadenceAdapterTest, RepeatsFramesDelayed) {
|
||||
ZeroHertzFieldTrialEnabler enabler;
|
||||
MockCallback callback;
|
||||
GlobalSimulatedTimeController time_controller(Timestamp::Millis(47892223));
|
||||
auto adapter = CreateAdapter(time_controller.GetClock());
|
||||
auto adapter = CreateAdapter(enabler, time_controller.GetClock());
|
||||
adapter->Initialize(&callback);
|
||||
adapter->SetZeroHertzModeEnabled(
|
||||
FrameCadenceAdapterInterface::ZeroHertzModeParams{});
|
||||
@ -300,7 +306,7 @@ TEST(FrameCadenceAdapterTest,
|
||||
ZeroHertzFieldTrialEnabler enabler;
|
||||
MockCallback callback;
|
||||
GlobalSimulatedTimeController time_controller(Timestamp::Millis(4711));
|
||||
auto adapter = CreateAdapter(time_controller.GetClock());
|
||||
auto adapter = CreateAdapter(enabler, time_controller.GetClock());
|
||||
adapter->Initialize(&callback);
|
||||
adapter->SetZeroHertzModeEnabled(
|
||||
FrameCadenceAdapterInterface::ZeroHertzModeParams{});
|
||||
@ -333,7 +339,7 @@ TEST(FrameCadenceAdapterTest, StopsRepeatingFramesDelayed) {
|
||||
ZeroHertzFieldTrialEnabler enabler;
|
||||
MockCallback callback;
|
||||
GlobalSimulatedTimeController time_controller(Timestamp::Millis(0));
|
||||
auto adapter = CreateAdapter(time_controller.GetClock());
|
||||
auto adapter = CreateAdapter(enabler, time_controller.GetClock());
|
||||
adapter->Initialize(&callback);
|
||||
adapter->SetZeroHertzModeEnabled(
|
||||
FrameCadenceAdapterInterface::ZeroHertzModeParams{});
|
||||
@ -361,7 +367,7 @@ TEST(FrameCadenceAdapterTest, RequestsRefreshFrameOnKeyFrameRequestWhenNew) {
|
||||
ZeroHertzFieldTrialEnabler enabler;
|
||||
MockCallback callback;
|
||||
GlobalSimulatedTimeController time_controller(Timestamp::Millis(0));
|
||||
auto adapter = CreateAdapter(time_controller.GetClock());
|
||||
auto adapter = CreateAdapter(enabler, time_controller.GetClock());
|
||||
adapter->Initialize(&callback);
|
||||
adapter->SetZeroHertzModeEnabled(
|
||||
FrameCadenceAdapterInterface::ZeroHertzModeParams{});
|
||||
@ -375,7 +381,7 @@ TEST(FrameCadenceAdapterTest, IgnoresKeyFrameRequestShortlyAfterFrame) {
|
||||
ZeroHertzFieldTrialEnabler enabler;
|
||||
MockCallback callback;
|
||||
GlobalSimulatedTimeController time_controller(Timestamp::Millis(0));
|
||||
auto adapter = CreateAdapter(time_controller.GetClock());
|
||||
auto adapter = CreateAdapter(enabler, time_controller.GetClock());
|
||||
adapter->Initialize(&callback);
|
||||
adapter->SetZeroHertzModeEnabled(
|
||||
FrameCadenceAdapterInterface::ZeroHertzModeParams{});
|
||||
@ -413,7 +419,7 @@ class FrameCadenceAdapterSimulcastLayersParamTest
|
||||
MockCallback callback_;
|
||||
GlobalSimulatedTimeController time_controller_{Timestamp::Millis(0)};
|
||||
const std::unique_ptr<FrameCadenceAdapterInterface> adapter_{
|
||||
CreateAdapter(time_controller_.GetClock())};
|
||||
CreateAdapter(enabler_, time_controller_.GetClock())};
|
||||
};
|
||||
|
||||
TEST_P(FrameCadenceAdapterSimulcastLayersParamTest,
|
||||
@ -542,7 +548,7 @@ class ZeroHertzLayerQualityConvergenceTest : public ::testing::Test {
|
||||
MockCallback callback_;
|
||||
GlobalSimulatedTimeController time_controller_{Timestamp::Millis(0)};
|
||||
std::unique_ptr<FrameCadenceAdapterInterface> adapter_{
|
||||
CreateAdapter(time_controller_.GetClock())};
|
||||
CreateAdapter(field_trial_enabler_, time_controller_.GetClock())};
|
||||
};
|
||||
|
||||
TEST_F(ZeroHertzLayerQualityConvergenceTest, InitialStateUnconverged) {
|
||||
@ -625,7 +631,8 @@ class FrameCadenceAdapterMetricsTest : public ::testing::Test {
|
||||
|
||||
TEST_F(FrameCadenceAdapterMetricsTest, RecordsNoUmasWithNoFrameTransfer) {
|
||||
MockCallback callback;
|
||||
auto adapter = CreateAdapter(nullptr);
|
||||
test::ScopedKeyValueConfig no_field_trials;
|
||||
auto adapter = CreateAdapter(no_field_trials, nullptr);
|
||||
adapter->Initialize(&callback);
|
||||
adapter->OnConstraintsChanged(
|
||||
VideoTrackSourceConstraints{absl::nullopt, absl::nullopt});
|
||||
@ -665,7 +672,8 @@ TEST_F(FrameCadenceAdapterMetricsTest, RecordsNoUmasWithNoFrameTransfer) {
|
||||
|
||||
TEST_F(FrameCadenceAdapterMetricsTest, RecordsNoUmasWithoutEnabledContentType) {
|
||||
MockCallback callback;
|
||||
auto adapter = CreateAdapter(time_controller_.GetClock());
|
||||
test::ScopedKeyValueConfig no_field_trials;
|
||||
auto adapter = CreateAdapter(no_field_trials, time_controller_.GetClock());
|
||||
adapter->Initialize(&callback);
|
||||
adapter->OnFrame(CreateFrame());
|
||||
adapter->OnConstraintsChanged(
|
||||
@ -706,7 +714,8 @@ TEST_F(FrameCadenceAdapterMetricsTest, RecordsNoUmasWithoutEnabledContentType) {
|
||||
|
||||
TEST_F(FrameCadenceAdapterMetricsTest, RecordsNoConstraintsIfUnsetOnFrame) {
|
||||
MockCallback callback;
|
||||
auto adapter = CreateAdapter(time_controller_.GetClock());
|
||||
test::ScopedKeyValueConfig no_field_trials;
|
||||
auto adapter = CreateAdapter(no_field_trials, time_controller_.GetClock());
|
||||
adapter->Initialize(&callback);
|
||||
adapter->SetZeroHertzModeEnabled(
|
||||
FrameCadenceAdapterInterface::ZeroHertzModeParams{});
|
||||
@ -719,7 +728,8 @@ TEST_F(FrameCadenceAdapterMetricsTest, RecordsNoConstraintsIfUnsetOnFrame) {
|
||||
|
||||
TEST_F(FrameCadenceAdapterMetricsTest, RecordsEmptyConstraintsIfSetOnFrame) {
|
||||
MockCallback callback;
|
||||
auto adapter = CreateAdapter(time_controller_.GetClock());
|
||||
test::ScopedKeyValueConfig no_field_trials;
|
||||
auto adapter = CreateAdapter(no_field_trials, time_controller_.GetClock());
|
||||
adapter->Initialize(&callback);
|
||||
adapter->SetZeroHertzModeEnabled(
|
||||
FrameCadenceAdapterInterface::ZeroHertzModeParams{});
|
||||
@ -759,7 +769,8 @@ TEST_F(FrameCadenceAdapterMetricsTest, RecordsEmptyConstraintsIfSetOnFrame) {
|
||||
|
||||
TEST_F(FrameCadenceAdapterMetricsTest, RecordsMaxConstraintIfSetOnFrame) {
|
||||
MockCallback callback;
|
||||
auto adapter = CreateAdapter(time_controller_.GetClock());
|
||||
test::ScopedKeyValueConfig no_field_trials;
|
||||
auto adapter = CreateAdapter(no_field_trials, time_controller_.GetClock());
|
||||
adapter->Initialize(&callback);
|
||||
adapter->SetZeroHertzModeEnabled(
|
||||
FrameCadenceAdapterInterface::ZeroHertzModeParams{});
|
||||
@ -796,7 +807,8 @@ TEST_F(FrameCadenceAdapterMetricsTest, RecordsMaxConstraintIfSetOnFrame) {
|
||||
|
||||
TEST_F(FrameCadenceAdapterMetricsTest, RecordsMinConstraintIfSetOnFrame) {
|
||||
MockCallback callback;
|
||||
auto adapter = CreateAdapter(time_controller_.GetClock());
|
||||
test::ScopedKeyValueConfig no_field_trials;
|
||||
auto adapter = CreateAdapter(no_field_trials, time_controller_.GetClock());
|
||||
adapter->Initialize(&callback);
|
||||
adapter->SetZeroHertzModeEnabled(
|
||||
FrameCadenceAdapterInterface::ZeroHertzModeParams{});
|
||||
@ -833,7 +845,8 @@ TEST_F(FrameCadenceAdapterMetricsTest, RecordsMinConstraintIfSetOnFrame) {
|
||||
|
||||
TEST_F(FrameCadenceAdapterMetricsTest, RecordsMinGtMaxConstraintIfSetOnFrame) {
|
||||
MockCallback callback;
|
||||
auto adapter = CreateAdapter(time_controller_.GetClock());
|
||||
test::ScopedKeyValueConfig no_field_trials;
|
||||
auto adapter = CreateAdapter(no_field_trials, time_controller_.GetClock());
|
||||
adapter->Initialize(&callback);
|
||||
adapter->SetZeroHertzModeEnabled(
|
||||
FrameCadenceAdapterInterface::ZeroHertzModeParams{});
|
||||
@ -869,7 +882,8 @@ TEST_F(FrameCadenceAdapterMetricsTest, RecordsMinGtMaxConstraintIfSetOnFrame) {
|
||||
|
||||
TEST_F(FrameCadenceAdapterMetricsTest, RecordsMinLtMaxConstraintIfSetOnFrame) {
|
||||
MockCallback callback;
|
||||
auto adapter = CreateAdapter(time_controller_.GetClock());
|
||||
test::ScopedKeyValueConfig no_field_trials;
|
||||
auto adapter = CreateAdapter(no_field_trials, time_controller_.GetClock());
|
||||
adapter->Initialize(&callback);
|
||||
adapter->SetZeroHertzModeEnabled(
|
||||
FrameCadenceAdapterInterface::ZeroHertzModeParams{});
|
||||
@ -907,7 +921,7 @@ TEST(FrameCadenceAdapterRealTimeTest, TimestampsDoNotDrift) {
|
||||
int64_t original_timestamp_us;
|
||||
rtc::Event event;
|
||||
queue->PostTask(ToQueuedTask([&] {
|
||||
adapter = CreateAdapter(clock);
|
||||
adapter = CreateAdapter(enabler, clock);
|
||||
adapter->Initialize(&callback);
|
||||
adapter->SetZeroHertzModeEnabled(
|
||||
FrameCadenceAdapterInterface::ZeroHertzModeParams{});
|
||||
|
||||
@ -216,7 +216,8 @@ class UpscalingObserver
|
||||
|
||||
TEST_F(QualityScalingTest, AdaptsDownForHighQp_Vp8) {
|
||||
// qp_low:1, qp_high:1 -> kHighQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "1,1,0,0,0,0" + kEnd);
|
||||
test::ScopedKeyValueConfig field_trials(field_trials_,
|
||||
kPrefix + "1,1,0,0,0,0" + kEnd);
|
||||
|
||||
DownscalingObserver test("VP8", /*streams_active=*/{true}, kHighStartBps,
|
||||
/*automatic_resize=*/true,
|
||||
@ -226,7 +227,8 @@ TEST_F(QualityScalingTest, AdaptsDownForHighQp_Vp8) {
|
||||
|
||||
TEST_F(QualityScalingTest, NoAdaptDownForHighQpIfScalingOff_Vp8) {
|
||||
// qp_low:1, qp_high:1 -> kHighQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "1,1,0,0,0,0" + kEnd);
|
||||
test::ScopedKeyValueConfig field_trials(field_trials_,
|
||||
kPrefix + "1,1,0,0,0,0" + kEnd);
|
||||
|
||||
DownscalingObserver test("VP8", /*streams_active=*/{true}, kHighStartBps,
|
||||
/*automatic_resize=*/false,
|
||||
@ -236,7 +238,8 @@ TEST_F(QualityScalingTest, NoAdaptDownForHighQpIfScalingOff_Vp8) {
|
||||
|
||||
TEST_F(QualityScalingTest, NoAdaptDownForNormalQp_Vp8) {
|
||||
// qp_low:1, qp_high:127 -> kNormalQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "1,127,0,0,0,0" + kEnd);
|
||||
test::ScopedKeyValueConfig field_trials(field_trials_,
|
||||
kPrefix + "1,127,0,0,0,0" + kEnd);
|
||||
|
||||
DownscalingObserver test("VP8", /*streams_active=*/{true}, kHighStartBps,
|
||||
/*automatic_resize=*/true,
|
||||
@ -246,7 +249,8 @@ TEST_F(QualityScalingTest, NoAdaptDownForNormalQp_Vp8) {
|
||||
|
||||
TEST_F(QualityScalingTest, AdaptsDownForLowStartBitrate_Vp8) {
|
||||
// qp_low:1, qp_high:127 -> kNormalQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "1,127,0,0,0,0" + kEnd);
|
||||
test::ScopedKeyValueConfig field_trials(field_trials_,
|
||||
kPrefix + "1,127,0,0,0,0" + kEnd);
|
||||
|
||||
DownscalingObserver test("VP8", /*streams_active=*/{true}, kLowStartBps,
|
||||
/*automatic_resize=*/true,
|
||||
@ -256,10 +260,11 @@ TEST_F(QualityScalingTest, AdaptsDownForLowStartBitrate_Vp8) {
|
||||
|
||||
TEST_F(QualityScalingTest, AdaptsDownForLowStartBitrateAndThenUp) {
|
||||
// qp_low:127, qp_high:127 -> kLowQp
|
||||
test::ScopedFieldTrials field_trials(
|
||||
test::ScopedKeyValueConfig field_trials(
|
||||
field_trials_,
|
||||
kPrefix + "127,127,0,0,0,0" + kEnd +
|
||||
"WebRTC-Video-BalancedDegradationSettings/"
|
||||
"pixels:230400|921600,fps:20|30,kbps:300|500/"); // should not affect
|
||||
"WebRTC-Video-BalancedDegradationSettings/"
|
||||
"pixels:230400|921600,fps:20|30,kbps:300|500/"); // should not affect
|
||||
|
||||
UpscalingObserver test("VP8", /*streams_active=*/{true},
|
||||
kDefaultVgaMinStartBps - 1,
|
||||
@ -269,10 +274,10 @@ TEST_F(QualityScalingTest, AdaptsDownForLowStartBitrateAndThenUp) {
|
||||
|
||||
TEST_F(QualityScalingTest, AdaptsDownAndThenUpWithBalanced) {
|
||||
// qp_low:127, qp_high:127 -> kLowQp
|
||||
test::ScopedFieldTrials field_trials(
|
||||
kPrefix + "127,127,0,0,0,0" + kEnd +
|
||||
"WebRTC-Video-BalancedDegradationSettings/"
|
||||
"pixels:230400|921600,fps:20|30,kbps:300|499/");
|
||||
test::ScopedKeyValueConfig field_trials(
|
||||
field_trials_, kPrefix + "127,127,0,0,0,0" + kEnd +
|
||||
"WebRTC-Video-BalancedDegradationSettings/"
|
||||
"pixels:230400|921600,fps:20|30,kbps:300|499/");
|
||||
|
||||
UpscalingObserver test("VP8", /*streams_active=*/{true},
|
||||
kDefaultVgaMinStartBps - 1,
|
||||
@ -283,10 +288,10 @@ TEST_F(QualityScalingTest, AdaptsDownAndThenUpWithBalanced) {
|
||||
|
||||
TEST_F(QualityScalingTest, AdaptsDownButNotUpWithBalancedIfBitrateNotEnough) {
|
||||
// qp_low:127, qp_high:127 -> kLowQp
|
||||
test::ScopedFieldTrials field_trials(
|
||||
kPrefix + "127,127,0,0,0,0" + kEnd +
|
||||
"WebRTC-Video-BalancedDegradationSettings/"
|
||||
"pixels:230400|921600,fps:20|30,kbps:300|500/");
|
||||
test::ScopedKeyValueConfig field_trials(
|
||||
field_trials_, kPrefix + "127,127,0,0,0,0" + kEnd +
|
||||
"WebRTC-Video-BalancedDegradationSettings/"
|
||||
"pixels:230400|921600,fps:20|30,kbps:300|500/");
|
||||
|
||||
UpscalingObserver test("VP8", /*streams_active=*/{true},
|
||||
kDefaultVgaMinStartBps - 1,
|
||||
@ -297,7 +302,8 @@ TEST_F(QualityScalingTest, AdaptsDownButNotUpWithBalancedIfBitrateNotEnough) {
|
||||
|
||||
TEST_F(QualityScalingTest, NoAdaptDownForLowStartBitrate_Simulcast) {
|
||||
// qp_low:1, qp_high:127 -> kNormalQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "1,127,0,0,0,0" + kEnd);
|
||||
test::ScopedKeyValueConfig field_trials(field_trials_,
|
||||
kPrefix + "1,127,0,0,0,0" + kEnd);
|
||||
|
||||
DownscalingObserver test("VP8", /*streams_active=*/{true, true}, kLowStartBps,
|
||||
/*automatic_resize=*/false,
|
||||
@ -307,7 +313,8 @@ TEST_F(QualityScalingTest, NoAdaptDownForLowStartBitrate_Simulcast) {
|
||||
|
||||
TEST_F(QualityScalingTest, AdaptsDownForHighQp_HighestStreamActive_Vp8) {
|
||||
// qp_low:1, qp_high:1 -> kHighQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "1,1,0,0,0,0" + kEnd);
|
||||
test::ScopedKeyValueConfig field_trials(field_trials_,
|
||||
kPrefix + "1,1,0,0,0,0" + kEnd);
|
||||
|
||||
DownscalingObserver test("VP8", /*streams_active=*/{false, false, true},
|
||||
kHighStartBps,
|
||||
@ -319,7 +326,8 @@ TEST_F(QualityScalingTest, AdaptsDownForHighQp_HighestStreamActive_Vp8) {
|
||||
TEST_F(QualityScalingTest,
|
||||
AdaptsDownForLowStartBitrate_HighestStreamActive_Vp8) {
|
||||
// qp_low:1, qp_high:127 -> kNormalQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "1,127,0,0,0,0" + kEnd);
|
||||
test::ScopedKeyValueConfig field_trials(field_trials_,
|
||||
kPrefix + "1,127,0,0,0,0" + kEnd);
|
||||
|
||||
DownscalingObserver test("VP8", /*streams_active=*/{false, false, true},
|
||||
kSinglecastLimits720pVp8->min_start_bitrate_bps - 1,
|
||||
@ -330,7 +338,8 @@ TEST_F(QualityScalingTest,
|
||||
|
||||
TEST_F(QualityScalingTest, AdaptsDownButNotUpWithMinStartBitrateLimit) {
|
||||
// qp_low:127, qp_high:127 -> kLowQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "127,127,0,0,0,0" + kEnd);
|
||||
test::ScopedKeyValueConfig field_trials(field_trials_,
|
||||
kPrefix + "127,127,0,0,0,0" + kEnd);
|
||||
|
||||
UpscalingObserver test("VP8", /*streams_active=*/{false, true},
|
||||
kSinglecastLimits720pVp8->min_start_bitrate_bps - 1,
|
||||
@ -340,7 +349,8 @@ TEST_F(QualityScalingTest, AdaptsDownButNotUpWithMinStartBitrateLimit) {
|
||||
|
||||
TEST_F(QualityScalingTest, NoAdaptDownForLowStartBitrateIfBitrateEnough_Vp8) {
|
||||
// qp_low:1, qp_high:127 -> kNormalQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "1,127,0,0,0,0" + kEnd);
|
||||
test::ScopedKeyValueConfig field_trials(field_trials_,
|
||||
kPrefix + "1,127,0,0,0,0" + kEnd);
|
||||
|
||||
DownscalingObserver test("VP8", /*streams_active=*/{false, false, true},
|
||||
kSinglecastLimits720pVp8->min_start_bitrate_bps,
|
||||
@ -352,9 +362,9 @@ TEST_F(QualityScalingTest, NoAdaptDownForLowStartBitrateIfBitrateEnough_Vp8) {
|
||||
TEST_F(QualityScalingTest,
|
||||
NoAdaptDownForLowStartBitrateIfDefaultLimitsDisabled_Vp8) {
|
||||
// qp_low:1, qp_high:127 -> kNormalQp
|
||||
test::ScopedFieldTrials field_trials(
|
||||
kPrefix + "1,127,0,0,0,0" + kEnd +
|
||||
"WebRTC-DefaultBitrateLimitsKillSwitch/Enabled/");
|
||||
test::ScopedKeyValueConfig field_trials(
|
||||
field_trials_, kPrefix + "1,127,0,0,0,0" + kEnd +
|
||||
"WebRTC-DefaultBitrateLimitsKillSwitch/Enabled/");
|
||||
|
||||
DownscalingObserver test("VP8", /*streams_active=*/{false, false, true},
|
||||
kSinglecastLimits720pVp8->min_start_bitrate_bps - 1,
|
||||
@ -366,7 +376,8 @@ TEST_F(QualityScalingTest,
|
||||
TEST_F(QualityScalingTest,
|
||||
NoAdaptDownForLowStartBitrate_OneStreamSinglecastLimitsNotUsed_Vp8) {
|
||||
// qp_low:1, qp_high:127 -> kNormalQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "1,127,0,0,0,0" + kEnd);
|
||||
test::ScopedKeyValueConfig field_trials(field_trials_,
|
||||
kPrefix + "1,127,0,0,0,0" + kEnd);
|
||||
|
||||
DownscalingObserver test("VP8", /*streams_active=*/{true},
|
||||
kSinglecastLimits720pVp8->min_start_bitrate_bps - 1,
|
||||
@ -377,7 +388,8 @@ TEST_F(QualityScalingTest,
|
||||
|
||||
TEST_F(QualityScalingTest, NoAdaptDownForHighQp_LowestStreamActive_Vp8) {
|
||||
// qp_low:1, qp_high:1 -> kHighQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "1,1,0,0,0,0" + kEnd);
|
||||
test::ScopedKeyValueConfig field_trials(field_trials_,
|
||||
kPrefix + "1,1,0,0,0,0" + kEnd);
|
||||
|
||||
DownscalingObserver test("VP8", /*streams_active=*/{true, false, false},
|
||||
kHighStartBps,
|
||||
@ -389,7 +401,8 @@ TEST_F(QualityScalingTest, NoAdaptDownForHighQp_LowestStreamActive_Vp8) {
|
||||
TEST_F(QualityScalingTest,
|
||||
NoAdaptDownForLowStartBitrate_LowestStreamActive_Vp8) {
|
||||
// qp_low:1, qp_high:127 -> kNormalQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "1,127,0,0,0,0" + kEnd);
|
||||
test::ScopedKeyValueConfig field_trials(field_trials_,
|
||||
kPrefix + "1,127,0,0,0,0" + kEnd);
|
||||
|
||||
DownscalingObserver test("VP8", /*streams_active=*/{true, false, false},
|
||||
kLowStartBps,
|
||||
@ -400,7 +413,8 @@ TEST_F(QualityScalingTest,
|
||||
|
||||
TEST_F(QualityScalingTest, NoAdaptDownForLowStartBitrateIfScalingOff_Vp8) {
|
||||
// qp_low:1, qp_high:127 -> kNormalQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "1,127,0,0,0,0" + kEnd);
|
||||
test::ScopedKeyValueConfig field_trials(field_trials_,
|
||||
kPrefix + "1,127,0,0,0,0" + kEnd);
|
||||
|
||||
DownscalingObserver test("VP8", /*streams_active=*/{true}, kLowStartBps,
|
||||
/*automatic_resize=*/false,
|
||||
@ -410,8 +424,9 @@ TEST_F(QualityScalingTest, NoAdaptDownForLowStartBitrateIfScalingOff_Vp8) {
|
||||
|
||||
TEST_F(QualityScalingTest, AdaptsDownForHighQp_Vp9) {
|
||||
// qp_low:1, qp_high:1 -> kHighQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "0,0,1,1,0,0" + kEnd +
|
||||
"WebRTC-VP9QualityScaler/Enabled/");
|
||||
test::ScopedKeyValueConfig field_trials(
|
||||
field_trials_,
|
||||
kPrefix + "0,0,1,1,0,0" + kEnd + "WebRTC-VP9QualityScaler/Enabled/");
|
||||
|
||||
DownscalingObserver test("VP9", /*streams_active=*/{true}, kHighStartBps,
|
||||
/*automatic_resize=*/true,
|
||||
@ -421,8 +436,9 @@ TEST_F(QualityScalingTest, AdaptsDownForHighQp_Vp9) {
|
||||
|
||||
TEST_F(QualityScalingTest, NoAdaptDownForHighQpIfScalingOff_Vp9) {
|
||||
// qp_low:1, qp_high:1 -> kHighQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "0,0,1,1,0,0" + kEnd +
|
||||
"WebRTC-VP9QualityScaler/Disabled/");
|
||||
test::ScopedKeyValueConfig field_trials(
|
||||
field_trials_,
|
||||
kPrefix + "0,0,1,1,0,0" + kEnd + "WebRTC-VP9QualityScaler/Disabled/");
|
||||
|
||||
DownscalingObserver test("VP9", /*streams_active=*/{true}, kHighStartBps,
|
||||
/*automatic_resize=*/true,
|
||||
@ -432,8 +448,9 @@ TEST_F(QualityScalingTest, NoAdaptDownForHighQpIfScalingOff_Vp9) {
|
||||
|
||||
TEST_F(QualityScalingTest, AdaptsDownForLowStartBitrate_Vp9) {
|
||||
// qp_low:1, qp_high:255 -> kNormalQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "0,0,1,255,0,0" + kEnd +
|
||||
"WebRTC-VP9QualityScaler/Enabled/");
|
||||
test::ScopedKeyValueConfig field_trials(
|
||||
field_trials_,
|
||||
kPrefix + "0,0,1,255,0,0" + kEnd + "WebRTC-VP9QualityScaler/Enabled/");
|
||||
|
||||
DownscalingObserver test("VP9", /*streams_active=*/{true}, kLowStartBps,
|
||||
/*automatic_resize=*/true,
|
||||
@ -443,8 +460,9 @@ TEST_F(QualityScalingTest, AdaptsDownForLowStartBitrate_Vp9) {
|
||||
|
||||
TEST_F(QualityScalingTest, NoAdaptDownForHighQp_LowestStreamActive_Vp9) {
|
||||
// qp_low:1, qp_high:1 -> kHighQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "0,0,1,1,0,0" + kEnd +
|
||||
"WebRTC-VP9QualityScaler/Enabled/");
|
||||
test::ScopedKeyValueConfig field_trials(
|
||||
field_trials_,
|
||||
kPrefix + "0,0,1,1,0,0" + kEnd + "WebRTC-VP9QualityScaler/Enabled/");
|
||||
|
||||
DownscalingObserver test("VP9", /*streams_active=*/{true, false, false},
|
||||
kHighStartBps,
|
||||
@ -456,8 +474,9 @@ TEST_F(QualityScalingTest, NoAdaptDownForHighQp_LowestStreamActive_Vp9) {
|
||||
TEST_F(QualityScalingTest,
|
||||
NoAdaptDownForLowStartBitrate_LowestStreamActive_Vp9) {
|
||||
// qp_low:1, qp_high:255 -> kNormalQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "0,0,1,255,0,0" + kEnd +
|
||||
"WebRTC-VP9QualityScaler/Enabled/");
|
||||
test::ScopedKeyValueConfig field_trials(
|
||||
field_trials_,
|
||||
kPrefix + "0,0,1,255,0,0" + kEnd + "WebRTC-VP9QualityScaler/Enabled/");
|
||||
|
||||
DownscalingObserver test("VP9", /*streams_active=*/{true, false, false},
|
||||
kLowStartBps,
|
||||
@ -468,8 +487,9 @@ TEST_F(QualityScalingTest,
|
||||
|
||||
TEST_F(QualityScalingTest, AdaptsDownForHighQp_MiddleStreamActive_Vp9) {
|
||||
// qp_low:1, qp_high:1 -> kHighQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "0,0,1,1,0,0" + kEnd +
|
||||
"WebRTC-VP9QualityScaler/Enabled/");
|
||||
test::ScopedKeyValueConfig field_trials(
|
||||
field_trials_,
|
||||
kPrefix + "0,0,1,1,0,0" + kEnd + "WebRTC-VP9QualityScaler/Enabled/");
|
||||
|
||||
DownscalingObserver test("VP9", /*streams_active=*/{false, true, false},
|
||||
kHighStartBps,
|
||||
@ -481,8 +501,9 @@ TEST_F(QualityScalingTest, AdaptsDownForHighQp_MiddleStreamActive_Vp9) {
|
||||
TEST_F(QualityScalingTest,
|
||||
AdaptsDownForLowStartBitrate_MiddleStreamActive_Vp9) {
|
||||
// qp_low:1, qp_high:255 -> kNormalQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "0,0,1,255,0,0" + kEnd +
|
||||
"WebRTC-VP9QualityScaler/Enabled/");
|
||||
test::ScopedKeyValueConfig field_trials(
|
||||
field_trials_,
|
||||
kPrefix + "0,0,1,255,0,0" + kEnd + "WebRTC-VP9QualityScaler/Enabled/");
|
||||
|
||||
DownscalingObserver test("VP9", /*streams_active=*/{false, true, false},
|
||||
kSinglecastLimits360pVp9->min_start_bitrate_bps - 1,
|
||||
@ -493,8 +514,9 @@ TEST_F(QualityScalingTest,
|
||||
|
||||
TEST_F(QualityScalingTest, NoAdaptDownForLowStartBitrateIfBitrateEnough_Vp9) {
|
||||
// qp_low:1, qp_high:255 -> kNormalQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "0,0,1,255,0,0" + kEnd +
|
||||
"WebRTC-VP9QualityScaler/Enabled/");
|
||||
test::ScopedKeyValueConfig field_trials(
|
||||
field_trials_,
|
||||
kPrefix + "0,0,1,255,0,0" + kEnd + "WebRTC-VP9QualityScaler/Enabled/");
|
||||
|
||||
DownscalingObserver test("VP9", /*streams_active=*/{false, true, false},
|
||||
kSinglecastLimits360pVp9->min_start_bitrate_bps,
|
||||
@ -506,7 +528,8 @@ TEST_F(QualityScalingTest, NoAdaptDownForLowStartBitrateIfBitrateEnough_Vp9) {
|
||||
#if defined(WEBRTC_USE_H264)
|
||||
TEST_F(QualityScalingTest, AdaptsDownForHighQp_H264) {
|
||||
// qp_low:1, qp_high:1 -> kHighQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "0,0,0,0,1,1" + kEnd);
|
||||
test::ScopedKeyValueConfig field_trials(field_trials_,
|
||||
kPrefix + "0,0,0,0,1,1" + kEnd);
|
||||
|
||||
DownscalingObserver test("H264", /*streams_active=*/{true}, kHighStartBps,
|
||||
/*automatic_resize=*/true,
|
||||
@ -516,7 +539,8 @@ TEST_F(QualityScalingTest, AdaptsDownForHighQp_H264) {
|
||||
|
||||
TEST_F(QualityScalingTest, AdaptsDownForLowStartBitrate_H264) {
|
||||
// qp_low:1, qp_high:51 -> kNormalQp
|
||||
test::ScopedFieldTrials field_trials(kPrefix + "0,0,0,0,1,51" + kEnd);
|
||||
test::ScopedKeyValueConfig field_trials(field_trials_,
|
||||
kPrefix + "0,0,0,0,1,51" + kEnd);
|
||||
|
||||
DownscalingObserver test("H264", /*streams_active=*/{true}, kLowStartBps,
|
||||
/*automatic_resize=*/true,
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -78,14 +77,22 @@ std::string UmaSuffixForContentType(VideoContentType content_type) {
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
bool EnableDecodeTimeHistogram(const WebRtcKeyValueConfig* field_trials) {
|
||||
if (field_trials == nullptr) {
|
||||
return true;
|
||||
}
|
||||
return !field_trials->IsEnabled("WebRTC-DecodeTimeHistogramsKillSwitch");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
ReceiveStatisticsProxy::ReceiveStatisticsProxy(uint32_t remote_ssrc,
|
||||
Clock* clock)
|
||||
ReceiveStatisticsProxy::ReceiveStatisticsProxy(
|
||||
uint32_t remote_ssrc,
|
||||
Clock* clock,
|
||||
const WebRtcKeyValueConfig* field_trials)
|
||||
: clock_(clock),
|
||||
start_ms_(clock->TimeInMilliseconds()),
|
||||
enable_decode_time_histograms_(
|
||||
!field_trial::IsEnabled("WebRTC-DecodeTimeHistogramsKillSwitch")),
|
||||
enable_decode_time_histograms_(EnableDecodeTimeHistogram(field_trials)),
|
||||
last_sample_time_(clock->TimeInMilliseconds()),
|
||||
fps_threshold_(kLowFpsThreshold,
|
||||
kHighFpsThreshold,
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/sequence_checker.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "call/video_receive_stream.h"
|
||||
#include "modules/include/module_common_types.h"
|
||||
#include "modules/video_coding/include/video_coding_defines.h"
|
||||
@ -42,7 +43,9 @@ class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback,
|
||||
public RtcpPacketTypeCounterObserver,
|
||||
public CallStatsObserver {
|
||||
public:
|
||||
ReceiveStatisticsProxy(uint32_t remote_ssrc, Clock* clock);
|
||||
ReceiveStatisticsProxy(uint32_t remote_ssrc,
|
||||
Clock* clock,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
~ReceiveStatisticsProxy() = default;
|
||||
|
||||
VideoReceiveStream::Stats GetStats() const;
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
#include "rtc_base/thread.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
#include "video/video_receive_stream2.h"
|
||||
|
||||
@ -98,13 +97,15 @@ bool IsCurrentTaskQueueOrThread(TaskQueueBase* task_queue) {
|
||||
|
||||
} // namespace
|
||||
|
||||
ReceiveStatisticsProxy::ReceiveStatisticsProxy(uint32_t remote_ssrc,
|
||||
Clock* clock,
|
||||
TaskQueueBase* worker_thread)
|
||||
ReceiveStatisticsProxy::ReceiveStatisticsProxy(
|
||||
uint32_t remote_ssrc,
|
||||
Clock* clock,
|
||||
TaskQueueBase* worker_thread,
|
||||
const WebRtcKeyValueConfig& field_trials)
|
||||
: clock_(clock),
|
||||
start_ms_(clock->TimeInMilliseconds()),
|
||||
enable_decode_time_histograms_(
|
||||
!field_trial::IsEnabled("WebRTC-DecodeTimeHistogramsKillSwitch")),
|
||||
!field_trials.IsEnabled("WebRTC-DecodeTimeHistogramsKillSwitch")),
|
||||
last_sample_time_(clock->TimeInMilliseconds()),
|
||||
fps_threshold_(kLowFpsThreshold,
|
||||
kHighFpsThreshold,
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
#include "api/sequence_checker.h"
|
||||
#include "api/task_queue/task_queue_base.h"
|
||||
#include "api/units/timestamp.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "call/video_receive_stream.h"
|
||||
#include "modules/include/module_common_types.h"
|
||||
#include "modules/video_coding/include/video_coding_defines.h"
|
||||
@ -50,7 +51,8 @@ class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback,
|
||||
public:
|
||||
ReceiveStatisticsProxy(uint32_t remote_ssrc,
|
||||
Clock* clock,
|
||||
TaskQueueBase* worker_thread);
|
||||
TaskQueueBase* worker_thread,
|
||||
const WebRtcKeyValueConfig& field_trials);
|
||||
~ReceiveStatisticsProxy() override;
|
||||
|
||||
VideoReceiveStream::Stats GetStats() const;
|
||||
|
||||
@ -25,9 +25,9 @@
|
||||
#include "rtc_base/task_utils/to_queued_task.h"
|
||||
#include "rtc_base/thread.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/run_loop.h"
|
||||
#include "test/scoped_key_value_config.h"
|
||||
#include "video/video_receive_stream2.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -43,10 +43,11 @@ const int kHeight = 720;
|
||||
// TODO(sakal): ReceiveStatisticsProxy is lacking unittesting.
|
||||
class ReceiveStatisticsProxy2Test : public ::testing::Test {
|
||||
public:
|
||||
ReceiveStatisticsProxy2Test() : fake_clock_(1234) {
|
||||
explicit ReceiveStatisticsProxy2Test(std::string field_trials = "")
|
||||
: field_trials_(field_trials), fake_clock_(1234) {
|
||||
metrics::Reset();
|
||||
statistics_proxy_.reset(new ReceiveStatisticsProxy(
|
||||
kRemoteSsrc, &fake_clock_, loop_.task_queue()));
|
||||
kRemoteSsrc, &fake_clock_, loop_.task_queue(), field_trials_));
|
||||
}
|
||||
|
||||
~ReceiveStatisticsProxy2Test() override { statistics_proxy_.reset(); }
|
||||
@ -102,6 +103,7 @@ class ReceiveStatisticsProxy2Test : public ::testing::Test {
|
||||
return VideoFrameMetaData(frame, Now());
|
||||
}
|
||||
|
||||
test::ScopedKeyValueConfig field_trials_;
|
||||
SimulatedClock fake_clock_;
|
||||
std::unique_ptr<ReceiveStatisticsProxy> statistics_proxy_;
|
||||
test::RunLoop loop_;
|
||||
@ -1719,25 +1721,16 @@ TEST_P(ReceiveStatisticsProxy2TestWithContent,
|
||||
}
|
||||
}
|
||||
|
||||
class DecodeTimeHistogramsKillswitch {
|
||||
public:
|
||||
explicit DecodeTimeHistogramsKillswitch(bool disable_histograms)
|
||||
: field_trial_(disable_histograms
|
||||
? "WebRTC-DecodeTimeHistogramsKillSwitch/Enabled/"
|
||||
: "") {}
|
||||
|
||||
private:
|
||||
webrtc::test::ScopedFieldTrials field_trial_;
|
||||
};
|
||||
|
||||
class ReceiveStatisticsProxy2TestWithDecodeTimeHistograms
|
||||
: public DecodeTimeHistogramsKillswitch,
|
||||
public ::testing::WithParamInterface<
|
||||
: public ::testing::WithParamInterface<
|
||||
std::tuple<bool, int, int, int, VideoCodecType, std::string>>,
|
||||
public ReceiveStatisticsProxy2Test {
|
||||
public:
|
||||
ReceiveStatisticsProxy2TestWithDecodeTimeHistograms()
|
||||
: DecodeTimeHistogramsKillswitch(std::get<0>(GetParam())) {}
|
||||
: ReceiveStatisticsProxy2Test(
|
||||
std::get<0>(GetParam())
|
||||
? "WebRTC-DecodeTimeHistogramsKillSwitch/Enabled/"
|
||||
: "") {}
|
||||
|
||||
protected:
|
||||
const std::string kUmaPrefix = "WebRTC.Video.DecodeTimePerFrameInMs.";
|
||||
|
||||
@ -23,8 +23,8 @@
|
||||
#include "api/video/video_frame_buffer.h"
|
||||
#include "api/video/video_rotation.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/scoped_key_value_config.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace {
|
||||
@ -39,14 +39,17 @@ const int kHeight = 720;
|
||||
// TODO(sakal): ReceiveStatisticsProxy is lacking unittesting.
|
||||
class ReceiveStatisticsProxyTest : public ::testing::Test {
|
||||
public:
|
||||
ReceiveStatisticsProxyTest() : fake_clock_(1234), config_(GetTestConfig()) {}
|
||||
explicit ReceiveStatisticsProxyTest(std::string field_trials = "")
|
||||
: field_trials_(field_trials),
|
||||
fake_clock_(1234),
|
||||
config_(GetTestConfig()) {}
|
||||
virtual ~ReceiveStatisticsProxyTest() {}
|
||||
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
metrics::Reset();
|
||||
statistics_proxy_.reset(
|
||||
new ReceiveStatisticsProxy(config_.rtp.remote_ssrc, &fake_clock_));
|
||||
statistics_proxy_.reset(new ReceiveStatisticsProxy(
|
||||
config_.rtp.remote_ssrc, &fake_clock_, &field_trials_));
|
||||
}
|
||||
|
||||
VideoReceiveStream::Config GetTestConfig() {
|
||||
@ -76,6 +79,7 @@ class ReceiveStatisticsProxyTest : public ::testing::Test {
|
||||
return frame;
|
||||
}
|
||||
|
||||
test::ScopedKeyValueConfig field_trials_;
|
||||
SimulatedClock fake_clock_;
|
||||
const VideoReceiveStream::Config config_;
|
||||
std::unique_ptr<ReceiveStatisticsProxy> statistics_proxy_;
|
||||
@ -1692,25 +1696,16 @@ TEST_P(ReceiveStatisticsProxyTestWithContent,
|
||||
}
|
||||
}
|
||||
|
||||
class DecodeTimeHistogramsKillswitch {
|
||||
public:
|
||||
explicit DecodeTimeHistogramsKillswitch(bool disable_histograms)
|
||||
: field_trial_(disable_histograms
|
||||
? "WebRTC-DecodeTimeHistogramsKillSwitch/Enabled/"
|
||||
: "") {}
|
||||
|
||||
private:
|
||||
webrtc::test::ScopedFieldTrials field_trial_;
|
||||
};
|
||||
|
||||
class ReceiveStatisticsProxyTestWithDecodeTimeHistograms
|
||||
: public DecodeTimeHistogramsKillswitch,
|
||||
public ::testing::WithParamInterface<
|
||||
: public ::testing::WithParamInterface<
|
||||
std::tuple<bool, int, int, int, VideoCodecType, std::string>>,
|
||||
public ReceiveStatisticsProxyTest {
|
||||
public:
|
||||
ReceiveStatisticsProxyTestWithDecodeTimeHistograms()
|
||||
: DecodeTimeHistogramsKillswitch(std::get<0>(GetParam())) {}
|
||||
: ReceiveStatisticsProxyTest(
|
||||
std::get<0>(GetParam())
|
||||
? "WebRTC-DecodeTimeHistogramsKillSwitch/Enabled/"
|
||||
: "") {}
|
||||
|
||||
protected:
|
||||
const std::string kUmaPrefix = "WebRTC.Video.DecodeTimePerFrameInMs.";
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
#include "absl/algorithm/container.h"
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "media/base/media_constants.h"
|
||||
#include "modules/pacing/packet_router.h"
|
||||
#include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
|
||||
@ -46,7 +47,6 @@
|
||||
#include "rtc_base/location.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
#include "system_wrappers/include/ntp_time.h"
|
||||
#include "video/receive_statistics_proxy.h"
|
||||
@ -59,11 +59,11 @@ namespace {
|
||||
constexpr int kPacketBufferStartSize = 512;
|
||||
constexpr int kPacketBufferMaxSize = 2048;
|
||||
|
||||
int PacketBufferMaxSize() {
|
||||
int PacketBufferMaxSize(const WebRtcKeyValueConfig& field_trials) {
|
||||
// The group here must be a positive power of 2, in which case that is used as
|
||||
// size. All other values shall result in the default value being used.
|
||||
const std::string group_name =
|
||||
webrtc::field_trial::FindFullName("WebRTC-PacketBufferMaxSize");
|
||||
field_trials.Lookup("WebRTC-PacketBufferMaxSize");
|
||||
int packet_buffer_max_size = kPacketBufferMaxSize;
|
||||
if (!group_name.empty() &&
|
||||
(sscanf(group_name.c_str(), "%d", &packet_buffer_max_size) != 1 ||
|
||||
@ -211,7 +211,8 @@ RtpVideoStreamReceiver::RtpVideoStreamReceiver(
|
||||
KeyFrameRequestSender* keyframe_request_sender,
|
||||
OnCompleteFrameCallback* complete_frame_callback,
|
||||
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
|
||||
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer)
|
||||
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
|
||||
const WebRtcKeyValueConfig* field_trials)
|
||||
: RtpVideoStreamReceiver(clock,
|
||||
transport,
|
||||
rtt_stats,
|
||||
@ -225,7 +226,8 @@ RtpVideoStreamReceiver::RtpVideoStreamReceiver(
|
||||
keyframe_request_sender,
|
||||
complete_frame_callback,
|
||||
frame_decryptor,
|
||||
frame_transformer) {}
|
||||
frame_transformer,
|
||||
field_trials) {}
|
||||
|
||||
RtpVideoStreamReceiver::RtpVideoStreamReceiver(
|
||||
Clock* clock,
|
||||
@ -241,8 +243,10 @@ RtpVideoStreamReceiver::RtpVideoStreamReceiver(
|
||||
KeyFrameRequestSender* keyframe_request_sender,
|
||||
OnCompleteFrameCallback* complete_frame_callback,
|
||||
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
|
||||
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer)
|
||||
: clock_(clock),
|
||||
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
|
||||
const WebRtcKeyValueConfig* field_trials)
|
||||
: field_trials_(field_trials ? *field_trials : owned_field_trials_),
|
||||
clock_(clock),
|
||||
config_(*config),
|
||||
packet_router_(packet_router),
|
||||
process_thread_(process_thread),
|
||||
@ -270,7 +274,8 @@ RtpVideoStreamReceiver::RtpVideoStreamReceiver(
|
||||
// TODO(bugs.webrtc.org/10336): Let `rtcp_feedback_buffer_` communicate
|
||||
// directly with `rtp_rtcp_`.
|
||||
rtcp_feedback_buffer_(this, nack_sender, this),
|
||||
packet_buffer_(kPacketBufferStartSize, PacketBufferMaxSize()),
|
||||
packet_buffer_(kPacketBufferStartSize,
|
||||
PacketBufferMaxSize(field_trials_)),
|
||||
reference_finder_(std::make_unique<RtpFrameReferenceFinder>()),
|
||||
has_received_frame_(false),
|
||||
frames_decryptable_(false),
|
||||
@ -305,7 +310,7 @@ RtpVideoStreamReceiver::RtpVideoStreamReceiver(
|
||||
}
|
||||
ParseFieldTrial(
|
||||
{&forced_playout_delay_max_ms_, &forced_playout_delay_min_ms_},
|
||||
field_trial::FindFullName("WebRTC-ForcePlayoutDelay"));
|
||||
field_trials_.Lookup("WebRTC-ForcePlayoutDelay"));
|
||||
|
||||
process_thread_->RegisterModule(rtp_rtcp_.get(), RTC_FROM_HERE);
|
||||
|
||||
@ -324,7 +329,7 @@ RtpVideoStreamReceiver::RtpVideoStreamReceiver(
|
||||
// Only construct the encrypted receiver if frame encryption is enabled.
|
||||
if (config_.crypto_options.sframe.require_frame_encryption) {
|
||||
buffered_frame_decryptor_ =
|
||||
std::make_unique<BufferedFrameDecryptor>(this, this);
|
||||
std::make_unique<BufferedFrameDecryptor>(this, this, field_trials_);
|
||||
if (frame_decryptor != nullptr) {
|
||||
buffered_frame_decryptor_->SetFrameDecryptor(std::move(frame_decryptor));
|
||||
}
|
||||
@ -361,7 +366,7 @@ void RtpVideoStreamReceiver::AddReceiveCodec(
|
||||
const std::map<std::string, std::string>& codec_params,
|
||||
bool raw_payload) {
|
||||
if (codec_params.count(cricket::kH264FmtpSpsPpsIdrInKeyframe) ||
|
||||
field_trial::IsEnabled("WebRTC-SpsPpsIdrIsH264Keyframe")) {
|
||||
field_trials_.IsEnabled("WebRTC-SpsPpsIdrIsH264Keyframe")) {
|
||||
MutexLock lock(&packet_buffer_lock_);
|
||||
packet_buffer_.ForceSpsPpsIdrIsH264Keyframe();
|
||||
}
|
||||
@ -949,7 +954,7 @@ void RtpVideoStreamReceiver::SetFrameDecryptor(
|
||||
RTC_DCHECK_RUN_ON(&network_tc_);
|
||||
if (buffered_frame_decryptor_ == nullptr) {
|
||||
buffered_frame_decryptor_ =
|
||||
std::make_unique<BufferedFrameDecryptor>(this, this);
|
||||
std::make_unique<BufferedFrameDecryptor>(this, this, field_trials_);
|
||||
}
|
||||
buffered_frame_decryptor_->SetFrameDecryptor(std::move(frame_decryptor));
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include "api/array_view.h"
|
||||
#include "api/crypto/frame_decryptor_interface.h"
|
||||
#include "api/sequence_checker.h"
|
||||
#include "api/transport/field_trial_based_config.h"
|
||||
#include "api/units/timestamp.h"
|
||||
#include "api/video/color_space.h"
|
||||
#include "api/video/video_codec_type.h"
|
||||
@ -101,7 +102,8 @@ class RtpVideoStreamReceiver : public LossNotificationSender,
|
||||
KeyFrameRequestSender* keyframe_request_sender,
|
||||
OnCompleteFrameCallback* complete_frame_callback,
|
||||
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
|
||||
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer);
|
||||
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
|
||||
RtpVideoStreamReceiver(
|
||||
Clock* clock,
|
||||
@ -122,7 +124,8 @@ class RtpVideoStreamReceiver : public LossNotificationSender,
|
||||
KeyFrameRequestSender* keyframe_request_sender,
|
||||
OnCompleteFrameCallback* complete_frame_callback,
|
||||
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
|
||||
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer);
|
||||
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
~RtpVideoStreamReceiver() override;
|
||||
|
||||
void AddReceiveCodec(uint8_t payload_type,
|
||||
@ -326,6 +329,9 @@ class RtpVideoStreamReceiver : public LossNotificationSender,
|
||||
bool is_keyframe)
|
||||
RTC_RUN_ON(worker_task_checker_);
|
||||
|
||||
const WebRtcKeyValueConfig& field_trials_;
|
||||
FieldTrialBasedConfig owned_field_trials_;
|
||||
|
||||
Clock* const clock_;
|
||||
// Ownership of this object lies with VideoReceiveStream, which owns `this`.
|
||||
const VideoReceiveStream::Config& config_;
|
||||
|
||||
@ -45,7 +45,6 @@
|
||||
#include "rtc_base/location.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
#include "system_wrappers/include/ntp_time.h"
|
||||
|
||||
@ -57,11 +56,11 @@ namespace {
|
||||
constexpr int kPacketBufferStartSize = 512;
|
||||
constexpr int kPacketBufferMaxSize = 2048;
|
||||
|
||||
int PacketBufferMaxSize() {
|
||||
int PacketBufferMaxSize(const WebRtcKeyValueConfig& field_trials) {
|
||||
// The group here must be a positive power of 2, in which case that is used as
|
||||
// size. All other values shall result in the default value being used.
|
||||
const std::string group_name =
|
||||
webrtc::field_trial::FindFullName("WebRTC-PacketBufferMaxSize");
|
||||
field_trials.Lookup("WebRTC-PacketBufferMaxSize");
|
||||
int packet_buffer_max_size = kPacketBufferMaxSize;
|
||||
if (!group_name.empty() &&
|
||||
(sscanf(group_name.c_str(), "%d", &packet_buffer_max_size) != 1 ||
|
||||
@ -217,8 +216,10 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
|
||||
KeyFrameRequestSender* keyframe_request_sender,
|
||||
OnCompleteFrameCallback* complete_frame_callback,
|
||||
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
|
||||
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer)
|
||||
: clock_(clock),
|
||||
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
|
||||
const WebRtcKeyValueConfig& field_trials)
|
||||
: field_trials_(field_trials),
|
||||
clock_(clock),
|
||||
config_(*config),
|
||||
packet_router_(packet_router),
|
||||
ntp_estimator_(clock),
|
||||
@ -252,7 +253,8 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
|
||||
clock_,
|
||||
&rtcp_feedback_buffer_,
|
||||
&rtcp_feedback_buffer_)),
|
||||
packet_buffer_(kPacketBufferStartSize, PacketBufferMaxSize()),
|
||||
packet_buffer_(kPacketBufferStartSize,
|
||||
PacketBufferMaxSize(field_trials_)),
|
||||
reference_finder_(std::make_unique<RtpFrameReferenceFinder>()),
|
||||
has_received_frame_(false),
|
||||
frames_decryptable_(false),
|
||||
@ -289,7 +291,7 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
|
||||
|
||||
ParseFieldTrial(
|
||||
{&forced_playout_delay_max_ms_, &forced_playout_delay_min_ms_},
|
||||
field_trial::FindFullName("WebRTC-ForcePlayoutDelay"));
|
||||
field_trials_.Lookup("WebRTC-ForcePlayoutDelay"));
|
||||
|
||||
if (config_.rtp.lntf.enabled) {
|
||||
loss_notification_controller_ =
|
||||
@ -300,7 +302,7 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
|
||||
// Only construct the encrypted receiver if frame encryption is enabled.
|
||||
if (config_.crypto_options.sframe.require_frame_encryption) {
|
||||
buffered_frame_decryptor_ =
|
||||
std::make_unique<BufferedFrameDecryptor>(this, this);
|
||||
std::make_unique<BufferedFrameDecryptor>(this, this, field_trials_);
|
||||
if (frame_decryptor != nullptr) {
|
||||
buffered_frame_decryptor_->SetFrameDecryptor(std::move(frame_decryptor));
|
||||
}
|
||||
@ -330,7 +332,7 @@ void RtpVideoStreamReceiver2::AddReceiveCodec(
|
||||
bool raw_payload) {
|
||||
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
|
||||
if (codec_params.count(cricket::kH264FmtpSpsPpsIdrInKeyframe) ||
|
||||
field_trial::IsEnabled("WebRTC-SpsPpsIdrIsH264Keyframe")) {
|
||||
field_trials_.IsEnabled("WebRTC-SpsPpsIdrIsH264Keyframe")) {
|
||||
packet_buffer_.ForceSpsPpsIdrIsH264Keyframe();
|
||||
}
|
||||
payload_type_map_.emplace(
|
||||
@ -887,7 +889,7 @@ void RtpVideoStreamReceiver2::SetFrameDecryptor(
|
||||
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
|
||||
if (buffered_frame_decryptor_ == nullptr) {
|
||||
buffered_frame_decryptor_ =
|
||||
std::make_unique<BufferedFrameDecryptor>(this, this);
|
||||
std::make_unique<BufferedFrameDecryptor>(this, this, field_trials_);
|
||||
}
|
||||
buffered_frame_decryptor_->SetFrameDecryptor(std::move(frame_decryptor));
|
||||
}
|
||||
|
||||
@ -96,7 +96,8 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
|
||||
KeyFrameRequestSender* keyframe_request_sender,
|
||||
OnCompleteFrameCallback* complete_frame_callback,
|
||||
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
|
||||
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer);
|
||||
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
|
||||
const WebRtcKeyValueConfig& field_trials);
|
||||
~RtpVideoStreamReceiver2() override;
|
||||
|
||||
void AddReceiveCodec(uint8_t payload_type,
|
||||
@ -286,6 +287,7 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
|
||||
bool is_keyframe)
|
||||
RTC_RUN_ON(packet_sequence_checker_);
|
||||
|
||||
const WebRtcKeyValueConfig& field_trials_;
|
||||
Clock* const clock_;
|
||||
// Ownership of this object lies with VideoReceiveStream, which owns `this`.
|
||||
const VideoReceiveStream::Config& config_;
|
||||
|
||||
@ -33,12 +33,11 @@
|
||||
#include "rtc_base/byte_buffer.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/mock_frame_transformer.h"
|
||||
#include "test/mock_transport.h"
|
||||
#include "test/scoped_key_value_config.h"
|
||||
#include "test/time_controller/simulated_task_queue.h"
|
||||
#include "test/time_controller/simulated_time_controller.h"
|
||||
|
||||
@ -152,7 +151,7 @@ class RtpVideoStreamReceiver2Test : public ::testing::Test,
|
||||
"RtpVideoStreamReceiver2Test",
|
||||
TaskQueueFactory::Priority::NORMAL)),
|
||||
task_queue_setter_(task_queue_.get()),
|
||||
override_field_trials_(field_trials),
|
||||
field_trials_(field_trials),
|
||||
config_(CreateConfig()) {
|
||||
rtp_receive_statistics_ =
|
||||
ReceiveStatistics::Create(Clock::GetRealTimeClock());
|
||||
@ -161,7 +160,7 @@ class RtpVideoStreamReceiver2Test : public ::testing::Test,
|
||||
nullptr, nullptr, &config_, rtp_receive_statistics_.get(), nullptr,
|
||||
nullptr, &nack_periodic_processor_, &mock_nack_sender_,
|
||||
&mock_key_frame_request_sender_, &mock_on_complete_frame_callback_,
|
||||
nullptr, nullptr);
|
||||
nullptr, nullptr, field_trials_);
|
||||
rtp_video_stream_receiver_->AddReceiveCodec(kPayloadType,
|
||||
kVideoCodecGeneric, {},
|
||||
/*raw_payload=*/false);
|
||||
@ -229,7 +228,7 @@ class RtpVideoStreamReceiver2Test : public ::testing::Test,
|
||||
std::unique_ptr<TaskQueueBase, TaskQueueDeleter> task_queue_;
|
||||
TokenTaskQueue::CurrentTaskQueueSetter task_queue_setter_;
|
||||
|
||||
const webrtc::test::ScopedFieldTrials override_field_trials_;
|
||||
webrtc::test::ScopedKeyValueConfig field_trials_;
|
||||
VideoReceiveStream::Config config_;
|
||||
NackPeriodicProcessor nack_periodic_processor_;
|
||||
MockNackSender mock_nack_sender_;
|
||||
@ -1119,7 +1118,8 @@ TEST_F(RtpVideoStreamReceiver2Test, TransformFrame) {
|
||||
TaskQueueBase::Current(), Clock::GetRealTimeClock(), &mock_transport_,
|
||||
nullptr, nullptr, &config_, rtp_receive_statistics_.get(), nullptr,
|
||||
nullptr, &nack_periodic_processor_, &mock_nack_sender_, nullptr,
|
||||
&mock_on_complete_frame_callback_, nullptr, mock_frame_transformer);
|
||||
&mock_on_complete_frame_callback_, nullptr, mock_frame_transformer,
|
||||
field_trials_);
|
||||
receiver->AddReceiveCodec(kPayloadType, kVideoCodecGeneric, {},
|
||||
/*raw_payload=*/false);
|
||||
|
||||
|
||||
@ -33,12 +33,11 @@
|
||||
#include "rtc_base/byte_buffer.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/mock_frame_transformer.h"
|
||||
#include "test/mock_transport.h"
|
||||
#include "test/scoped_key_value_config.h"
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::ElementsAre;
|
||||
@ -144,7 +143,7 @@ class RtpVideoStreamReceiverTest : public ::testing::Test {
|
||||
public:
|
||||
RtpVideoStreamReceiverTest() : RtpVideoStreamReceiverTest("") {}
|
||||
explicit RtpVideoStreamReceiverTest(std::string field_trials)
|
||||
: override_field_trials_(field_trials),
|
||||
: field_trials_(field_trials),
|
||||
config_(CreateConfig()),
|
||||
process_thread_(ProcessThread::Create("TestThread")) {
|
||||
rtp_receive_statistics_ =
|
||||
@ -153,7 +152,7 @@ class RtpVideoStreamReceiverTest : public ::testing::Test {
|
||||
Clock::GetRealTimeClock(), &mock_transport_, nullptr, nullptr, &config_,
|
||||
rtp_receive_statistics_.get(), nullptr, nullptr, process_thread_.get(),
|
||||
&mock_nack_sender_, &mock_key_frame_request_sender_,
|
||||
&mock_on_complete_frame_callback_, nullptr, nullptr);
|
||||
&mock_on_complete_frame_callback_, nullptr, nullptr, &field_trials_);
|
||||
rtp_video_stream_receiver_->AddReceiveCodec(kPayloadType,
|
||||
kVideoCodecGeneric, {},
|
||||
/*raw_payload=*/false);
|
||||
@ -211,7 +210,7 @@ class RtpVideoStreamReceiverTest : public ::testing::Test {
|
||||
return config;
|
||||
}
|
||||
|
||||
const webrtc::test::ScopedFieldTrials override_field_trials_;
|
||||
webrtc::test::ScopedKeyValueConfig field_trials_;
|
||||
VideoReceiveStream::Config config_;
|
||||
MockNackSender mock_nack_sender_;
|
||||
MockKeyFrameRequestSender mock_key_frame_request_sender_;
|
||||
@ -1159,7 +1158,7 @@ TEST_F(RtpVideoStreamReceiverTest, TransformFrame) {
|
||||
Clock::GetRealTimeClock(), &mock_transport_, nullptr, nullptr, &config_,
|
||||
rtp_receive_statistics_.get(), nullptr, nullptr, process_thread_.get(),
|
||||
&mock_nack_sender_, nullptr, &mock_on_complete_frame_callback_, nullptr,
|
||||
mock_frame_transformer);
|
||||
mock_frame_transformer, &field_trials_);
|
||||
receiver->AddReceiveCodec(kPayloadType, kVideoCodecGeneric, {},
|
||||
/*raw_payload=*/false);
|
||||
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/numerics/mod_ops.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -110,17 +109,17 @@ absl::optional<int> GetFallbackMaxPixels(const std::string& group) {
|
||||
return absl::optional<int>(max_pixels);
|
||||
}
|
||||
|
||||
absl::optional<int> GetFallbackMaxPixelsIfFieldTrialEnabled() {
|
||||
std::string group =
|
||||
webrtc::field_trial::FindFullName(kVp8ForcedFallbackEncoderFieldTrial);
|
||||
absl::optional<int> GetFallbackMaxPixelsIfFieldTrialEnabled(
|
||||
const webrtc::WebRtcKeyValueConfig& field_trials) {
|
||||
std::string group = field_trials.Lookup(kVp8ForcedFallbackEncoderFieldTrial);
|
||||
return (absl::StartsWith(group, "Enabled"))
|
||||
? GetFallbackMaxPixels(group.substr(7))
|
||||
: absl::optional<int>();
|
||||
}
|
||||
|
||||
absl::optional<int> GetFallbackMaxPixelsIfFieldTrialDisabled() {
|
||||
std::string group =
|
||||
webrtc::field_trial::FindFullName(kVp8ForcedFallbackEncoderFieldTrial);
|
||||
absl::optional<int> GetFallbackMaxPixelsIfFieldTrialDisabled(
|
||||
const webrtc::WebRtcKeyValueConfig& field_trials) {
|
||||
std::string group = field_trials.Lookup(kVp8ForcedFallbackEncoderFieldTrial);
|
||||
return (absl::StartsWith(group, "Disabled"))
|
||||
? GetFallbackMaxPixels(group.substr(8))
|
||||
: absl::optional<int>();
|
||||
@ -132,12 +131,15 @@ const int SendStatisticsProxy::kStatsTimeoutMs = 5000;
|
||||
SendStatisticsProxy::SendStatisticsProxy(
|
||||
Clock* clock,
|
||||
const VideoSendStream::Config& config,
|
||||
VideoEncoderConfig::ContentType content_type)
|
||||
VideoEncoderConfig::ContentType content_type,
|
||||
const WebRtcKeyValueConfig& field_trials)
|
||||
: clock_(clock),
|
||||
payload_name_(config.rtp.payload_name),
|
||||
rtp_config_(config.rtp),
|
||||
fallback_max_pixels_(GetFallbackMaxPixelsIfFieldTrialEnabled()),
|
||||
fallback_max_pixels_disabled_(GetFallbackMaxPixelsIfFieldTrialDisabled()),
|
||||
fallback_max_pixels_(
|
||||
GetFallbackMaxPixelsIfFieldTrialEnabled(field_trials)),
|
||||
fallback_max_pixels_disabled_(
|
||||
GetFallbackMaxPixelsIfFieldTrialDisabled(field_trials)),
|
||||
content_type_(content_type),
|
||||
start_ms_(clock->TimeInMilliseconds()),
|
||||
encode_time_(kEncodeTimeWeigthFactor),
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
#include "api/video/video_codec_constants.h"
|
||||
#include "api/video/video_stream_encoder_observer.h"
|
||||
#include "api/video_codecs/video_encoder_config.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "call/video_send_stream.h"
|
||||
#include "modules/include/module_common_types_public.h"
|
||||
#include "modules/rtp_rtcp/include/report_block_data.h"
|
||||
@ -51,7 +52,8 @@ class SendStatisticsProxy : public VideoStreamEncoderObserver,
|
||||
|
||||
SendStatisticsProxy(Clock* clock,
|
||||
const VideoSendStream::Config& config,
|
||||
VideoEncoderConfig::ContentType content_type);
|
||||
VideoEncoderConfig::ContentType content_type,
|
||||
const WebRtcKeyValueConfig& field_trials);
|
||||
~SendStatisticsProxy() override;
|
||||
|
||||
virtual VideoSendStream::Stats GetStats();
|
||||
|
||||
@ -25,8 +25,8 @@
|
||||
#include "api/video_codecs/video_encoder_config.h"
|
||||
#include "rtc_base/fake_clock.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/scoped_key_value_config.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace {
|
||||
@ -70,9 +70,10 @@ class SendStatisticsProxyTest : public ::testing::Test {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
metrics::Reset();
|
||||
statistics_proxy_.reset(new SendStatisticsProxy(
|
||||
&fake_clock_, GetTestConfig(),
|
||||
VideoEncoderConfig::ContentType::kRealtimeVideo));
|
||||
statistics_proxy_.reset(
|
||||
new SendStatisticsProxy(&fake_clock_, GetTestConfig(),
|
||||
VideoEncoderConfig::ContentType::kRealtimeVideo,
|
||||
override_field_trials_));
|
||||
expected_ = VideoSendStream::Stats();
|
||||
for (const auto& ssrc : config_.rtp.ssrcs) {
|
||||
expected_.substreams[ssrc].type =
|
||||
@ -175,7 +176,7 @@ class SendStatisticsProxyTest : public ::testing::Test {
|
||||
}
|
||||
}
|
||||
|
||||
test::ScopedFieldTrials override_field_trials_;
|
||||
test::ScopedKeyValueConfig override_field_trials_;
|
||||
SimulatedClock fake_clock_;
|
||||
std::unique_ptr<SendStatisticsProxy> statistics_proxy_;
|
||||
VideoSendStream::Config config_;
|
||||
@ -1925,10 +1926,12 @@ TEST_F(SendStatisticsProxyTest, VerifyQpHistogramStats_Vp8) {
|
||||
}
|
||||
|
||||
TEST_F(SendStatisticsProxyTest, VerifyQpHistogramStats_Vp8OneSsrc) {
|
||||
test::ScopedKeyValueConfig field_trials;
|
||||
VideoSendStream::Config config(nullptr);
|
||||
config.rtp.ssrcs.push_back(kFirstSsrc);
|
||||
statistics_proxy_.reset(new SendStatisticsProxy(
|
||||
&fake_clock_, config, VideoEncoderConfig::ContentType::kRealtimeVideo));
|
||||
&fake_clock_, config, VideoEncoderConfig::ContentType::kRealtimeVideo,
|
||||
field_trials));
|
||||
|
||||
EncodedImage encoded_image;
|
||||
CodecSpecificInfo codec_info;
|
||||
@ -1969,10 +1972,12 @@ TEST_F(SendStatisticsProxyTest, VerifyQpHistogramStats_Vp9) {
|
||||
}
|
||||
|
||||
TEST_F(SendStatisticsProxyTest, VerifyQpHistogramStats_Vp9OneSpatialLayer) {
|
||||
test::ScopedKeyValueConfig field_trials;
|
||||
VideoSendStream::Config config(nullptr);
|
||||
config.rtp.ssrcs.push_back(kFirstSsrc);
|
||||
statistics_proxy_.reset(new SendStatisticsProxy(
|
||||
&fake_clock_, config, VideoEncoderConfig::ContentType::kRealtimeVideo));
|
||||
&fake_clock_, config, VideoEncoderConfig::ContentType::kRealtimeVideo,
|
||||
field_trials));
|
||||
|
||||
EncodedImage encoded_image;
|
||||
CodecSpecificInfo codec_info;
|
||||
@ -2504,9 +2509,10 @@ TEST_F(SendStatisticsProxyTest, GetStatsReportsIsRtx) {
|
||||
}
|
||||
|
||||
TEST_F(SendStatisticsProxyTest, GetStatsReportsIsFlexFec) {
|
||||
statistics_proxy_.reset(
|
||||
new SendStatisticsProxy(&fake_clock_, GetTestConfigWithFlexFec(),
|
||||
VideoEncoderConfig::ContentType::kRealtimeVideo));
|
||||
test::ScopedKeyValueConfig field_trials;
|
||||
statistics_proxy_.reset(new SendStatisticsProxy(
|
||||
&fake_clock_, GetTestConfigWithFlexFec(),
|
||||
VideoEncoderConfig::ContentType::kRealtimeVideo, field_trials));
|
||||
|
||||
StreamDataCountersCallback* proxy =
|
||||
static_cast<StreamDataCountersCallback*>(statistics_proxy_.get());
|
||||
@ -2523,9 +2529,10 @@ TEST_F(SendStatisticsProxyTest, GetStatsReportsIsFlexFec) {
|
||||
}
|
||||
|
||||
TEST_F(SendStatisticsProxyTest, SendBitratesAreReportedWithFlexFecEnabled) {
|
||||
statistics_proxy_.reset(
|
||||
new SendStatisticsProxy(&fake_clock_, GetTestConfigWithFlexFec(),
|
||||
VideoEncoderConfig::ContentType::kRealtimeVideo));
|
||||
test::ScopedKeyValueConfig field_trials;
|
||||
statistics_proxy_.reset(new SendStatisticsProxy(
|
||||
&fake_clock_, GetTestConfigWithFlexFec(),
|
||||
VideoEncoderConfig::ContentType::kRealtimeVideo, field_trials));
|
||||
|
||||
StreamDataCountersCallback* proxy =
|
||||
static_cast<StreamDataCountersCallback*>(statistics_proxy_.get());
|
||||
@ -2730,10 +2737,12 @@ TEST_F(SendStatisticsProxyTest, RtxBitrateIsZeroWhenEnabledAndNoRtxDataIsSent) {
|
||||
}
|
||||
|
||||
TEST_F(SendStatisticsProxyTest, RtxBitrateNotReportedWhenNotEnabled) {
|
||||
test::ScopedKeyValueConfig field_trials;
|
||||
VideoSendStream::Config config(nullptr);
|
||||
config.rtp.ssrcs.push_back(kFirstSsrc); // RTX not configured.
|
||||
statistics_proxy_.reset(new SendStatisticsProxy(
|
||||
&fake_clock_, config, VideoEncoderConfig::ContentType::kRealtimeVideo));
|
||||
&fake_clock_, config, VideoEncoderConfig::ContentType::kRealtimeVideo,
|
||||
field_trials));
|
||||
|
||||
StreamDataCountersCallback* proxy =
|
||||
static_cast<StreamDataCountersCallback*>(statistics_proxy_.get());
|
||||
@ -2781,10 +2790,12 @@ TEST_F(SendStatisticsProxyTest, FecBitrateIsZeroWhenEnabledAndNoFecDataIsSent) {
|
||||
}
|
||||
|
||||
TEST_F(SendStatisticsProxyTest, FecBitrateNotReportedWhenNotEnabled) {
|
||||
test::ScopedKeyValueConfig field_trials;
|
||||
VideoSendStream::Config config(nullptr);
|
||||
config.rtp.ssrcs.push_back(kFirstSsrc); // FEC not configured.
|
||||
statistics_proxy_.reset(new SendStatisticsProxy(
|
||||
&fake_clock_, config, VideoEncoderConfig::ContentType::kRealtimeVideo));
|
||||
&fake_clock_, config, VideoEncoderConfig::ContentType::kRealtimeVideo,
|
||||
field_trials));
|
||||
|
||||
StreamDataCountersCallback* proxy =
|
||||
static_cast<StreamDataCountersCallback*>(statistics_proxy_.get());
|
||||
|
||||
@ -62,7 +62,6 @@
|
||||
#include "rtc_base/time_utils.h"
|
||||
#include "rtc_base/trace_event.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "video/call_stats2.h"
|
||||
#include "video/frame_decode_scheduler.h"
|
||||
#include "video/frame_dumping_decoder.h"
|
||||
@ -131,12 +130,12 @@ class WebRtcRecordableEncodedFrame : public RecordableEncodedFrame {
|
||||
absl::optional<webrtc::ColorSpace> color_space_;
|
||||
};
|
||||
|
||||
RenderResolution InitialDecoderResolution() {
|
||||
RenderResolution InitialDecoderResolution(
|
||||
const WebRtcKeyValueConfig& field_trials) {
|
||||
FieldTrialOptional<int> width("w");
|
||||
FieldTrialOptional<int> height("h");
|
||||
ParseFieldTrial(
|
||||
{&width, &height},
|
||||
field_trial::FindFullName("WebRTC-Video-InitialDecoderResolution"));
|
||||
ParseFieldTrial({&width, &height},
|
||||
field_trials.Lookup("WebRTC-Video-InitialDecoderResolution"));
|
||||
if (width && height) {
|
||||
return RenderResolution(width.Value(), height.Value());
|
||||
}
|
||||
@ -221,7 +220,10 @@ VideoReceiveStream2::VideoReceiveStream2(
|
||||
clock_(clock),
|
||||
call_stats_(call_stats),
|
||||
source_tracker_(clock_),
|
||||
stats_proxy_(config_.rtp.remote_ssrc, clock_, call->worker_thread()),
|
||||
stats_proxy_(config_.rtp.remote_ssrc,
|
||||
clock_,
|
||||
call->worker_thread(),
|
||||
call->trials()),
|
||||
rtp_receive_statistics_(ReceiveStatistics::Create(clock_)),
|
||||
timing_(timing),
|
||||
video_receiver_(clock_, timing_.get()),
|
||||
@ -239,7 +241,8 @@ VideoReceiveStream2::VideoReceiveStream2(
|
||||
nullptr, // Use default KeyFrameRequestSender
|
||||
this, // OnCompleteFrameCallback
|
||||
std::move(config_.frame_decryptor),
|
||||
std::move(config_.frame_transformer)),
|
||||
std::move(config_.frame_transformer),
|
||||
call->trials()),
|
||||
rtp_stream_sync_(call->worker_thread(), this),
|
||||
max_wait_for_keyframe_ms_(DetermineMaxWaitForFrame(config_, true)),
|
||||
max_wait_for_frame_ms_(DetermineMaxWaitForFrame(config_, false)),
|
||||
@ -274,7 +277,7 @@ VideoReceiveStream2::VideoReceiveStream2(
|
||||
frame_buffer_ = FrameBufferProxy::CreateFromFieldTrial(
|
||||
clock_, call_->worker_thread(), timing_.get(), &stats_proxy_,
|
||||
&decode_queue_, this, TimeDelta::Millis(max_wait_for_keyframe_ms_),
|
||||
TimeDelta::Millis(max_wait_for_frame_ms_), decode_sync_);
|
||||
TimeDelta::Millis(max_wait_for_frame_ms_), decode_sync_, call_->trials());
|
||||
|
||||
if (config_.rtp.rtx_ssrc) {
|
||||
rtx_receive_stream_ = std::make_unique<RtxReceiveStream>(
|
||||
@ -287,12 +290,12 @@ VideoReceiveStream2::VideoReceiveStream2(
|
||||
|
||||
ParseFieldTrial({&low_latency_renderer_enabled_,
|
||||
&low_latency_renderer_include_predecode_buffer_},
|
||||
field_trial::FindFullName("WebRTC-LowLatencyRenderer"));
|
||||
call_->trials().Lookup("WebRTC-LowLatencyRenderer"));
|
||||
ParseFieldTrial(
|
||||
{
|
||||
&maximum_pre_stream_decoders_,
|
||||
},
|
||||
field_trial::FindFullName("WebRTC-PreStreamDecoders"));
|
||||
call_->trials().Lookup("WebRTC-PreStreamDecoders"));
|
||||
}
|
||||
|
||||
VideoReceiveStream2::~VideoReceiveStream2() {
|
||||
@ -388,7 +391,8 @@ void VideoReceiveStream2::Start() {
|
||||
VideoDecoder::Settings settings;
|
||||
settings.set_codec_type(
|
||||
PayloadStringToCodecType(decoder.video_format.name));
|
||||
settings.set_max_render_resolution(InitialDecoderResolution());
|
||||
settings.set_max_render_resolution(
|
||||
InitialDecoderResolution(call_->trials()));
|
||||
settings.set_number_of_cores(num_cpu_cores_);
|
||||
|
||||
const bool raw_payload =
|
||||
@ -504,7 +508,7 @@ void VideoReceiveStream2::CreateAndRegisterExternalDecoder(
|
||||
}
|
||||
|
||||
std::string decoded_output_file =
|
||||
field_trial::FindFullName("WebRTC-DecoderDataDumpDirectory");
|
||||
call_->trials().Lookup("WebRTC-DecoderDataDumpDirectory");
|
||||
// Because '/' can't be used inside a field trial parameter, we use ';'
|
||||
// instead.
|
||||
// This is only relevant to WebRTC-DecoderDataDumpDirectory
|
||||
|
||||
@ -332,6 +332,7 @@ class VideoReceiveStream2
|
||||
// Used to signal destruction to potentially pending tasks.
|
||||
ScopedTaskSafety task_safety_;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
} // namespace webrtc
|
||||
|
||||
|
||||
@ -33,11 +33,11 @@
|
||||
#include "rtc_base/event.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "test/fake_decoder.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/mock_transport.h"
|
||||
#include "test/run_loop.h"
|
||||
#include "test/scoped_key_value_config.h"
|
||||
#include "test/time_controller/simulated_time_controller.h"
|
||||
#include "test/video_decoder_proxy_factory.h"
|
||||
#include "video/call_stats2.h"
|
||||
@ -79,8 +79,9 @@ class VideoReceiveStream2Test : public ::testing::Test {
|
||||
: task_queue_factory_(CreateDefaultTaskQueueFactory()),
|
||||
h264_decoder_factory_(&mock_h264_video_decoder_),
|
||||
config_(&mock_transport_, &h264_decoder_factory_),
|
||||
call_stats_(Clock::GetRealTimeClock(), loop_.task_queue()),
|
||||
field_trials_("WebRTC-FrameBuffer3/arm:FrameBuffer3/") {}
|
||||
call_stats_(Clock::GetRealTimeClock(), loop_.task_queue()) {
|
||||
fake_call_.SetFieldTrial("WebRTC-FrameBuffer3/arm:FrameBuffer3/");
|
||||
}
|
||||
~VideoReceiveStream2Test() override {
|
||||
if (video_receive_stream_)
|
||||
video_receive_stream_->UnregisterFromTransport();
|
||||
@ -127,7 +128,6 @@ class VideoReceiveStream2Test : public ::testing::Test {
|
||||
std::unique_ptr<webrtc::internal::VideoReceiveStream2> video_receive_stream_;
|
||||
Clock* clock_;
|
||||
VCMTiming* timing_;
|
||||
const test::ScopedFieldTrials field_trials_;
|
||||
};
|
||||
|
||||
TEST_F(VideoReceiveStream2Test, CreateFrameFromH264FmtpSpropAndIdr) {
|
||||
@ -538,9 +538,6 @@ class VideoReceiveStream2TestWithSimulatedClock
|
||||
|
||||
VideoReceiveStream2TestWithSimulatedClock()
|
||||
: time_controller_(Timestamp::Millis(4711)),
|
||||
field_trials_(std::get<1>(GetParam())
|
||||
? "WebRTC-FrameBuffer3/arm:FrameBuffer3/"
|
||||
: "WebRTC-FrameBuffer3/arm:FrameBuffer2/"),
|
||||
fake_decoder_factory_([this] {
|
||||
return std::make_unique<FakeDecoder2>([this] { OnFrameDecoded(); });
|
||||
}),
|
||||
@ -558,6 +555,11 @@ class VideoReceiveStream2TestWithSimulatedClock
|
||||
new VCMTiming(time_controller_.GetClock()),
|
||||
&nack_periodic_processor_,
|
||||
nullptr) {
|
||||
if (std::get<1>(GetParam())) {
|
||||
fake_call_.SetFieldTrial("WebRTC-FrameBuffer3/arm:FrameBuffer3/");
|
||||
} else {
|
||||
fake_call_.SetFieldTrial("WebRTC-FrameBuffer3/arm:FrameBuffer2/");
|
||||
}
|
||||
video_receive_stream_.RegisterWithTransport(
|
||||
&rtp_stream_receiver_controller_);
|
||||
video_receive_stream_.Start();
|
||||
@ -582,7 +584,6 @@ class VideoReceiveStream2TestWithSimulatedClock
|
||||
|
||||
protected:
|
||||
GlobalSimulatedTimeController time_controller_;
|
||||
test::ScopedFieldTrials field_trials_;
|
||||
test::RunLoop loop_;
|
||||
test::FunctionVideoDecoderFactory fake_decoder_factory_;
|
||||
MockTransport mock_transport_;
|
||||
@ -721,8 +722,7 @@ class VideoReceiveStream2TestWithLazyDecoderCreation : public ::testing::Test {
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
webrtc::test::ScopedFieldTrials field_trials(
|
||||
"WebRTC-PreStreamDecoders/max:0/");
|
||||
fake_call_.SetFieldTrial("WebRTC-PreStreamDecoders/max:0/");
|
||||
constexpr int kDefaultNumCpuCores = 2;
|
||||
config_.rtp.remote_ssrc = 1111;
|
||||
config_.rtp.local_ssrc = 2222;
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "rtc_base/task_utils/to_queued_task.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "video/adaptation/overuse_frame_detector.h"
|
||||
#include "video/frame_cadence_adapter.h"
|
||||
#include "video/video_stream_encoder.h"
|
||||
@ -63,7 +62,8 @@ size_t CalculateMaxHeaderSize(const RtpConfig& config) {
|
||||
}
|
||||
|
||||
VideoStreamEncoder::BitrateAllocationCallbackType
|
||||
GetBitrateAllocationCallbackType(const VideoSendStream::Config& config) {
|
||||
GetBitrateAllocationCallbackType(const VideoSendStream::Config& config,
|
||||
const WebRtcKeyValueConfig& field_trials) {
|
||||
if (webrtc::RtpExtension::FindHeaderExtensionByUri(
|
||||
config.rtp.extensions,
|
||||
webrtc::RtpExtension::kVideoLayersAllocationUri,
|
||||
@ -73,7 +73,7 @@ GetBitrateAllocationCallbackType(const VideoSendStream::Config& config) {
|
||||
return VideoStreamEncoder::BitrateAllocationCallbackType::
|
||||
kVideoLayersAllocation;
|
||||
}
|
||||
if (field_trial::IsEnabled("WebRTC-Target-Bitrate-Rtcp")) {
|
||||
if (field_trials.IsEnabled("WebRTC-Target-Bitrate-Rtcp")) {
|
||||
return VideoStreamEncoder::BitrateAllocationCallbackType::
|
||||
kVideoBitrateAllocation;
|
||||
}
|
||||
@ -123,7 +123,8 @@ std::unique_ptr<VideoStreamEncoder> CreateVideoStreamEncoder(
|
||||
return std::make_unique<VideoStreamEncoder>(
|
||||
clock, num_cpu_cores, stats_proxy, encoder_settings,
|
||||
std::make_unique<OveruseFrameDetector>(stats_proxy),
|
||||
FrameCadenceAdapterInterface::Create(clock, encoder_queue_ptr),
|
||||
FrameCadenceAdapterInterface::Create(clock, encoder_queue_ptr,
|
||||
field_trials),
|
||||
std::move(encoder_queue), bitrate_allocation_callback_type, field_trials);
|
||||
}
|
||||
|
||||
@ -149,17 +150,17 @@ VideoSendStream::VideoSendStream(
|
||||
const WebRtcKeyValueConfig& field_trials)
|
||||
: rtp_transport_queue_(transport->GetWorkerQueue()),
|
||||
transport_(transport),
|
||||
stats_proxy_(clock, config, encoder_config.content_type),
|
||||
stats_proxy_(clock, config, encoder_config.content_type, field_trials),
|
||||
config_(std::move(config)),
|
||||
content_type_(encoder_config.content_type),
|
||||
video_stream_encoder_(
|
||||
CreateVideoStreamEncoder(clock,
|
||||
num_cpu_cores,
|
||||
task_queue_factory,
|
||||
&stats_proxy_,
|
||||
config_.encoder_settings,
|
||||
GetBitrateAllocationCallbackType(config_),
|
||||
field_trials)),
|
||||
video_stream_encoder_(CreateVideoStreamEncoder(
|
||||
clock,
|
||||
num_cpu_cores,
|
||||
task_queue_factory,
|
||||
&stats_proxy_,
|
||||
config_.encoder_settings,
|
||||
GetBitrateAllocationCallbackType(config_, field_trials),
|
||||
field_trials)),
|
||||
encoder_feedback_(
|
||||
clock,
|
||||
config_.rtp.ssrcs,
|
||||
@ -191,7 +192,8 @@ VideoSendStream::VideoSendStream(
|
||||
encoder_config.max_bitrate_bps,
|
||||
encoder_config.bitrate_priority,
|
||||
encoder_config.content_type,
|
||||
rtp_video_sender_) {
|
||||
rtp_video_sender_,
|
||||
field_trials) {
|
||||
RTC_DCHECK(config_.encoder_settings.encoder_factory);
|
||||
RTC_DCHECK(config_.encoder_settings.bitrate_allocator_factory);
|
||||
|
||||
|
||||
@ -192,12 +192,12 @@ uint32_t GetInitialEncoderMaxBitrate(int initial_encoder_max_bitrate) {
|
||||
|
||||
} // namespace
|
||||
|
||||
PacingConfig::PacingConfig()
|
||||
PacingConfig::PacingConfig(const WebRtcKeyValueConfig& field_trials)
|
||||
: pacing_factor("factor", kStrictPacingMultiplier),
|
||||
max_pacing_delay("max_delay",
|
||||
TimeDelta::Millis(PacedSender::kMaxQueueLengthMs)) {
|
||||
ParseFieldTrial({&pacing_factor, &max_pacing_delay},
|
||||
field_trial::FindFullName("WebRTC-Video-Pacing"));
|
||||
field_trials.Lookup("WebRTC-Video-Pacing"));
|
||||
}
|
||||
PacingConfig::PacingConfig(const PacingConfig&) = default;
|
||||
PacingConfig::~PacingConfig() = default;
|
||||
@ -213,11 +213,12 @@ VideoSendStreamImpl::VideoSendStreamImpl(
|
||||
int initial_encoder_max_bitrate,
|
||||
double initial_encoder_bitrate_priority,
|
||||
VideoEncoderConfig::ContentType content_type,
|
||||
RtpVideoSenderInterface* rtp_video_sender)
|
||||
RtpVideoSenderInterface* rtp_video_sender,
|
||||
const WebRtcKeyValueConfig& field_trials)
|
||||
: clock_(clock),
|
||||
has_alr_probing_(config->periodic_alr_bandwidth_probing ||
|
||||
GetAlrSettings(content_type)),
|
||||
pacing_config_(PacingConfig()),
|
||||
pacing_config_(PacingConfig(field_trials)),
|
||||
stats_proxy_(stats_proxy),
|
||||
config_(config),
|
||||
rtp_transport_queue_(rtp_transport_queue),
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "api/video/video_stream_encoder_interface.h"
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
#include "api/video_codecs/video_encoder_config.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "call/bitrate_allocator.h"
|
||||
#include "call/rtp_config.h"
|
||||
#include "call/rtp_transport_controller_send_interface.h"
|
||||
@ -45,7 +46,7 @@ namespace internal {
|
||||
|
||||
// Pacing buffer config; overridden by ALR config if provided.
|
||||
struct PacingConfig {
|
||||
PacingConfig();
|
||||
explicit PacingConfig(const WebRtcKeyValueConfig& field_trials);
|
||||
PacingConfig(const PacingConfig&);
|
||||
PacingConfig& operator=(const PacingConfig&) = default;
|
||||
~PacingConfig();
|
||||
@ -73,7 +74,8 @@ class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver,
|
||||
int initial_encoder_max_bitrate,
|
||||
double initial_encoder_bitrate_priority,
|
||||
VideoEncoderConfig::ContentType content_type,
|
||||
RtpVideoSenderInterface* rtp_video_sender);
|
||||
RtpVideoSenderInterface* rtp_video_sender,
|
||||
const WebRtcKeyValueConfig& field_trials);
|
||||
~VideoSendStreamImpl() override;
|
||||
|
||||
void DeliverRtcp(const uint8_t* packet, size_t length);
|
||||
|
||||
@ -24,10 +24,10 @@
|
||||
#include "rtc_base/experiments/alr_experiment.h"
|
||||
#include "rtc_base/fake_clock.h"
|
||||
#include "rtc_base/task_queue_for_test.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/mock_transport.h"
|
||||
#include "test/scoped_key_value_config.h"
|
||||
#include "video/test/mock_video_stream_encoder.h"
|
||||
#include "video/video_send_stream.h"
|
||||
|
||||
@ -119,7 +119,8 @@ class VideoSendStreamImplTest : public ::testing::Test {
|
||||
test_queue_("test_queue"),
|
||||
stats_proxy_(&clock_,
|
||||
config_,
|
||||
VideoEncoderConfig::ContentType::kRealtimeVideo) {
|
||||
VideoEncoderConfig::ContentType::kRealtimeVideo,
|
||||
field_trials_) {
|
||||
config_.rtp.ssrcs.push_back(8080);
|
||||
config_.rtp.payload_type = 1;
|
||||
|
||||
@ -151,7 +152,7 @@ class VideoSendStreamImplTest : public ::testing::Test {
|
||||
&clock_, &stats_proxy_, &test_queue_, &transport_controller_,
|
||||
&bitrate_allocator_, &video_stream_encoder_, &config_,
|
||||
initial_encoder_max_bitrate, initial_encoder_bitrate_priority,
|
||||
content_type, &rtp_video_sender_);
|
||||
content_type, &rtp_video_sender_, field_trials_);
|
||||
|
||||
// The call to GetStartBitrate() executes asynchronously on the tq.
|
||||
test_queue_.WaitForPreviouslyPostedTasks();
|
||||
@ -161,6 +162,7 @@ class VideoSendStreamImplTest : public ::testing::Test {
|
||||
}
|
||||
|
||||
protected:
|
||||
webrtc::test::ScopedKeyValueConfig field_trials_;
|
||||
NiceMock<MockTransport> transport_;
|
||||
NiceMock<MockRtpTransportControllerSend> transport_controller_;
|
||||
NiceMock<MockBitrateAllocator> bitrate_allocator_;
|
||||
@ -338,8 +340,8 @@ TEST_F(VideoSendStreamImplTest, UpdatesObserverOnConfigurationChangeWithAlr) {
|
||||
|
||||
TEST_F(VideoSendStreamImplTest,
|
||||
UpdatesObserverOnConfigurationChangeWithSimulcastVideoHysteresis) {
|
||||
test::ScopedFieldTrials hysteresis_experiment(
|
||||
"WebRTC-VideoRateControl/video_hysteresis:1.25/");
|
||||
test::ScopedKeyValueConfig hysteresis_experiment(
|
||||
field_trials_, "WebRTC-VideoRateControl/video_hysteresis:1.25/");
|
||||
|
||||
auto vss_impl = CreateVideoSendStreamImpl(
|
||||
kDefaultInitialBitrateBps, kDefaultBitratePriority,
|
||||
|
||||
@ -55,7 +55,6 @@
|
||||
#include "test/configurable_frame_size_encoder.h"
|
||||
#include "test/fake_encoder.h"
|
||||
#include "test/fake_texture_frame.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/frame_forwarder.h"
|
||||
#include "test/frame_generator_capturer.h"
|
||||
#include "test/frame_utils.h"
|
||||
@ -659,9 +658,10 @@ TEST_F(VideoSendStreamTest, SupportsUlpfecWithoutExtensions) {
|
||||
class VideoSendStreamWithoutUlpfecTest : public test::CallTest {
|
||||
protected:
|
||||
VideoSendStreamWithoutUlpfecTest()
|
||||
: field_trial_("WebRTC-DisableUlpFecExperiment/Enabled/") {}
|
||||
: field_trial_(field_trials_, "WebRTC-DisableUlpFecExperiment/Enabled/") {
|
||||
}
|
||||
|
||||
test::ScopedFieldTrials field_trial_;
|
||||
test::ScopedKeyValueConfig field_trial_;
|
||||
};
|
||||
|
||||
TEST_F(VideoSendStreamWithoutUlpfecTest, NoUlpfecIfDisabledThroughFieldTrial) {
|
||||
@ -1680,10 +1680,9 @@ TEST_F(VideoSendStreamTest, DISABLED_RelayToDirectRoute) {
|
||||
static const int kStartBitrateBps = 300000;
|
||||
static const int kRelayBandwidthCapBps = 800000;
|
||||
static const int kMinPacketsToSend = 100;
|
||||
webrtc::test::ScopedFieldTrials field_trials(
|
||||
std::string(field_trial::GetFieldTrialString()) +
|
||||
"WebRTC-Bwe-NetworkRouteConstraints/relay_cap:" +
|
||||
std::to_string(kRelayBandwidthCapBps) + "bps/");
|
||||
webrtc::test::ScopedKeyValueConfig field_trials(
|
||||
field_trials_, "WebRTC-Bwe-NetworkRouteConstraints/relay_cap:" +
|
||||
std::to_string(kRelayBandwidthCapBps) + "bps/");
|
||||
|
||||
class RelayToDirectRouteTest : public test::EndToEndTest {
|
||||
public:
|
||||
@ -2677,8 +2676,8 @@ TEST_F(VideoSendStreamTest, ReconfigureBitratesSetsEncoderBitratesCorrectly) {
|
||||
// TODO(bugs.webrtc.org/12058): If these fields trial are on, we get lower
|
||||
// bitrates than expected by this test, due to encoder pushback and subtracted
|
||||
// overhead.
|
||||
webrtc::test::ScopedFieldTrials field_trials(
|
||||
std::string(field_trial::GetFieldTrialString()) +
|
||||
webrtc::test::ScopedKeyValueConfig field_trials(
|
||||
field_trials_,
|
||||
"WebRTC-VideoRateControl/bitrate_adjuster:false/"
|
||||
"WebRTC-SendSideBwe-WithOverhead/Disabled/");
|
||||
|
||||
|
||||
@ -48,7 +48,6 @@
|
||||
#include "rtc_base/task_utils/to_queued_task.h"
|
||||
#include "rtc_base/thread_annotations.h"
|
||||
#include "rtc_base/trace_event.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
#include "video/adaptation/video_stream_encoder_resource_manager.h"
|
||||
#include "video/alignment_adjuster.h"
|
||||
@ -600,7 +599,8 @@ VideoStreamEncoder::VideoStreamEncoder(
|
||||
encoder_queue,
|
||||
BitrateAllocationCallbackType allocation_cb_type,
|
||||
const WebRtcKeyValueConfig& field_trials)
|
||||
: worker_queue_(TaskQueueBase::Current()),
|
||||
: field_trials_(field_trials),
|
||||
worker_queue_(TaskQueueBase::Current()),
|
||||
number_of_cores_(number_of_cores),
|
||||
sink_(nullptr),
|
||||
settings_(settings),
|
||||
@ -663,10 +663,10 @@ VideoStreamEncoder::VideoStreamEncoder(
|
||||
video_source_sink_controller_(/*sink=*/frame_cadence_adapter_.get(),
|
||||
/*source=*/nullptr),
|
||||
default_limits_allowed_(
|
||||
!field_trial::IsEnabled("WebRTC-DefaultBitrateLimitsKillSwitch")),
|
||||
!field_trials.IsEnabled("WebRTC-DefaultBitrateLimitsKillSwitch")),
|
||||
qp_parsing_allowed_(
|
||||
!field_trial::IsEnabled("WebRTC-QpParsingKillSwitch")),
|
||||
switch_encoder_on_init_failures_(!field_trial::IsDisabled(
|
||||
!field_trials.IsEnabled("WebRTC-QpParsingKillSwitch")),
|
||||
switch_encoder_on_init_failures_(!field_trials.IsDisabled(
|
||||
kSwitchEncoderOnInitializationFailuresFieldTrial)),
|
||||
encoder_queue_(std::move(encoder_queue)) {
|
||||
TRACE_EVENT0("webrtc", "VideoStreamEncoder::VideoStreamEncoder");
|
||||
@ -1220,7 +1220,7 @@ void VideoStreamEncoder::ReconfigureEncoder() {
|
||||
// * We have screensharing with layers.
|
||||
// * "WebRTC-FrameDropper" field trial is "Disabled".
|
||||
force_disable_frame_dropper_ =
|
||||
field_trial::IsDisabled(kFrameDropperFieldTrial) ||
|
||||
field_trials_.IsDisabled(kFrameDropperFieldTrial) ||
|
||||
(num_layers > 1 && codec.mode == VideoCodecMode::kScreensharing);
|
||||
|
||||
VideoEncoder::EncoderInfo info = encoder_->GetEncoderInfo();
|
||||
@ -2263,8 +2263,8 @@ VideoStreamEncoder::AutomaticAnimationDetectionExperiment
|
||||
VideoStreamEncoder::ParseAutomatincAnimationDetectionFieldTrial() const {
|
||||
AutomaticAnimationDetectionExperiment result;
|
||||
|
||||
result.Parser()->Parse(webrtc::field_trial::FindFullName(
|
||||
"WebRTC-AutomaticAnimationDetectionScreenshare"));
|
||||
result.Parser()->Parse(
|
||||
field_trials_.Lookup("WebRTC-AutomaticAnimationDetectionScreenshare"));
|
||||
|
||||
if (!result.enabled) {
|
||||
RTC_LOG(LS_INFO) << "Automatic animation detection experiment is disabled.";
|
||||
|
||||
@ -252,6 +252,7 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface,
|
||||
|
||||
void RequestEncoderSwitch() RTC_RUN_ON(&encoder_queue_);
|
||||
|
||||
const WebRtcKeyValueConfig& field_trials_;
|
||||
TaskQueueBase* const worker_queue_;
|
||||
|
||||
const uint32_t number_of_cores_;
|
||||
|
||||
@ -611,8 +611,9 @@ class MockableSendStatisticsProxy : public SendStatisticsProxy {
|
||||
public:
|
||||
MockableSendStatisticsProxy(Clock* clock,
|
||||
const VideoSendStream::Config& config,
|
||||
VideoEncoderConfig::ContentType content_type)
|
||||
: SendStatisticsProxy(clock, config, content_type) {}
|
||||
VideoEncoderConfig::ContentType content_type,
|
||||
const WebRtcKeyValueConfig& field_trials)
|
||||
: SendStatisticsProxy(clock, config, content_type, field_trials) {}
|
||||
|
||||
VideoSendStream::Stats GetStats() override {
|
||||
MutexLock lock(&lock_);
|
||||
@ -741,7 +742,8 @@ class SimpleVideoStreamEncoderFactory {
|
||||
std::make_unique<MockableSendStatisticsProxy>(
|
||||
time_controller_.GetClock(),
|
||||
VideoSendStream::Config(nullptr),
|
||||
webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo);
|
||||
webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo,
|
||||
field_trials_);
|
||||
std::unique_ptr<VideoBitrateAllocatorFactory> bitrate_allocator_factory_ =
|
||||
CreateBuiltinVideoBitrateAllocatorFactory();
|
||||
VideoStreamEncoderSettings encoder_settings_{
|
||||
@ -816,7 +818,8 @@ class VideoStreamEncoderTest : public ::testing::Test {
|
||||
stats_proxy_(new MockableSendStatisticsProxy(
|
||||
time_controller_.GetClock(),
|
||||
video_send_config_,
|
||||
webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo)),
|
||||
webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo,
|
||||
field_trials_)),
|
||||
sink_(&time_controller_, &fake_encoder_) {}
|
||||
|
||||
void SetUp() override {
|
||||
@ -852,7 +855,7 @@ class VideoStreamEncoderTest : public ::testing::Test {
|
||||
TaskQueueBase* encoder_queue_ptr = encoder_queue.get();
|
||||
std::unique_ptr<FrameCadenceAdapterInterface> cadence_adapter =
|
||||
FrameCadenceAdapterInterface::Create(time_controller_.GetClock(),
|
||||
encoder_queue_ptr);
|
||||
encoder_queue_ptr, field_trials_);
|
||||
video_stream_encoder_ = std::make_unique<VideoStreamEncoderUnderTest>(
|
||||
&time_controller_, std::move(cadence_adapter), std::move(encoder_queue),
|
||||
stats_proxy_.get(), video_send_config_.encoder_settings,
|
||||
@ -8901,10 +8904,11 @@ TEST(VideoStreamEncoderSimpleTest, CreateDestroy) {
|
||||
};
|
||||
|
||||
// Lots of boiler plate.
|
||||
test::ScopedKeyValueConfig field_trials;
|
||||
GlobalSimulatedTimeController time_controller(Timestamp::Millis(0));
|
||||
auto stats_proxy = std::make_unique<MockableSendStatisticsProxy>(
|
||||
time_controller.GetClock(), VideoSendStream::Config(nullptr),
|
||||
webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo);
|
||||
webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo, field_trials);
|
||||
SimpleVideoStreamEncoderFactory::MockFakeEncoder mock_fake_encoder(
|
||||
time_controller.GetClock());
|
||||
test::VideoEncoderProxyFactory encoder_factory(&mock_fake_encoder);
|
||||
@ -8921,8 +8925,6 @@ TEST(VideoStreamEncoderSimpleTest, CreateDestroy) {
|
||||
std::unique_ptr<webrtc::TaskQueueBase, webrtc::TaskQueueDeleter>
|
||||
encoder_queue(new SuperLazyTaskQueue());
|
||||
|
||||
test::ScopedKeyValueConfig field_trials;
|
||||
|
||||
// Construct a VideoStreamEncoder instance and let it go out of scope without
|
||||
// doing anything else (including calling Stop()). This should be fine since
|
||||
// the posted init task will simply be deleted.
|
||||
@ -9200,7 +9202,8 @@ TEST(VideoStreamEncoderFrameCadenceTest,
|
||||
test::ScopedKeyValueConfig field_trials(
|
||||
"WebRTC-ZeroHertzScreenshare/Enabled/");
|
||||
auto adapter = FrameCadenceAdapterInterface::Create(
|
||||
factory.GetTimeController()->GetClock(), encoder_queue.get());
|
||||
factory.GetTimeController()->GetClock(), encoder_queue.get(),
|
||||
field_trials);
|
||||
FrameCadenceAdapterInterface* adapter_ptr = adapter.get();
|
||||
|
||||
MockVideoSourceInterface mock_source;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user