Added unit tests for new congestion controller.
This CL activates unit tests for the task queue based send side congestion controller that will replace the current one in the future. To be able to have the tests run side by side with the tests of the old congestion controller, the old tests have been prefixed with "Legacy". This CL also contains some minor fixes to the new congestion controller code. Bug: webrtc:8415 Change-Id: I5e7474d42f17fcbfef402e26f638846fa3424695 Reviewed-on: https://webrtc-review.googlesource.com/55381 Reviewed-by: Philip Eliasson <philipel@webrtc.org> Reviewed-by: Björn Terelius <terelius@webrtc.org> Commit-Queue: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22229}
This commit is contained in:
committed by
Commit Bot
parent
8447e91429
commit
56da2f7868
@ -182,6 +182,7 @@ if (rtc_include_tests) {
|
||||
"../pacing:pacing",
|
||||
"../remote_bitrate_estimator:remote_bitrate_estimator",
|
||||
"../rtp_rtcp:rtp_rtcp_format",
|
||||
"rtp:congestion_controller_unittests",
|
||||
]
|
||||
if (!build_with_chromium && is_clang) {
|
||||
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
||||
|
||||
@ -68,7 +68,8 @@ std::vector<PacketFeedback> CreateFeedbackVector() {
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
TEST(TestAcknowledgedBitrateEstimator, DontAddPacketsWhichAreNotInSendHistory) {
|
||||
TEST(LegacyTestAcknowledgedBitrateEstimator,
|
||||
DontAddPacketsWhichAreNotInSendHistory) {
|
||||
auto states = CreateTestStates();
|
||||
std::vector<PacketFeedback> packet_feedback_vector;
|
||||
packet_feedback_vector.push_back(
|
||||
@ -78,7 +79,7 @@ TEST(TestAcknowledgedBitrateEstimator, DontAddPacketsWhichAreNotInSendHistory) {
|
||||
packet_feedback_vector);
|
||||
}
|
||||
|
||||
TEST(TestAcknowledgedBitrateEstimator, UpdateBandwith) {
|
||||
TEST(LegacyTestAcknowledgedBitrateEstimator, UpdateBandwith) {
|
||||
auto states = CreateTestStates();
|
||||
auto packet_feedback_vector = CreateFeedbackVector();
|
||||
{
|
||||
@ -98,7 +99,7 @@ TEST(TestAcknowledgedBitrateEstimator, UpdateBandwith) {
|
||||
packet_feedback_vector);
|
||||
}
|
||||
|
||||
TEST(TestAcknowledgedBitrateEstimator, ExpectFastRateChangeWhenLeftAlr) {
|
||||
TEST(LegacyTestAcknowledgedBitrateEstimator, ExpectFastRateChangeWhenLeftAlr) {
|
||||
auto states = CreateTestStates();
|
||||
auto packet_feedback_vector = CreateFeedbackVector();
|
||||
{
|
||||
@ -122,7 +123,7 @@ TEST(TestAcknowledgedBitrateEstimator, ExpectFastRateChangeWhenLeftAlr) {
|
||||
packet_feedback_vector);
|
||||
}
|
||||
|
||||
TEST(TestAcknowledgedBitrateEstimator, ReturnBitrate) {
|
||||
TEST(LegacyTestAcknowledgedBitrateEstimator, ReturnBitrate) {
|
||||
auto states = CreateTestStates();
|
||||
rtc::Optional<uint32_t> return_value(42);
|
||||
EXPECT_CALL(*states.mock_bitrate_estimator, bitrate_bps())
|
||||
|
||||
@ -26,13 +26,13 @@ const PacedPacketInfo kPacingInfo1(1, kNumProbesCluster1, 4000);
|
||||
constexpr float kTargetUtilizationFraction = 0.95f;
|
||||
} // namespace
|
||||
|
||||
TEST_F(DelayBasedBweTest, NoCrashEmptyFeedback) {
|
||||
TEST_F(LegacyDelayBasedBweTest, NoCrashEmptyFeedback) {
|
||||
std::vector<PacketFeedback> packet_feedback_vector;
|
||||
bitrate_estimator_->IncomingPacketFeedbackVector(packet_feedback_vector,
|
||||
rtc::nullopt);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, NoCrashOnlyLostFeedback) {
|
||||
TEST_F(LegacyDelayBasedBweTest, NoCrashOnlyLostFeedback) {
|
||||
std::vector<PacketFeedback> packet_feedback_vector;
|
||||
packet_feedback_vector.push_back(PacketFeedback(PacketFeedback::kNotReceived,
|
||||
PacketFeedback::kNoSendTime,
|
||||
@ -44,7 +44,7 @@ TEST_F(DelayBasedBweTest, NoCrashOnlyLostFeedback) {
|
||||
rtc::nullopt);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, ProbeDetection) {
|
||||
TEST_F(LegacyDelayBasedBweTest, ProbeDetection) {
|
||||
int64_t now_ms = clock_.TimeInMilliseconds();
|
||||
uint16_t seq_num = 0;
|
||||
|
||||
@ -67,7 +67,7 @@ TEST_F(DelayBasedBweTest, ProbeDetection) {
|
||||
EXPECT_GT(bitrate_observer_.latest_bitrate(), 1500000u);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, ProbeDetectionNonPacedPackets) {
|
||||
TEST_F(LegacyDelayBasedBweTest, ProbeDetectionNonPacedPackets) {
|
||||
int64_t now_ms = clock_.TimeInMilliseconds();
|
||||
uint16_t seq_num = 0;
|
||||
// First burst sent at 8 * 1000 / 10 = 800 kbps, but with every other packet
|
||||
@ -85,7 +85,7 @@ TEST_F(DelayBasedBweTest, ProbeDetectionNonPacedPackets) {
|
||||
EXPECT_GT(bitrate_observer_.latest_bitrate(), 800000u);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, ProbeDetectionFasterArrival) {
|
||||
TEST_F(LegacyDelayBasedBweTest, ProbeDetectionFasterArrival) {
|
||||
int64_t now_ms = clock_.TimeInMilliseconds();
|
||||
uint16_t seq_num = 0;
|
||||
// First burst sent at 8 * 1000 / 10 = 800 kbps.
|
||||
@ -101,7 +101,7 @@ TEST_F(DelayBasedBweTest, ProbeDetectionFasterArrival) {
|
||||
EXPECT_FALSE(bitrate_observer_.updated());
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrival) {
|
||||
TEST_F(LegacyDelayBasedBweTest, ProbeDetectionSlowerArrival) {
|
||||
int64_t now_ms = clock_.TimeInMilliseconds();
|
||||
uint16_t seq_num = 0;
|
||||
// First burst sent at 8 * 1000 / 5 = 1600 kbps.
|
||||
@ -121,7 +121,7 @@ TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrival) {
|
||||
kTargetUtilizationFraction * 1140000u, 10000u);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrivalHighBitrate) {
|
||||
TEST_F(LegacyDelayBasedBweTest, ProbeDetectionSlowerArrivalHighBitrate) {
|
||||
int64_t now_ms = clock_.TimeInMilliseconds();
|
||||
uint16_t seq_num = 0;
|
||||
// Burst sent at 8 * 1000 / 1 = 8000 kbps.
|
||||
@ -141,7 +141,7 @@ TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrivalHighBitrate) {
|
||||
kTargetUtilizationFraction * 4000000u, 10000u);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, GetExpectedBwePeriodMs) {
|
||||
TEST_F(LegacyDelayBasedBweTest, GetExpectedBwePeriodMs) {
|
||||
int64_t default_interval_ms = bitrate_estimator_->GetExpectedBwePeriodMs();
|
||||
EXPECT_GT(default_interval_ms, 0);
|
||||
CapacityDropTestHelper(1, true, 333, 0);
|
||||
@ -150,45 +150,45 @@ TEST_F(DelayBasedBweTest, GetExpectedBwePeriodMs) {
|
||||
EXPECT_NE(interval_ms, default_interval_ms);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, InitialBehavior) {
|
||||
TEST_F(LegacyDelayBasedBweTest, InitialBehavior) {
|
||||
InitialBehaviorTestHelper(730000);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, RateIncreaseReordering) {
|
||||
TEST_F(LegacyDelayBasedBweTest, RateIncreaseReordering) {
|
||||
RateIncreaseReorderingTestHelper(730000);
|
||||
}
|
||||
TEST_F(DelayBasedBweTest, RateIncreaseRtpTimestamps) {
|
||||
TEST_F(LegacyDelayBasedBweTest, RateIncreaseRtpTimestamps) {
|
||||
RateIncreaseRtpTimestampsTestHelper(627);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, CapacityDropOneStream) {
|
||||
TEST_F(LegacyDelayBasedBweTest, CapacityDropOneStream) {
|
||||
CapacityDropTestHelper(1, false, 300, 0);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, CapacityDropPosOffsetChange) {
|
||||
TEST_F(LegacyDelayBasedBweTest, CapacityDropPosOffsetChange) {
|
||||
CapacityDropTestHelper(1, false, 867, 30000);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, CapacityDropNegOffsetChange) {
|
||||
TEST_F(LegacyDelayBasedBweTest, CapacityDropNegOffsetChange) {
|
||||
CapacityDropTestHelper(1, false, 933, -30000);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, CapacityDropOneStreamWrap) {
|
||||
TEST_F(LegacyDelayBasedBweTest, CapacityDropOneStreamWrap) {
|
||||
CapacityDropTestHelper(1, true, 333, 0);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, TestTimestampGrouping) {
|
||||
TEST_F(LegacyDelayBasedBweTest, TestTimestampGrouping) {
|
||||
TestTimestampGroupingTestHelper();
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, TestShortTimeoutAndWrap) {
|
||||
TEST_F(LegacyDelayBasedBweTest, TestShortTimeoutAndWrap) {
|
||||
// Simulate a client leaving and rejoining the call after 35 seconds. This
|
||||
// will make abs send time wrap, so if streams aren't timed out properly
|
||||
// the next 30 seconds of packets will be out of order.
|
||||
TestWrappingHelper(35);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, TestLongTimeoutAndWrap) {
|
||||
TEST_F(LegacyDelayBasedBweTest, TestLongTimeoutAndWrap) {
|
||||
// Simulate a client leaving and rejoining the call after some multiple of
|
||||
// 64 seconds later. This will cause a zero difference in abs send times due
|
||||
// to the wrap, but a big difference in arrival time, if streams aren't
|
||||
@ -196,7 +196,7 @@ TEST_F(DelayBasedBweTest, TestLongTimeoutAndWrap) {
|
||||
TestWrappingHelper(10 * 64);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, TestInitialOveruse) {
|
||||
TEST_F(LegacyDelayBasedBweTest, TestInitialOveruse) {
|
||||
const uint32_t kStartBitrate = 300e3;
|
||||
const uint32_t kInitialCapacityBps = 200e3;
|
||||
const uint32_t kDummySsrc = 0;
|
||||
|
||||
@ -148,7 +148,7 @@ int64_t StreamGenerator::GenerateFrame(std::vector<PacketFeedback>* packets,
|
||||
}
|
||||
} // namespace test
|
||||
|
||||
DelayBasedBweTest::DelayBasedBweTest()
|
||||
LegacyDelayBasedBweTest::LegacyDelayBasedBweTest()
|
||||
: clock_(100000000),
|
||||
acknowledged_bitrate_estimator_(
|
||||
rtc::MakeUnique<AcknowledgedBitrateEstimator>()),
|
||||
@ -158,27 +158,28 @@ DelayBasedBweTest::DelayBasedBweTest()
|
||||
arrival_time_offset_ms_(0),
|
||||
first_update_(true) {}
|
||||
|
||||
DelayBasedBweTest::~DelayBasedBweTest() {}
|
||||
LegacyDelayBasedBweTest::~LegacyDelayBasedBweTest() {}
|
||||
|
||||
void DelayBasedBweTest::AddDefaultStream() {
|
||||
void LegacyDelayBasedBweTest::AddDefaultStream() {
|
||||
stream_generator_->AddStream(new test::RtpStream(30, 3e5));
|
||||
}
|
||||
|
||||
const uint32_t DelayBasedBweTest::kDefaultSsrc = 0;
|
||||
const uint32_t LegacyDelayBasedBweTest::kDefaultSsrc = 0;
|
||||
|
||||
void DelayBasedBweTest::IncomingFeedback(int64_t arrival_time_ms,
|
||||
int64_t send_time_ms,
|
||||
uint16_t sequence_number,
|
||||
size_t payload_size) {
|
||||
void LegacyDelayBasedBweTest::IncomingFeedback(int64_t arrival_time_ms,
|
||||
int64_t send_time_ms,
|
||||
uint16_t sequence_number,
|
||||
size_t payload_size) {
|
||||
IncomingFeedback(arrival_time_ms, send_time_ms, sequence_number, payload_size,
|
||||
PacedPacketInfo());
|
||||
}
|
||||
|
||||
void DelayBasedBweTest::IncomingFeedback(int64_t arrival_time_ms,
|
||||
int64_t send_time_ms,
|
||||
uint16_t sequence_number,
|
||||
size_t payload_size,
|
||||
const PacedPacketInfo& pacing_info) {
|
||||
void LegacyDelayBasedBweTest::IncomingFeedback(
|
||||
int64_t arrival_time_ms,
|
||||
int64_t send_time_ms,
|
||||
uint16_t sequence_number,
|
||||
size_t payload_size,
|
||||
const PacedPacketInfo& pacing_info) {
|
||||
RTC_CHECK_GE(arrival_time_ms + arrival_time_offset_ms_, 0);
|
||||
PacketFeedback packet(arrival_time_ms + arrival_time_offset_ms_, send_time_ms,
|
||||
sequence_number, payload_size, pacing_info);
|
||||
@ -201,8 +202,8 @@ void DelayBasedBweTest::IncomingFeedback(int64_t arrival_time_ms,
|
||||
// Returns true if an over-use was seen, false otherwise.
|
||||
// The StreamGenerator::updated() should be used to check for any changes in
|
||||
// target bitrate after the call to this function.
|
||||
bool DelayBasedBweTest::GenerateAndProcessFrame(uint32_t ssrc,
|
||||
uint32_t bitrate_bps) {
|
||||
bool LegacyDelayBasedBweTest::GenerateAndProcessFrame(uint32_t ssrc,
|
||||
uint32_t bitrate_bps) {
|
||||
stream_generator_->SetBitrateBps(bitrate_bps);
|
||||
std::vector<PacketFeedback> packets;
|
||||
int64_t next_time_us =
|
||||
@ -240,12 +241,12 @@ bool DelayBasedBweTest::GenerateAndProcessFrame(uint32_t ssrc,
|
||||
// until it reaches |target_bitrate|.
|
||||
// Can for instance be used to run the estimator for some time to get it
|
||||
// into a steady state.
|
||||
uint32_t DelayBasedBweTest::SteadyStateRun(uint32_t ssrc,
|
||||
int max_number_of_frames,
|
||||
uint32_t start_bitrate,
|
||||
uint32_t min_bitrate,
|
||||
uint32_t max_bitrate,
|
||||
uint32_t target_bitrate) {
|
||||
uint32_t LegacyDelayBasedBweTest::SteadyStateRun(uint32_t ssrc,
|
||||
int max_number_of_frames,
|
||||
uint32_t start_bitrate,
|
||||
uint32_t min_bitrate,
|
||||
uint32_t max_bitrate,
|
||||
uint32_t target_bitrate) {
|
||||
uint32_t bitrate_bps = start_bitrate;
|
||||
bool bitrate_update_seen = false;
|
||||
// Produce |number_of_frames| frames and give them to the estimator.
|
||||
@ -268,7 +269,7 @@ uint32_t DelayBasedBweTest::SteadyStateRun(uint32_t ssrc,
|
||||
return bitrate_bps;
|
||||
}
|
||||
|
||||
void DelayBasedBweTest::InitialBehaviorTestHelper(
|
||||
void LegacyDelayBasedBweTest::InitialBehaviorTestHelper(
|
||||
uint32_t expected_converge_bitrate) {
|
||||
const int kFramerate = 50; // 50 fps to avoid rounding errors.
|
||||
const int kFrameIntervalMs = 1000 / kFramerate;
|
||||
@ -311,7 +312,7 @@ void DelayBasedBweTest::InitialBehaviorTestHelper(
|
||||
EXPECT_EQ(bitrate_observer_.latest_bitrate(), bitrate_bps);
|
||||
}
|
||||
|
||||
void DelayBasedBweTest::RateIncreaseReorderingTestHelper(
|
||||
void LegacyDelayBasedBweTest::RateIncreaseReorderingTestHelper(
|
||||
uint32_t expected_bitrate_bps) {
|
||||
const int kFramerate = 50; // 50 fps to avoid rounding errors.
|
||||
const int kFrameIntervalMs = 1000 / kFramerate;
|
||||
@ -356,7 +357,7 @@ void DelayBasedBweTest::RateIncreaseReorderingTestHelper(
|
||||
}
|
||||
|
||||
// Make sure we initially increase the bitrate as expected.
|
||||
void DelayBasedBweTest::RateIncreaseRtpTimestampsTestHelper(
|
||||
void LegacyDelayBasedBweTest::RateIncreaseRtpTimestampsTestHelper(
|
||||
int expected_iterations) {
|
||||
// This threshold corresponds approximately to increasing linearly with
|
||||
// bitrate(i) = 1.04 * bitrate(i-1) + 1000
|
||||
@ -381,7 +382,7 @@ void DelayBasedBweTest::RateIncreaseRtpTimestampsTestHelper(
|
||||
ASSERT_EQ(expected_iterations, iterations);
|
||||
}
|
||||
|
||||
void DelayBasedBweTest::CapacityDropTestHelper(
|
||||
void LegacyDelayBasedBweTest::CapacityDropTestHelper(
|
||||
int number_of_streams,
|
||||
bool wrap_time_stamp,
|
||||
uint32_t expected_bitrate_drop_delta,
|
||||
@ -443,7 +444,7 @@ void DelayBasedBweTest::CapacityDropTestHelper(
|
||||
bitrate_drop_time - overuse_start_time, 33);
|
||||
}
|
||||
|
||||
void DelayBasedBweTest::TestTimestampGroupingTestHelper() {
|
||||
void LegacyDelayBasedBweTest::TestTimestampGroupingTestHelper() {
|
||||
const int kFramerate = 50; // 50 fps to avoid rounding errors.
|
||||
const int kFrameIntervalMs = 1000 / kFramerate;
|
||||
int64_t send_time_ms = 0;
|
||||
@ -481,7 +482,7 @@ void DelayBasedBweTest::TestTimestampGroupingTestHelper() {
|
||||
EXPECT_LT(bitrate_observer_.latest_bitrate(), 400000u);
|
||||
}
|
||||
|
||||
void DelayBasedBweTest::TestWrappingHelper(int silence_time_s) {
|
||||
void LegacyDelayBasedBweTest::TestWrappingHelper(int silence_time_s) {
|
||||
const int kFramerate = 100;
|
||||
const int kFrameIntervalMs = 1000 / kFramerate;
|
||||
int64_t send_time_ms = 0;
|
||||
|
||||
@ -111,10 +111,10 @@ class StreamGenerator {
|
||||
};
|
||||
} // namespace test
|
||||
|
||||
class DelayBasedBweTest : public ::testing::Test {
|
||||
class LegacyDelayBasedBweTest : public ::testing::Test {
|
||||
public:
|
||||
DelayBasedBweTest();
|
||||
virtual ~DelayBasedBweTest();
|
||||
LegacyDelayBasedBweTest();
|
||||
virtual ~LegacyDelayBasedBweTest();
|
||||
|
||||
protected:
|
||||
void AddDefaultStream();
|
||||
@ -171,7 +171,7 @@ class DelayBasedBweTest : public ::testing::Test {
|
||||
int64_t arrival_time_offset_ms_;
|
||||
bool first_update_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(DelayBasedBweTest);
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(LegacyDelayBasedBweTest);
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
|
||||
@ -45,27 +45,27 @@ void TestEstimator(double slope, double jitter_stddev, double tolerance) {
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TEST(MedianSlopeEstimator, PerfectLineSlopeOneHalf) {
|
||||
TEST(DeprecatedMedianSlopeEstimator, PerfectLineSlopeOneHalf) {
|
||||
TestEstimator(0.5, 0, 0.001);
|
||||
}
|
||||
|
||||
TEST(MedianSlopeEstimator, PerfectLineSlopeMinusOne) {
|
||||
TEST(DeprecatedMedianSlopeEstimator, PerfectLineSlopeMinusOne) {
|
||||
TestEstimator(-1, 0, 0.001);
|
||||
}
|
||||
|
||||
TEST(MedianSlopeEstimator, PerfectLineSlopeZero) {
|
||||
TEST(DeprecatedMedianSlopeEstimator, PerfectLineSlopeZero) {
|
||||
TestEstimator(0, 0, 0.001);
|
||||
}
|
||||
|
||||
TEST(MedianSlopeEstimator, JitteryLineSlopeOneHalf) {
|
||||
TEST(DeprecatedMedianSlopeEstimator, JitteryLineSlopeOneHalf) {
|
||||
TestEstimator(0.5, kAvgTimeBetweenPackets / 3.0, 0.01);
|
||||
}
|
||||
|
||||
TEST(MedianSlopeEstimator, JitteryLineSlopeMinusOne) {
|
||||
TEST(DeprecatedMedianSlopeEstimator, JitteryLineSlopeMinusOne) {
|
||||
TestEstimator(-1, kAvgTimeBetweenPackets / 3.0, 0.05);
|
||||
}
|
||||
|
||||
TEST(MedianSlopeEstimator, JitteryLineSlopeZero) {
|
||||
TEST(DeprecatedMedianSlopeEstimator, JitteryLineSlopeZero) {
|
||||
TestEstimator(0, kAvgTimeBetweenPackets / 3.0, 0.02);
|
||||
}
|
||||
|
||||
|
||||
@ -26,9 +26,9 @@ constexpr int kDefaultMinBytes = 5000;
|
||||
constexpr float kTargetUtilizationFraction = 0.95f;
|
||||
} // anonymous namespace
|
||||
|
||||
class TestProbeBitrateEstimator : public ::testing::Test {
|
||||
class LegacyTestProbeBitrateEstimator : public ::testing::Test {
|
||||
public:
|
||||
TestProbeBitrateEstimator() : probe_bitrate_estimator_(nullptr) {}
|
||||
LegacyTestProbeBitrateEstimator() : probe_bitrate_estimator_(nullptr) {}
|
||||
|
||||
// TODO(philipel): Use PacedPacketInfo when ProbeBitrateEstimator is rewritten
|
||||
// to use that information.
|
||||
@ -50,7 +50,7 @@ class TestProbeBitrateEstimator : public ::testing::Test {
|
||||
ProbeBitrateEstimator probe_bitrate_estimator_;
|
||||
};
|
||||
|
||||
TEST_F(TestProbeBitrateEstimator, OneCluster) {
|
||||
TEST_F(LegacyTestProbeBitrateEstimator, OneCluster) {
|
||||
AddPacketFeedback(0, 1000, 0, 10);
|
||||
AddPacketFeedback(0, 1000, 10, 20);
|
||||
AddPacketFeedback(0, 1000, 20, 30);
|
||||
@ -59,7 +59,7 @@ TEST_F(TestProbeBitrateEstimator, OneCluster) {
|
||||
EXPECT_NEAR(measured_bps_, 800000, 10);
|
||||
}
|
||||
|
||||
TEST_F(TestProbeBitrateEstimator, OneClusterTooFewProbes) {
|
||||
TEST_F(LegacyTestProbeBitrateEstimator, OneClusterTooFewProbes) {
|
||||
AddPacketFeedback(0, 2000, 0, 10);
|
||||
AddPacketFeedback(0, 2000, 10, 20);
|
||||
AddPacketFeedback(0, 2000, 20, 30);
|
||||
@ -67,7 +67,7 @@ TEST_F(TestProbeBitrateEstimator, OneClusterTooFewProbes) {
|
||||
EXPECT_EQ(kInvalidBitrate, measured_bps_);
|
||||
}
|
||||
|
||||
TEST_F(TestProbeBitrateEstimator, OneClusterTooFewBytes) {
|
||||
TEST_F(LegacyTestProbeBitrateEstimator, OneClusterTooFewBytes) {
|
||||
const int kMinBytes = 6000;
|
||||
AddPacketFeedback(0, 800, 0, 10, kDefaultMinProbes, kMinBytes);
|
||||
AddPacketFeedback(0, 800, 10, 20, kDefaultMinProbes, kMinBytes);
|
||||
@ -78,7 +78,7 @@ TEST_F(TestProbeBitrateEstimator, OneClusterTooFewBytes) {
|
||||
EXPECT_EQ(kInvalidBitrate, measured_bps_);
|
||||
}
|
||||
|
||||
TEST_F(TestProbeBitrateEstimator, SmallCluster) {
|
||||
TEST_F(LegacyTestProbeBitrateEstimator, SmallCluster) {
|
||||
const int kMinBytes = 1000;
|
||||
AddPacketFeedback(0, 150, 0, 10, kDefaultMinProbes, kMinBytes);
|
||||
AddPacketFeedback(0, 150, 10, 20, kDefaultMinProbes, kMinBytes);
|
||||
@ -89,7 +89,7 @@ TEST_F(TestProbeBitrateEstimator, SmallCluster) {
|
||||
EXPECT_NEAR(measured_bps_, 120000, 10);
|
||||
}
|
||||
|
||||
TEST_F(TestProbeBitrateEstimator, LargeCluster) {
|
||||
TEST_F(LegacyTestProbeBitrateEstimator, LargeCluster) {
|
||||
const int kMinProbes = 30;
|
||||
const int kMinBytes = 312500;
|
||||
|
||||
@ -103,7 +103,7 @@ TEST_F(TestProbeBitrateEstimator, LargeCluster) {
|
||||
EXPECT_NEAR(measured_bps_, 100000000, 10);
|
||||
}
|
||||
|
||||
TEST_F(TestProbeBitrateEstimator, FastReceive) {
|
||||
TEST_F(LegacyTestProbeBitrateEstimator, FastReceive) {
|
||||
AddPacketFeedback(0, 1000, 0, 15);
|
||||
AddPacketFeedback(0, 1000, 10, 30);
|
||||
AddPacketFeedback(0, 1000, 20, 35);
|
||||
@ -112,7 +112,7 @@ TEST_F(TestProbeBitrateEstimator, FastReceive) {
|
||||
EXPECT_NEAR(measured_bps_, 800000, 10);
|
||||
}
|
||||
|
||||
TEST_F(TestProbeBitrateEstimator, TooFastReceive) {
|
||||
TEST_F(LegacyTestProbeBitrateEstimator, TooFastReceive) {
|
||||
AddPacketFeedback(0, 1000, 0, 19);
|
||||
AddPacketFeedback(0, 1000, 10, 22);
|
||||
AddPacketFeedback(0, 1000, 20, 25);
|
||||
@ -121,7 +121,7 @@ TEST_F(TestProbeBitrateEstimator, TooFastReceive) {
|
||||
EXPECT_EQ(measured_bps_, kInvalidBitrate);
|
||||
}
|
||||
|
||||
TEST_F(TestProbeBitrateEstimator, SlowReceive) {
|
||||
TEST_F(LegacyTestProbeBitrateEstimator, SlowReceive) {
|
||||
AddPacketFeedback(0, 1000, 0, 10);
|
||||
AddPacketFeedback(0, 1000, 10, 40);
|
||||
AddPacketFeedback(0, 1000, 20, 70);
|
||||
@ -131,7 +131,7 @@ TEST_F(TestProbeBitrateEstimator, SlowReceive) {
|
||||
EXPECT_NEAR(measured_bps_, kTargetUtilizationFraction * 320000, 10);
|
||||
}
|
||||
|
||||
TEST_F(TestProbeBitrateEstimator, BurstReceive) {
|
||||
TEST_F(LegacyTestProbeBitrateEstimator, BurstReceive) {
|
||||
AddPacketFeedback(0, 1000, 0, 50);
|
||||
AddPacketFeedback(0, 1000, 10, 50);
|
||||
AddPacketFeedback(0, 1000, 20, 50);
|
||||
@ -140,7 +140,7 @@ TEST_F(TestProbeBitrateEstimator, BurstReceive) {
|
||||
EXPECT_EQ(measured_bps_, kInvalidBitrate);
|
||||
}
|
||||
|
||||
TEST_F(TestProbeBitrateEstimator, MultipleClusters) {
|
||||
TEST_F(LegacyTestProbeBitrateEstimator, MultipleClusters) {
|
||||
AddPacketFeedback(0, 1000, 0, 10);
|
||||
AddPacketFeedback(0, 1000, 10, 20);
|
||||
AddPacketFeedback(0, 1000, 20, 30);
|
||||
@ -161,7 +161,7 @@ TEST_F(TestProbeBitrateEstimator, MultipleClusters) {
|
||||
EXPECT_NEAR(measured_bps_, kTargetUtilizationFraction * 1200000, 10);
|
||||
}
|
||||
|
||||
TEST_F(TestProbeBitrateEstimator, IgnoreOldClusters) {
|
||||
TEST_F(LegacyTestProbeBitrateEstimator, IgnoreOldClusters) {
|
||||
AddPacketFeedback(0, 1000, 0, 10);
|
||||
AddPacketFeedback(0, 1000, 10, 20);
|
||||
AddPacketFeedback(0, 1000, 20, 30);
|
||||
@ -180,7 +180,7 @@ TEST_F(TestProbeBitrateEstimator, IgnoreOldClusters) {
|
||||
EXPECT_EQ(measured_bps_, kInvalidBitrate);
|
||||
}
|
||||
|
||||
TEST_F(TestProbeBitrateEstimator, IgnoreSizeLastSendPacket) {
|
||||
TEST_F(LegacyTestProbeBitrateEstimator, IgnoreSizeLastSendPacket) {
|
||||
AddPacketFeedback(0, 1000, 0, 10);
|
||||
AddPacketFeedback(0, 1000, 10, 20);
|
||||
AddPacketFeedback(0, 1000, 20, 30);
|
||||
@ -191,7 +191,7 @@ TEST_F(TestProbeBitrateEstimator, IgnoreSizeLastSendPacket) {
|
||||
EXPECT_NEAR(measured_bps_, 800000, 10);
|
||||
}
|
||||
|
||||
TEST_F(TestProbeBitrateEstimator, IgnoreSizeFirstReceivePacket) {
|
||||
TEST_F(LegacyTestProbeBitrateEstimator, IgnoreSizeFirstReceivePacket) {
|
||||
AddPacketFeedback(0, 1500, 0, 10);
|
||||
AddPacketFeedback(0, 1000, 10, 20);
|
||||
AddPacketFeedback(0, 1000, 20, 30);
|
||||
@ -201,11 +201,11 @@ TEST_F(TestProbeBitrateEstimator, IgnoreSizeFirstReceivePacket) {
|
||||
EXPECT_NEAR(measured_bps_, kTargetUtilizationFraction * 800000, 10);
|
||||
}
|
||||
|
||||
TEST_F(TestProbeBitrateEstimator, NoLastEstimatedBitrateBps) {
|
||||
TEST_F(LegacyTestProbeBitrateEstimator, NoLastEstimatedBitrateBps) {
|
||||
EXPECT_FALSE(probe_bitrate_estimator_.FetchAndResetLastEstimatedBitrateBps());
|
||||
}
|
||||
|
||||
TEST_F(TestProbeBitrateEstimator, FetchLastEstimatedBitrateBps) {
|
||||
TEST_F(LegacyTestProbeBitrateEstimator, FetchLastEstimatedBitrateBps) {
|
||||
AddPacketFeedback(0, 1000, 0, 10);
|
||||
AddPacketFeedback(0, 1000, 10, 20);
|
||||
AddPacketFeedback(0, 1000, 20, 30);
|
||||
|
||||
@ -38,25 +38,25 @@ constexpr int kBitrateDropTimeoutMs = 5000;
|
||||
|
||||
} // namespace
|
||||
|
||||
class ProbeControllerTest : public ::testing::Test {
|
||||
class LegacyProbeControllerTest : public ::testing::Test {
|
||||
protected:
|
||||
ProbeControllerTest() : clock_(100000000L) {
|
||||
LegacyProbeControllerTest() : clock_(100000000L) {
|
||||
probe_controller_.reset(new ProbeController(&pacer_, &clock_));
|
||||
}
|
||||
~ProbeControllerTest() override {}
|
||||
~LegacyProbeControllerTest() override {}
|
||||
|
||||
SimulatedClock clock_;
|
||||
NiceMock<MockPacedSender> pacer_;
|
||||
std::unique_ptr<ProbeController> probe_controller_;
|
||||
};
|
||||
|
||||
TEST_F(ProbeControllerTest, InitiatesProbingAtStart) {
|
||||
TEST_F(LegacyProbeControllerTest, InitiatesProbingAtStart) {
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(AtLeast(2));
|
||||
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
|
||||
kMaxBitrateBps);
|
||||
}
|
||||
|
||||
TEST_F(ProbeControllerTest, ProbeOnlyWhenNetworkIsUp) {
|
||||
TEST_F(LegacyProbeControllerTest, ProbeOnlyWhenNetworkIsUp) {
|
||||
probe_controller_->OnNetworkStateChanged(kNetworkDown);
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(0);
|
||||
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
|
||||
@ -67,7 +67,7 @@ TEST_F(ProbeControllerTest, ProbeOnlyWhenNetworkIsUp) {
|
||||
probe_controller_->OnNetworkStateChanged(kNetworkUp);
|
||||
}
|
||||
|
||||
TEST_F(ProbeControllerTest, InitiatesProbingOnMaxBitrateIncrease) {
|
||||
TEST_F(LegacyProbeControllerTest, InitiatesProbingOnMaxBitrateIncrease) {
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(AtLeast(2));
|
||||
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
|
||||
kMaxBitrateBps);
|
||||
@ -81,7 +81,8 @@ TEST_F(ProbeControllerTest, InitiatesProbingOnMaxBitrateIncrease) {
|
||||
kMaxBitrateBps + 100);
|
||||
}
|
||||
|
||||
TEST_F(ProbeControllerTest, InitiatesProbingOnMaxBitrateIncreaseAtMaxBitrate) {
|
||||
TEST_F(LegacyProbeControllerTest,
|
||||
InitiatesProbingOnMaxBitrateIncreaseAtMaxBitrate) {
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(AtLeast(2));
|
||||
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
|
||||
kMaxBitrateBps);
|
||||
@ -96,7 +97,7 @@ TEST_F(ProbeControllerTest, InitiatesProbingOnMaxBitrateIncreaseAtMaxBitrate) {
|
||||
kMaxBitrateBps + 100);
|
||||
}
|
||||
|
||||
TEST_F(ProbeControllerTest, TestExponentialProbing) {
|
||||
TEST_F(LegacyProbeControllerTest, TestExponentialProbing) {
|
||||
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
|
||||
kMaxBitrateBps);
|
||||
|
||||
@ -110,7 +111,7 @@ TEST_F(ProbeControllerTest, TestExponentialProbing) {
|
||||
probe_controller_->SetEstimatedBitrate(1800);
|
||||
}
|
||||
|
||||
TEST_F(ProbeControllerTest, TestExponentialProbingTimeout) {
|
||||
TEST_F(LegacyProbeControllerTest, TestExponentialProbingTimeout) {
|
||||
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
|
||||
kMaxBitrateBps);
|
||||
|
||||
@ -122,7 +123,7 @@ TEST_F(ProbeControllerTest, TestExponentialProbingTimeout) {
|
||||
probe_controller_->SetEstimatedBitrate(1800);
|
||||
}
|
||||
|
||||
TEST_F(ProbeControllerTest, RequestProbeInAlr) {
|
||||
TEST_F(LegacyProbeControllerTest, RequestProbeInAlr) {
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(2);
|
||||
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
|
||||
kMaxBitrateBps);
|
||||
@ -137,7 +138,7 @@ TEST_F(ProbeControllerTest, RequestProbeInAlr) {
|
||||
probe_controller_->RequestProbe();
|
||||
}
|
||||
|
||||
TEST_F(ProbeControllerTest, RequestProbeWhenAlrEndedRecently) {
|
||||
TEST_F(LegacyProbeControllerTest, RequestProbeWhenAlrEndedRecently) {
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(2);
|
||||
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
|
||||
kMaxBitrateBps);
|
||||
@ -154,7 +155,7 @@ TEST_F(ProbeControllerTest, RequestProbeWhenAlrEndedRecently) {
|
||||
probe_controller_->RequestProbe();
|
||||
}
|
||||
|
||||
TEST_F(ProbeControllerTest, RequestProbeWhenAlrNotEndedRecently) {
|
||||
TEST_F(LegacyProbeControllerTest, RequestProbeWhenAlrNotEndedRecently) {
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(2);
|
||||
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
|
||||
kMaxBitrateBps);
|
||||
@ -171,7 +172,7 @@ TEST_F(ProbeControllerTest, RequestProbeWhenAlrNotEndedRecently) {
|
||||
probe_controller_->RequestProbe();
|
||||
}
|
||||
|
||||
TEST_F(ProbeControllerTest, RequestProbeWhenBweDropNotRecent) {
|
||||
TEST_F(LegacyProbeControllerTest, RequestProbeWhenBweDropNotRecent) {
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(2);
|
||||
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
|
||||
kMaxBitrateBps);
|
||||
@ -187,7 +188,7 @@ TEST_F(ProbeControllerTest, RequestProbeWhenBweDropNotRecent) {
|
||||
probe_controller_->RequestProbe();
|
||||
}
|
||||
|
||||
TEST_F(ProbeControllerTest, PeriodicProbing) {
|
||||
TEST_F(LegacyProbeControllerTest, PeriodicProbing) {
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(2);
|
||||
probe_controller_->EnablePeriodicAlrProbing(true);
|
||||
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
|
||||
@ -224,7 +225,7 @@ TEST_F(ProbeControllerTest, PeriodicProbing) {
|
||||
testing::Mock::VerifyAndClearExpectations(&pacer_);
|
||||
}
|
||||
|
||||
TEST_F(ProbeControllerTest, PeriodicProbingAfterReset) {
|
||||
TEST_F(LegacyProbeControllerTest, PeriodicProbingAfterReset) {
|
||||
testing::StrictMock<MockPacedSender> local_pacer;
|
||||
probe_controller_.reset(new ProbeController(&local_pacer, &clock_));
|
||||
int64_t alr_start_time = clock_.TimeInMilliseconds();
|
||||
@ -251,7 +252,7 @@ TEST_F(ProbeControllerTest, PeriodicProbingAfterReset) {
|
||||
probe_controller_->Process();
|
||||
}
|
||||
|
||||
TEST_F(ProbeControllerTest, TestExponentialProbingOverflow) {
|
||||
TEST_F(LegacyProbeControllerTest, TestExponentialProbingOverflow) {
|
||||
const int64_t kMbpsMultiplier = 1000000;
|
||||
probe_controller_->SetBitrates(kMinBitrateBps, 10 * kMbpsMultiplier,
|
||||
100 * kMbpsMultiplier);
|
||||
|
||||
@ -20,11 +20,9 @@ rtc_static_library("congestion_controller") {
|
||||
visibility = [ "*" ]
|
||||
configs += [ ":bwe_test_logging" ]
|
||||
sources = [
|
||||
"include/receive_side_congestion_controller.h",
|
||||
"include/send_side_congestion_controller.h",
|
||||
"pacer_controller.cc",
|
||||
"pacer_controller.h",
|
||||
"receive_side_congestion_controller.cc",
|
||||
"send_side_congestion_controller.cc",
|
||||
]
|
||||
|
||||
@ -39,6 +37,7 @@ rtc_static_library("congestion_controller") {
|
||||
deps = [
|
||||
":goog_cc",
|
||||
":transport_feedback",
|
||||
"../:congestion_controller",
|
||||
"../..:module_api",
|
||||
"../../..:webrtc_common",
|
||||
"../../../rtc_base:checks",
|
||||
@ -49,7 +48,6 @@ rtc_static_library("congestion_controller") {
|
||||
"../../../system_wrappers:field_trial_api",
|
||||
"../../../system_wrappers:metrics_api",
|
||||
"../../../system_wrappers:runtime_enabled_features_api",
|
||||
"../../bitrate_controller",
|
||||
"../../pacing",
|
||||
"../../remote_bitrate_estimator",
|
||||
"../../rtp_rtcp:rtp_rtcp_format",
|
||||
@ -84,6 +82,7 @@ rtc_static_library("goog_cc") {
|
||||
sources = [
|
||||
"alr_detector.cc",
|
||||
"alr_detector.h",
|
||||
"goog_cc_factory.cc",
|
||||
"goog_cc_network_control.cc",
|
||||
"goog_cc_network_control.h",
|
||||
"include/goog_cc_factory.h",
|
||||
@ -192,7 +191,6 @@ if (rtc_include_tests) {
|
||||
sources = [
|
||||
"congestion_controller_unittests_helper.cc",
|
||||
"congestion_controller_unittests_helper.h",
|
||||
"receive_side_congestion_controller_unittest.cc",
|
||||
"send_side_congestion_controller_unittest.cc",
|
||||
"send_time_history_unittest.cc",
|
||||
"transport_feedback_adapter_unittest.cc",
|
||||
@ -200,8 +198,9 @@ if (rtc_include_tests) {
|
||||
deps = [
|
||||
":congestion_controller",
|
||||
":goog_cc_unittests",
|
||||
":mock_congestion_controller",
|
||||
":transport_feedback",
|
||||
"../:congestion_controller",
|
||||
"../:mock_congestion_controller",
|
||||
"../../../logging:mocks",
|
||||
"../../../rtc_base:checks",
|
||||
"../../../rtc_base:rtc_base",
|
||||
@ -261,16 +260,4 @@ if (rtc_include_tests) {
|
||||
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
||||
}
|
||||
}
|
||||
|
||||
rtc_source_set("mock_congestion_controller") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"include/mock/mock_congestion_observer.h",
|
||||
"include/mock/mock_send_side_congestion_controller.h",
|
||||
]
|
||||
deps = [
|
||||
":congestion_controller",
|
||||
"../../../test:test_support",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
#include "rtc_base/race_checker.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class RtcEventLog;
|
||||
|
||||
namespace webrtc_cc {
|
||||
|
||||
30
modules/congestion_controller/rtp/goog_cc_factory.cc
Normal file
30
modules/congestion_controller/rtp/goog_cc_factory.cc
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "modules/congestion_controller/rtp/include/goog_cc_factory.h"
|
||||
|
||||
#include "modules/congestion_controller/rtp/goog_cc_network_control.h"
|
||||
#include "rtc_base/ptr_util.h"
|
||||
namespace webrtc {
|
||||
GoogCcNetworkControllerFactory::GoogCcNetworkControllerFactory(
|
||||
RtcEventLog* event_log)
|
||||
: event_log_(event_log) {}
|
||||
|
||||
NetworkControllerInterface::uptr GoogCcNetworkControllerFactory::Create(
|
||||
NetworkControllerObserver* observer) {
|
||||
return rtc::MakeUnique<webrtc_cc::GoogCcNetworkController>(event_log_,
|
||||
observer);
|
||||
}
|
||||
|
||||
TimeDelta GoogCcNetworkControllerFactory::GetProcessInterval() const {
|
||||
const int64_t kUpdateIntervalMs = 25;
|
||||
return TimeDelta::ms(kUpdateIntervalMs);
|
||||
}
|
||||
} // namespace webrtc
|
||||
@ -103,20 +103,6 @@ std::vector<PacketFeedback> ReceivedPacketsFeedbackAsRtp(
|
||||
|
||||
} // namespace
|
||||
|
||||
GoogCcNetworkControllerFactory::GoogCcNetworkControllerFactory(
|
||||
RtcEventLog* event_log)
|
||||
: event_log_(event_log) {}
|
||||
|
||||
NetworkControllerInterface::uptr GoogCcNetworkControllerFactory::Create(
|
||||
NetworkControllerObserver* observer) {
|
||||
return rtc::MakeUnique<GoogCcNetworkController>(event_log_, observer);
|
||||
}
|
||||
|
||||
TimeDelta GoogCcNetworkControllerFactory::GetProcessInterval() const {
|
||||
const int64_t kUpdateIntervalMs = 25;
|
||||
return TimeDelta::ms(kUpdateIntervalMs);
|
||||
}
|
||||
|
||||
GoogCcNetworkController::GoogCcNetworkController(
|
||||
RtcEventLog* event_log,
|
||||
NetworkControllerObserver* observer)
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "modules/congestion_controller/include/network_changed_observer.h"
|
||||
#include "modules/congestion_controller/rtp/network_control/include/network_control.h"
|
||||
#include "modules/congestion_controller/rtp/network_control/include/network_types.h"
|
||||
#include "modules/congestion_controller/rtp/pacer_controller.h"
|
||||
@ -58,23 +59,8 @@ class SendSideCongestionController : public CallStatsObserver,
|
||||
public TransportFeedbackObserver,
|
||||
public RtcpBandwidthObserver {
|
||||
public:
|
||||
// Observer class for bitrate changes announced due to change in bandwidth
|
||||
// estimate or due to that the send pacer is full. Fraction loss and rtt is
|
||||
// also part of this callback to allow the observer to optimize its settings
|
||||
// for different types of network environments. The bitrate does not include
|
||||
// packet headers and is measured in bits per second.
|
||||
class Observer {
|
||||
public:
|
||||
virtual void OnNetworkChanged(uint32_t bitrate_bps,
|
||||
uint8_t fraction_loss, // 0 - 255.
|
||||
int64_t rtt_ms,
|
||||
int64_t probing_interval_ms) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~Observer() {}
|
||||
};
|
||||
SendSideCongestionController(const Clock* clock,
|
||||
Observer* observer,
|
||||
NetworkChangedObserver* observer,
|
||||
RtcEventLog* event_log,
|
||||
PacedSender* pacer);
|
||||
~SendSideCongestionController() override;
|
||||
@ -88,8 +74,8 @@ class SendSideCongestionController : public CallStatsObserver,
|
||||
// reference to Call, which then registers itself as the observer. We should
|
||||
// try to break this circular chain of references, and make the observer a
|
||||
// construction time constant.
|
||||
void RegisterNetworkObserver(Observer* observer);
|
||||
void DeRegisterNetworkObserver(Observer* observer);
|
||||
void RegisterNetworkObserver(NetworkChangedObserver* observer);
|
||||
void DeRegisterNetworkObserver(NetworkChangedObserver* observer);
|
||||
|
||||
virtual void SetBweBitrates(int min_bitrate_bps,
|
||||
int start_bitrate_bps,
|
||||
|
||||
@ -23,8 +23,6 @@ using testing::Matcher;
|
||||
using testing::NiceMock;
|
||||
using testing::Return;
|
||||
|
||||
using webrtc::ProbeClusterConfig;
|
||||
|
||||
namespace webrtc {
|
||||
namespace webrtc_cc {
|
||||
namespace test {
|
||||
|
||||
@ -116,10 +116,8 @@ class ControlHandler : public NetworkControllerObserver {
|
||||
void OnNetworkAvailability(NetworkAvailability msg);
|
||||
void OnPacerQueueUpdate(PacerQueueUpdate msg);
|
||||
|
||||
void RegisterNetworkObserver(
|
||||
SendSideCongestionController::Observer* observer);
|
||||
void DeRegisterNetworkObserver(
|
||||
SendSideCongestionController::Observer* observer);
|
||||
void RegisterNetworkObserver(NetworkChangedObserver* observer);
|
||||
void DeRegisterNetworkObserver(NetworkChangedObserver* observer);
|
||||
|
||||
rtc::Optional<TargetTransferRate> last_transfer_rate();
|
||||
bool pacer_configured();
|
||||
@ -142,7 +140,7 @@ class ControlHandler : public NetworkControllerObserver {
|
||||
RTC_GUARDED_BY(state_lock_);
|
||||
bool pacer_configured_ RTC_GUARDED_BY(state_lock_) = false;
|
||||
|
||||
SendSideCongestionController::Observer* observer_ = nullptr;
|
||||
NetworkChangedObserver* observer_ = nullptr;
|
||||
rtc::Optional<TargetTransferRate> current_target_rate_msg_;
|
||||
bool network_available_ = true;
|
||||
int64_t last_reported_target_bitrate_bps_ = 0;
|
||||
@ -204,15 +202,14 @@ void ControlHandler::OnPacerQueueUpdate(PacerQueueUpdate msg) {
|
||||
OnNetworkInvalidation();
|
||||
}
|
||||
|
||||
void ControlHandler::RegisterNetworkObserver(
|
||||
SendSideCongestionController::Observer* observer) {
|
||||
void ControlHandler::RegisterNetworkObserver(NetworkChangedObserver* observer) {
|
||||
RTC_DCHECK_CALLED_SEQUENTIALLY(&sequenced_checker_);
|
||||
RTC_DCHECK(observer_ == nullptr);
|
||||
observer_ = observer;
|
||||
}
|
||||
|
||||
void ControlHandler::DeRegisterNetworkObserver(
|
||||
SendSideCongestionController::Observer* observer) {
|
||||
NetworkChangedObserver* observer) {
|
||||
RTC_DCHECK_CALLED_SEQUENTIALLY(&sequenced_checker_);
|
||||
RTC_DCHECK_EQ(observer_, observer);
|
||||
observer_ = nullptr;
|
||||
@ -301,7 +298,7 @@ RateLimiter* ControlHandler::retransmission_rate_limiter() {
|
||||
|
||||
SendSideCongestionController::SendSideCongestionController(
|
||||
const Clock* clock,
|
||||
Observer* observer,
|
||||
NetworkChangedObserver* observer,
|
||||
RtcEventLog* event_log,
|
||||
PacedSender* pacer)
|
||||
: SendSideCongestionController(clock,
|
||||
@ -347,14 +344,15 @@ void SendSideCongestionController::DeRegisterPacketFeedbackObserver(
|
||||
transport_feedback_adapter_.DeRegisterPacketFeedbackObserver(observer);
|
||||
}
|
||||
|
||||
void SendSideCongestionController::RegisterNetworkObserver(Observer* observer) {
|
||||
void SendSideCongestionController::RegisterNetworkObserver(
|
||||
NetworkChangedObserver* observer) {
|
||||
WaitOnTask([this, observer]() {
|
||||
control_handler->RegisterNetworkObserver(observer);
|
||||
});
|
||||
}
|
||||
|
||||
void SendSideCongestionController::DeRegisterNetworkObserver(
|
||||
Observer* observer) {
|
||||
NetworkChangedObserver* observer) {
|
||||
WaitOnTask([this, observer]() {
|
||||
control_handler->DeRegisterNetworkObserver(observer);
|
||||
});
|
||||
|
||||
@ -10,8 +10,9 @@
|
||||
|
||||
#include "modules/congestion_controller/rtp/include/send_side_congestion_controller.h"
|
||||
#include "logging/rtc_event_log/mock/mock_rtc_event_log.h"
|
||||
#include "modules/congestion_controller/include/mock/mock_congestion_observer.h"
|
||||
#include "modules/congestion_controller/include/network_changed_observer.h"
|
||||
#include "modules/congestion_controller/rtp/congestion_controller_unittests_helper.h"
|
||||
#include "modules/congestion_controller/rtp/include/mock/mock_congestion_observer.h"
|
||||
#include "modules/pacing/mock/mock_paced_sender.h"
|
||||
#include "modules/pacing/packet_router.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
@ -36,6 +37,7 @@ namespace webrtc_cc {
|
||||
namespace test {
|
||||
|
||||
namespace {
|
||||
using webrtc::test::MockCongestionObserver;
|
||||
const webrtc::PacedPacketInfo kPacingInfo0(0, 5, 2000);
|
||||
const webrtc::PacedPacketInfo kPacingInfo1(1, 8, 4000);
|
||||
|
||||
@ -46,7 +48,7 @@ class SendSideCongestionControllerForTest
|
||||
: public SendSideCongestionController {
|
||||
public:
|
||||
SendSideCongestionControllerForTest(const Clock* clock,
|
||||
Observer* observer,
|
||||
NetworkChangedObserver* observer,
|
||||
RtcEventLog* event_log,
|
||||
PacedSender* pacer)
|
||||
: SendSideCongestionController(clock, observer, event_log, pacer) {}
|
||||
@ -58,7 +60,6 @@ class SendSideCongestionControllerForTest
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
class SendSideCongestionControllerTest : public ::testing::Test {
|
||||
protected:
|
||||
SendSideCongestionControllerTest()
|
||||
@ -102,7 +103,7 @@ class SendSideCongestionControllerTest : public ::testing::Test {
|
||||
|
||||
// Allows us to track the target bitrate, without prescribing the exact
|
||||
// iterations when this would hapen, like a mock would.
|
||||
class TargetBitrateObserver : public SendSideCongestionController::Observer {
|
||||
class TargetBitrateObserver : public NetworkChangedObserver {
|
||||
public:
|
||||
explicit TargetBitrateObserver(SendSideCongestionControllerTest* owner)
|
||||
: owner_(owner) {}
|
||||
@ -478,7 +479,7 @@ TEST_F(SendSideCongestionControllerTest, UpdatesDelayBasedEstimate) {
|
||||
}
|
||||
|
||||
TEST_F(SendSideCongestionControllerTest, PacerQueueEncodeRatePushback) {
|
||||
ScopedFieldTrials pushback_field_trial(
|
||||
::webrtc::test::ScopedFieldTrials pushback_field_trial(
|
||||
"WebRTC-PacerPushbackExperiment/Enabled/");
|
||||
SetUp();
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ const PacedPacketInfo kPacingInfo1(1, 8, 4000);
|
||||
const PacedPacketInfo kPacingInfo2(2, 14, 7000);
|
||||
const PacedPacketInfo kPacingInfo3(3, 20, 10000);
|
||||
const PacedPacketInfo kPacingInfo4(4, 22, 10000);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace test {
|
||||
|
||||
@ -86,8 +86,7 @@ TEST_F(TransportFeedbackAdapterTest, ObserverSanity) {
|
||||
const std::vector<PacketFeedback> packets = {
|
||||
PacketFeedback(100, 200, 0, 1000, kPacingInfo0),
|
||||
PacketFeedback(110, 210, 1, 2000, kPacingInfo0),
|
||||
PacketFeedback(120, 220, 2, 3000, kPacingInfo0)
|
||||
};
|
||||
PacketFeedback(120, 220, 2, 3000, kPacingInfo0)};
|
||||
|
||||
rtcp::TransportFeedback feedback;
|
||||
feedback.SetBase(packets[0].sequence_number,
|
||||
@ -169,8 +168,7 @@ TEST_F(TransportFeedbackAdapterTest, FeedbackVectorReportsUnreceived) {
|
||||
PacketFeedback(130, 230, 3, 1500, kPacingInfo0),
|
||||
PacketFeedback(140, 240, 4, 1500, kPacingInfo0),
|
||||
PacketFeedback(150, 250, 5, 1500, kPacingInfo0),
|
||||
PacketFeedback(160, 260, 6, 1500, kPacingInfo0)
|
||||
};
|
||||
PacketFeedback(160, 260, 6, 1500, kPacingInfo0)};
|
||||
|
||||
for (const PacketFeedback& packet : sent_packets)
|
||||
OnSentPacket(packet);
|
||||
@ -178,8 +176,7 @@ TEST_F(TransportFeedbackAdapterTest, FeedbackVectorReportsUnreceived) {
|
||||
// Note: Important to include the last packet, as only unreceived packets in
|
||||
// between received packets can be inferred.
|
||||
std::vector<PacketFeedback> received_packets = {
|
||||
sent_packets[0], sent_packets[2], sent_packets[6]
|
||||
};
|
||||
sent_packets[0], sent_packets[2], sent_packets[6]};
|
||||
|
||||
rtcp::TransportFeedback feedback;
|
||||
feedback.SetBase(received_packets[0].sequence_number,
|
||||
|
||||
@ -44,11 +44,11 @@ const uint32_t kInitialBitrateBps = 60000;
|
||||
|
||||
namespace test {
|
||||
|
||||
class SendSideCongestionControllerTest : public ::testing::Test {
|
||||
class LegacySendSideCongestionControllerTest : public ::testing::Test {
|
||||
protected:
|
||||
SendSideCongestionControllerTest()
|
||||
LegacySendSideCongestionControllerTest()
|
||||
: clock_(123456), target_bitrate_observer_(this) {}
|
||||
~SendSideCongestionControllerTest() override {}
|
||||
~LegacySendSideCongestionControllerTest() override {}
|
||||
|
||||
void SetUp() override {
|
||||
pacer_.reset(new NiceMock<MockPacedSender>());
|
||||
@ -87,7 +87,8 @@ class SendSideCongestionControllerTest : public ::testing::Test {
|
||||
// iterations when this would hapen, like a mock would.
|
||||
class TargetBitrateObserver : public NetworkChangedObserver {
|
||||
public:
|
||||
explicit TargetBitrateObserver(SendSideCongestionControllerTest* owner)
|
||||
explicit TargetBitrateObserver(
|
||||
LegacySendSideCongestionControllerTest* owner)
|
||||
: owner_(owner) {}
|
||||
~TargetBitrateObserver() override = default;
|
||||
void OnNetworkChanged(uint32_t bitrate_bps,
|
||||
@ -98,7 +99,7 @@ class SendSideCongestionControllerTest : public ::testing::Test {
|
||||
}
|
||||
|
||||
private:
|
||||
SendSideCongestionControllerTest* owner_;
|
||||
LegacySendSideCongestionControllerTest* owner_;
|
||||
};
|
||||
|
||||
void PacketTransmissionAndFeedbackBlock(uint16_t* seq_num,
|
||||
@ -142,7 +143,7 @@ class SendSideCongestionControllerTest : public ::testing::Test {
|
||||
rtc::Optional<uint32_t> target_bitrate_bps_;
|
||||
};
|
||||
|
||||
TEST_F(SendSideCongestionControllerTest, OnNetworkChanged) {
|
||||
TEST_F(LegacySendSideCongestionControllerTest, OnNetworkChanged) {
|
||||
// Test no change.
|
||||
clock_.AdvanceTimeMilliseconds(25);
|
||||
controller_->Process();
|
||||
@ -160,7 +161,7 @@ TEST_F(SendSideCongestionControllerTest, OnNetworkChanged) {
|
||||
controller_->Process();
|
||||
}
|
||||
|
||||
TEST_F(SendSideCongestionControllerTest, OnSendQueueFull) {
|
||||
TEST_F(LegacySendSideCongestionControllerTest, OnSendQueueFull) {
|
||||
EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
|
||||
.WillOnce(Return(PacedSender::kMaxQueueLengthMs + 1));
|
||||
|
||||
@ -175,7 +176,8 @@ TEST_F(SendSideCongestionControllerTest, OnSendQueueFull) {
|
||||
controller_->Process();
|
||||
}
|
||||
|
||||
TEST_F(SendSideCongestionControllerTest, OnSendQueueFullAndEstimateChange) {
|
||||
TEST_F(LegacySendSideCongestionControllerTest,
|
||||
OnSendQueueFullAndEstimateChange) {
|
||||
EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
|
||||
.WillOnce(Return(PacedSender::kMaxQueueLengthMs + 1));
|
||||
EXPECT_CALL(observer_, OnNetworkChanged(0, _, _, _));
|
||||
@ -199,7 +201,7 @@ TEST_F(SendSideCongestionControllerTest, OnSendQueueFullAndEstimateChange) {
|
||||
controller_->Process();
|
||||
}
|
||||
|
||||
TEST_F(SendSideCongestionControllerTest, SignalNetworkState) {
|
||||
TEST_F(LegacySendSideCongestionControllerTest, SignalNetworkState) {
|
||||
EXPECT_CALL(observer_, OnNetworkChanged(0, _, _, _));
|
||||
controller_->SignalNetworkState(kNetworkDown);
|
||||
|
||||
@ -210,7 +212,7 @@ TEST_F(SendSideCongestionControllerTest, SignalNetworkState) {
|
||||
controller_->SignalNetworkState(kNetworkDown);
|
||||
}
|
||||
|
||||
TEST_F(SendSideCongestionControllerTest, OnNetworkRouteChanged) {
|
||||
TEST_F(LegacySendSideCongestionControllerTest, OnNetworkRouteChanged) {
|
||||
int new_bitrate = 200000;
|
||||
testing::Mock::VerifyAndClearExpectations(pacer_.get());
|
||||
EXPECT_CALL(observer_, OnNetworkChanged(new_bitrate, _, _, _));
|
||||
@ -230,7 +232,7 @@ TEST_F(SendSideCongestionControllerTest, OnNetworkRouteChanged) {
|
||||
controller_->OnNetworkRouteChanged(route, -1, -1, -1);
|
||||
}
|
||||
|
||||
TEST_F(SendSideCongestionControllerTest, OldFeedback) {
|
||||
TEST_F(LegacySendSideCongestionControllerTest, OldFeedback) {
|
||||
int new_bitrate = 200000;
|
||||
testing::Mock::VerifyAndClearExpectations(pacer_.get());
|
||||
EXPECT_CALL(observer_, OnNetworkChanged(new_bitrate, _, _, _));
|
||||
@ -273,7 +275,7 @@ TEST_F(SendSideCongestionControllerTest, OldFeedback) {
|
||||
controller_->OnNetworkRouteChanged(route, -1, -1, -1);
|
||||
}
|
||||
|
||||
TEST_F(SendSideCongestionControllerTest,
|
||||
TEST_F(LegacySendSideCongestionControllerTest,
|
||||
SignalNetworkStateAndQueueIsFullAndEstimateChange) {
|
||||
// Send queue is full
|
||||
EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
|
||||
@ -302,7 +304,7 @@ TEST_F(SendSideCongestionControllerTest,
|
||||
controller_->Process();
|
||||
}
|
||||
|
||||
TEST_F(SendSideCongestionControllerTest, GetPacerQueuingDelayMs) {
|
||||
TEST_F(LegacySendSideCongestionControllerTest, GetPacerQueuingDelayMs) {
|
||||
EXPECT_CALL(observer_, OnNetworkChanged(_, _, _, _)).Times(AtLeast(1));
|
||||
|
||||
const int64_t kQueueTimeMs = 123;
|
||||
@ -318,7 +320,7 @@ TEST_F(SendSideCongestionControllerTest, GetPacerQueuingDelayMs) {
|
||||
EXPECT_EQ(kQueueTimeMs, controller_->GetPacerQueuingDelayMs());
|
||||
}
|
||||
|
||||
TEST_F(SendSideCongestionControllerTest, GetProbingInterval) {
|
||||
TEST_F(LegacySendSideCongestionControllerTest, GetProbingInterval) {
|
||||
clock_.AdvanceTimeMilliseconds(25);
|
||||
controller_->Process();
|
||||
|
||||
@ -329,7 +331,7 @@ TEST_F(SendSideCongestionControllerTest, GetProbingInterval) {
|
||||
controller_->Process();
|
||||
}
|
||||
|
||||
TEST_F(SendSideCongestionControllerTest, ProbeOnRouteChange) {
|
||||
TEST_F(LegacySendSideCongestionControllerTest, ProbeOnRouteChange) {
|
||||
testing::Mock::VerifyAndClearExpectations(pacer_.get());
|
||||
EXPECT_CALL(*pacer_, CreateProbeCluster(kInitialBitrateBps * 6));
|
||||
EXPECT_CALL(*pacer_, CreateProbeCluster(kInitialBitrateBps * 12));
|
||||
@ -342,7 +344,7 @@ TEST_F(SendSideCongestionControllerTest, ProbeOnRouteChange) {
|
||||
|
||||
// Estimated bitrate reduced when the feedbacks arrive with such a long delay,
|
||||
// that the send-time-history no longer holds the feedbacked packets.
|
||||
TEST_F(SendSideCongestionControllerTest, LongFeedbackDelays) {
|
||||
TEST_F(LegacySendSideCongestionControllerTest, LongFeedbackDelays) {
|
||||
TargetBitrateTrackingSetup();
|
||||
|
||||
const int64_t kFeedbackTimeoutMs = 60001;
|
||||
@ -433,7 +435,7 @@ TEST_F(SendSideCongestionControllerTest, LongFeedbackDelays) {
|
||||
|
||||
// Bandwidth estimation is updated when feedbacks are received.
|
||||
// Feedbacks which show an increasing delay cause the estimation to be reduced.
|
||||
TEST_F(SendSideCongestionControllerTest, UpdatesDelayBasedEstimate) {
|
||||
TEST_F(LegacySendSideCongestionControllerTest, UpdatesDelayBasedEstimate) {
|
||||
TargetBitrateTrackingSetup();
|
||||
|
||||
const int64_t kRunTimeMs = 6000;
|
||||
@ -452,7 +454,7 @@ TEST_F(SendSideCongestionControllerTest, UpdatesDelayBasedEstimate) {
|
||||
EXPECT_LT(*target_bitrate_bps_, bitrate_before_delay);
|
||||
}
|
||||
|
||||
TEST_F(SendSideCongestionControllerTest, PacerQueueEncodeRatePushback) {
|
||||
TEST_F(LegacySendSideCongestionControllerTest, PacerQueueEncodeRatePushback) {
|
||||
ScopedFieldTrials pushback_field_trial(
|
||||
"WebRTC-PacerPushbackExperiment/Enabled/");
|
||||
SetUp();
|
||||
|
||||
@ -23,11 +23,11 @@ namespace test {
|
||||
|
||||
static const int kDefaultHistoryLengthMs = 1000;
|
||||
|
||||
class SendTimeHistoryTest : public ::testing::Test {
|
||||
class LegacySendTimeHistoryTest : public ::testing::Test {
|
||||
protected:
|
||||
SendTimeHistoryTest()
|
||||
LegacySendTimeHistoryTest()
|
||||
: clock_(0), history_(&clock_, kDefaultHistoryLengthMs) {}
|
||||
~SendTimeHistoryTest() {}
|
||||
~LegacySendTimeHistoryTest() {}
|
||||
|
||||
virtual void SetUp() {}
|
||||
|
||||
@ -47,7 +47,7 @@ class SendTimeHistoryTest : public ::testing::Test {
|
||||
SendTimeHistory history_;
|
||||
};
|
||||
|
||||
TEST_F(SendTimeHistoryTest, SaveAndRestoreNetworkId) {
|
||||
TEST_F(LegacySendTimeHistoryTest, SaveAndRestoreNetworkId) {
|
||||
const PacedPacketInfo kPacingInfo(0, 5, 1200);
|
||||
uint16_t sequence_number = 0;
|
||||
int64_t now_ms = clock_.TimeInMilliseconds();
|
||||
@ -63,7 +63,7 @@ TEST_F(SendTimeHistoryTest, SaveAndRestoreNetworkId) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SendTimeHistoryTest, AddRemoveOne) {
|
||||
TEST_F(LegacySendTimeHistoryTest, AddRemoveOne) {
|
||||
const uint16_t kSeqNo = 10;
|
||||
// TODO(philipel): Fix PacedPacketInfo constructor?
|
||||
const PacedPacketInfo kPacingInfo(0, 5, 1200);
|
||||
@ -82,7 +82,7 @@ TEST_F(SendTimeHistoryTest, AddRemoveOne) {
|
||||
EXPECT_FALSE(history_.GetFeedback(&received_packet3, true));
|
||||
}
|
||||
|
||||
TEST_F(SendTimeHistoryTest, PopulatesExpectedFields) {
|
||||
TEST_F(LegacySendTimeHistoryTest, PopulatesExpectedFields) {
|
||||
const uint16_t kSeqNo = 10;
|
||||
const int64_t kSendTime = 1000;
|
||||
const int64_t kReceiveTime = 2000;
|
||||
@ -100,7 +100,7 @@ TEST_F(SendTimeHistoryTest, PopulatesExpectedFields) {
|
||||
EXPECT_EQ(kPacingInfo, packet_feedback.pacing_info);
|
||||
}
|
||||
|
||||
TEST_F(SendTimeHistoryTest, AddThenRemoveOutOfOrder) {
|
||||
TEST_F(LegacySendTimeHistoryTest, AddThenRemoveOutOfOrder) {
|
||||
std::vector<PacketFeedback> sent_packets;
|
||||
std::vector<PacketFeedback> received_packets;
|
||||
const size_t num_items = 100;
|
||||
@ -138,7 +138,7 @@ TEST_F(SendTimeHistoryTest, AddThenRemoveOutOfOrder) {
|
||||
EXPECT_FALSE(history_.GetFeedback(&packet, false));
|
||||
}
|
||||
|
||||
TEST_F(SendTimeHistoryTest, HistorySize) {
|
||||
TEST_F(LegacySendTimeHistoryTest, HistorySize) {
|
||||
const int kItems = kDefaultHistoryLengthMs / 100;
|
||||
for (int i = 0; i < kItems; ++i) {
|
||||
clock_.AdvanceTimeMilliseconds(100);
|
||||
@ -162,7 +162,7 @@ TEST_F(SendTimeHistoryTest, HistorySize) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SendTimeHistoryTest, HistorySizeWithWraparound) {
|
||||
TEST_F(LegacySendTimeHistoryTest, HistorySizeWithWraparound) {
|
||||
const uint16_t kMaxSeqNo = std::numeric_limits<uint16_t>::max();
|
||||
AddPacketWithSendTime(kMaxSeqNo - 2, 0, 0, PacedPacketInfo());
|
||||
|
||||
@ -203,7 +203,7 @@ TEST_F(SendTimeHistoryTest, HistorySizeWithWraparound) {
|
||||
EXPECT_TRUE(history_.GetFeedback(&packet10, false));
|
||||
}
|
||||
|
||||
TEST_F(SendTimeHistoryTest, InterlievedGetAndRemove) {
|
||||
TEST_F(LegacySendTimeHistoryTest, InterlievedGetAndRemove) {
|
||||
const uint16_t kSeqNo = 1;
|
||||
const int64_t kTimestamp = 2;
|
||||
const PacedPacketInfo kPacingInfo1(1, 1, 100);
|
||||
|
||||
@ -45,11 +45,11 @@ class MockPacketFeedbackObserver : public webrtc::PacketFeedbackObserver {
|
||||
void(const std::vector<PacketFeedback>& packet_feedback_vector));
|
||||
};
|
||||
|
||||
class TransportFeedbackAdapterTest : public ::testing::Test {
|
||||
class LegacyTransportFeedbackAdapterTest : public ::testing::Test {
|
||||
public:
|
||||
TransportFeedbackAdapterTest() : clock_(0) {}
|
||||
LegacyTransportFeedbackAdapterTest() : clock_(0) {}
|
||||
|
||||
virtual ~TransportFeedbackAdapterTest() {}
|
||||
virtual ~LegacyTransportFeedbackAdapterTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
adapter_.reset(new TransportFeedbackAdapter(&clock_));
|
||||
@ -78,7 +78,7 @@ class TransportFeedbackAdapterTest : public ::testing::Test {
|
||||
std::unique_ptr<TransportFeedbackAdapter> adapter_;
|
||||
};
|
||||
|
||||
TEST_F(TransportFeedbackAdapterTest, ObserverSanity) {
|
||||
TEST_F(LegacyTransportFeedbackAdapterTest, ObserverSanity) {
|
||||
MockPacketFeedbackObserver mock;
|
||||
adapter_->RegisterPacketFeedbackObserver(&mock);
|
||||
|
||||
@ -119,14 +119,16 @@ TEST_F(TransportFeedbackAdapterTest, ObserverSanity) {
|
||||
}
|
||||
|
||||
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
|
||||
TEST_F(TransportFeedbackAdapterTest, ObserverDoubleRegistrationDeathTest) {
|
||||
TEST_F(LegacyTransportFeedbackAdapterTest,
|
||||
ObserverDoubleRegistrationDeathTest) {
|
||||
MockPacketFeedbackObserver mock;
|
||||
adapter_->RegisterPacketFeedbackObserver(&mock);
|
||||
EXPECT_DEATH(adapter_->RegisterPacketFeedbackObserver(&mock), "");
|
||||
adapter_->DeRegisterPacketFeedbackObserver(&mock);
|
||||
}
|
||||
|
||||
TEST_F(TransportFeedbackAdapterTest, ObserverMissingDeRegistrationDeathTest) {
|
||||
TEST_F(LegacyTransportFeedbackAdapterTest,
|
||||
ObserverMissingDeRegistrationDeathTest) {
|
||||
MockPacketFeedbackObserver mock;
|
||||
adapter_->RegisterPacketFeedbackObserver(&mock);
|
||||
EXPECT_DEATH(adapter_.reset(), "");
|
||||
@ -134,7 +136,8 @@ TEST_F(TransportFeedbackAdapterTest, ObserverMissingDeRegistrationDeathTest) {
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F(TransportFeedbackAdapterTest, AdaptsFeedbackAndPopulatesSendTimes) {
|
||||
TEST_F(LegacyTransportFeedbackAdapterTest,
|
||||
AdaptsFeedbackAndPopulatesSendTimes) {
|
||||
std::vector<PacketFeedback> packets;
|
||||
packets.push_back(PacketFeedback(100, 200, 0, 1500, kPacingInfo0));
|
||||
packets.push_back(PacketFeedback(110, 210, 1, 1500, kPacingInfo0));
|
||||
@ -160,7 +163,7 @@ TEST_F(TransportFeedbackAdapterTest, AdaptsFeedbackAndPopulatesSendTimes) {
|
||||
ComparePacketFeedbackVectors(packets, adapter_->GetTransportFeedbackVector());
|
||||
}
|
||||
|
||||
TEST_F(TransportFeedbackAdapterTest, FeedbackVectorReportsUnreceived) {
|
||||
TEST_F(LegacyTransportFeedbackAdapterTest, FeedbackVectorReportsUnreceived) {
|
||||
std::vector<PacketFeedback> sent_packets = {
|
||||
PacketFeedback(100, 220, 0, 1500, kPacingInfo0),
|
||||
PacketFeedback(110, 210, 1, 1500, kPacingInfo0),
|
||||
@ -196,7 +199,7 @@ TEST_F(TransportFeedbackAdapterTest, FeedbackVectorReportsUnreceived) {
|
||||
adapter_->GetTransportFeedbackVector());
|
||||
}
|
||||
|
||||
TEST_F(TransportFeedbackAdapterTest, HandlesDroppedPackets) {
|
||||
TEST_F(LegacyTransportFeedbackAdapterTest, HandlesDroppedPackets) {
|
||||
std::vector<PacketFeedback> packets;
|
||||
packets.push_back(PacketFeedback(100, 200, 0, 1500, kPacingInfo0));
|
||||
packets.push_back(PacketFeedback(110, 210, 1, 1500, kPacingInfo1));
|
||||
@ -240,7 +243,7 @@ TEST_F(TransportFeedbackAdapterTest, HandlesDroppedPackets) {
|
||||
adapter_->GetTransportFeedbackVector());
|
||||
}
|
||||
|
||||
TEST_F(TransportFeedbackAdapterTest, SendTimeWrapsBothWays) {
|
||||
TEST_F(LegacyTransportFeedbackAdapterTest, SendTimeWrapsBothWays) {
|
||||
int64_t kHighArrivalTimeMs = rtcp::TransportFeedback::kDeltaScaleFactor *
|
||||
static_cast<int64_t>(1 << 8) *
|
||||
static_cast<int64_t>((1 << 23) - 1) / 1000;
|
||||
@ -277,7 +280,7 @@ TEST_F(TransportFeedbackAdapterTest, SendTimeWrapsBothWays) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(TransportFeedbackAdapterTest, HandlesArrivalReordering) {
|
||||
TEST_F(LegacyTransportFeedbackAdapterTest, HandlesArrivalReordering) {
|
||||
std::vector<PacketFeedback> packets;
|
||||
packets.push_back(PacketFeedback(120, 200, 0, 1500, kPacingInfo0));
|
||||
packets.push_back(PacketFeedback(110, 210, 1, 1500, kPacingInfo0));
|
||||
@ -304,7 +307,7 @@ TEST_F(TransportFeedbackAdapterTest, HandlesArrivalReordering) {
|
||||
ComparePacketFeedbackVectors(packets, adapter_->GetTransportFeedbackVector());
|
||||
}
|
||||
|
||||
TEST_F(TransportFeedbackAdapterTest, TimestampDeltas) {
|
||||
TEST_F(LegacyTransportFeedbackAdapterTest, TimestampDeltas) {
|
||||
std::vector<PacketFeedback> sent_packets;
|
||||
const int64_t kSmallDeltaUs =
|
||||
rtcp::TransportFeedback::kDeltaScaleFactor * ((1 << 8) - 1);
|
||||
|
||||
@ -46,27 +46,27 @@ void TestEstimator(double slope, double jitter_stddev, double tolerance) {
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TEST(TrendlineEstimator, PerfectLineSlopeOneHalf) {
|
||||
TEST(LegacyTrendlineEstimator, PerfectLineSlopeOneHalf) {
|
||||
TestEstimator(0.5, 0, 0.001);
|
||||
}
|
||||
|
||||
TEST(TrendlineEstimator, PerfectLineSlopeMinusOne) {
|
||||
TEST(LegacyTrendlineEstimator, PerfectLineSlopeMinusOne) {
|
||||
TestEstimator(-1, 0, 0.001);
|
||||
}
|
||||
|
||||
TEST(TrendlineEstimator, PerfectLineSlopeZero) {
|
||||
TEST(LegacyTrendlineEstimator, PerfectLineSlopeZero) {
|
||||
TestEstimator(0, 0, 0.001);
|
||||
}
|
||||
|
||||
TEST(TrendlineEstimator, JitteryLineSlopeOneHalf) {
|
||||
TEST(LegacyTrendlineEstimator, JitteryLineSlopeOneHalf) {
|
||||
TestEstimator(0.5, kAvgTimeBetweenPackets / 3.0, 0.01);
|
||||
}
|
||||
|
||||
TEST(TrendlineEstimator, JitteryLineSlopeMinusOne) {
|
||||
TEST(LegacyTrendlineEstimator, JitteryLineSlopeMinusOne) {
|
||||
TestEstimator(-1, kAvgTimeBetweenPackets / 3.0, 0.075);
|
||||
}
|
||||
|
||||
TEST(TrendlineEstimator, JitteryLineSlopeZero) {
|
||||
TEST(LegacyTrendlineEstimator, JitteryLineSlopeZero) {
|
||||
TestEstimator(0, kAvgTimeBetweenPackets / 3.0, 0.02);
|
||||
}
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ class SimulateOutgoingTrafficIn {
|
||||
};
|
||||
} // namespace
|
||||
|
||||
class AlrDetectorTest : public testing::Test {
|
||||
class LegacyAlrDetectorTest : public testing::Test {
|
||||
public:
|
||||
void SetUp() override {
|
||||
alr_detector_.SetEstimatedBitrate(kEstimatedBitrateBps);
|
||||
@ -75,7 +75,7 @@ class AlrDetectorTest : public testing::Test {
|
||||
AlrDetector alr_detector_;
|
||||
};
|
||||
|
||||
TEST_F(AlrDetectorTest, AlrDetection) {
|
||||
TEST_F(LegacyAlrDetectorTest, AlrDetection) {
|
||||
// Start in non-ALR state.
|
||||
EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
|
||||
|
||||
@ -98,7 +98,7 @@ TEST_F(AlrDetectorTest, AlrDetection) {
|
||||
EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
|
||||
}
|
||||
|
||||
TEST_F(AlrDetectorTest, ShortSpike) {
|
||||
TEST_F(LegacyAlrDetectorTest, ShortSpike) {
|
||||
// Start in non-ALR state.
|
||||
EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
|
||||
|
||||
@ -121,7 +121,7 @@ TEST_F(AlrDetectorTest, ShortSpike) {
|
||||
EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
|
||||
}
|
||||
|
||||
TEST_F(AlrDetectorTest, BandwidthEstimateChanges) {
|
||||
TEST_F(LegacyAlrDetectorTest, BandwidthEstimateChanges) {
|
||||
// Start in non-ALR state.
|
||||
EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
|
||||
|
||||
@ -143,7 +143,7 @@ TEST_F(AlrDetectorTest, BandwidthEstimateChanges) {
|
||||
EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
|
||||
}
|
||||
|
||||
TEST_F(AlrDetectorTest, ParseControlFieldTrial) {
|
||||
TEST_F(LegacyAlrDetectorTest, ParseControlFieldTrial) {
|
||||
webrtc::test::ScopedFieldTrials field_trial(
|
||||
"WebRTC-ProbingScreenshareBwe/Control/");
|
||||
rtc::Optional<AlrExperimentSettings> parsed_params =
|
||||
@ -152,7 +152,7 @@ TEST_F(AlrDetectorTest, ParseControlFieldTrial) {
|
||||
EXPECT_FALSE(static_cast<bool>(parsed_params));
|
||||
}
|
||||
|
||||
TEST_F(AlrDetectorTest, ParseActiveFieldTrial) {
|
||||
TEST_F(LegacyAlrDetectorTest, ParseActiveFieldTrial) {
|
||||
webrtc::test::ScopedFieldTrials field_trial(
|
||||
"WebRTC-ProbingScreenshareBwe/1.1,2875,85,20,-20,1/");
|
||||
rtc::Optional<AlrExperimentSettings> parsed_params =
|
||||
|
||||
Reference in New Issue
Block a user