blob: d049bc7a6d35f9fc20e1a22269beb34b3f5f90a5 [file] [log] [blame]
Rasmus Brandtc402dbe2019-02-04 11:09:46 +01001/*
2 * Copyright 2019 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "rtc_base/experiments/rate_control_settings.h"
12
13#include "api/video_codecs/video_codec.h"
14#include "api/video_codecs/video_encoder_config.h"
15#include "test/field_trial.h"
16#include "test/gtest.h"
17
18namespace webrtc {
19
20namespace {
21
22TEST(RateControlSettingsTest, LibvpxTrustedRateController) {
23 test::ScopedFieldTrials field_trials(
24 "WebRTC-VideoRateControl/trust_vp8:1,trust_vp9:0/");
25 const RateControlSettings rate_control_settings =
26 RateControlSettings::ParseFromFieldTrials();
27
28 EXPECT_TRUE(rate_control_settings.LibvpxVp8TrustedRateController());
29 EXPECT_FALSE(rate_control_settings.LibvpxVp9TrustedRateController());
30}
31
32TEST(RateControlSettingsTest, GetSimulcastHysteresisFactor) {
33 test::ScopedFieldTrials field_trials(
34 "WebRTC-VideoRateControl/"
35 "video_hysteresis:1.2,screenshare_hysteresis:1.4/");
36 const RateControlSettings rate_control_settings =
37 RateControlSettings::ParseFromFieldTrials();
38
39 EXPECT_EQ(rate_control_settings.GetSimulcastHysteresisFactor(
40 VideoCodecMode::kRealtimeVideo),
41 1.2);
42 EXPECT_EQ(rate_control_settings.GetSimulcastHysteresisFactor(
43 VideoEncoderConfig::ContentType::kRealtimeVideo),
44 1.2);
45 EXPECT_EQ(rate_control_settings.GetSimulcastHysteresisFactor(
46 VideoCodecMode::kScreensharing),
47 1.4);
48 EXPECT_EQ(rate_control_settings.GetSimulcastHysteresisFactor(
49 VideoEncoderConfig::ContentType::kScreen),
50 1.4);
51}
52
53} // namespace
54
55} // namespace webrtc