Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(875)

Unified Diff: webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc

Issue 1188823007: Only use paced packets for estimating bitrate probes. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added unittest Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc
diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc
index 4aa6b52d0062ab79a3750ca9f8fb8f0340192a44..2ea52ca0ac3d9fe97e742fcc519b34840cbfaaca 100644
--- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc
+++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc
@@ -221,7 +221,8 @@ void RemoteBitrateEstimatorTest::IncomingPacket(uint32_t ssrc,
size_t payload_size,
int64_t arrival_time,
uint32_t rtp_timestamp,
- uint32_t absolute_send_time) {
+ uint32_t absolute_send_time,
+ bool was_paced) {
RTPHeader header;
memset(&header, 0, sizeof(header));
header.ssrc = ssrc;
@@ -229,7 +230,7 @@ void RemoteBitrateEstimatorTest::IncomingPacket(uint32_t ssrc,
header.extension.hasAbsoluteSendTime = true;
header.extension.absoluteSendTime = absolute_send_time;
bitrate_estimator_->IncomingPacket(arrival_time + kArrivalTimeClockOffsetMs,
- payload_size, header);
+ payload_size, header, was_paced);
}
// Generates a frame of packets belonging to a stream at a given bitrate and
@@ -252,11 +253,9 @@ bool RemoteBitrateEstimatorTest::GenerateAndProcessFrame(unsigned int ssrc,
// since both are used in IncomingPacket().
clock_.AdvanceTimeMicroseconds(packet->arrival_time -
clock_.TimeInMicroseconds());
- IncomingPacket(packet->ssrc,
- packet->size,
- (packet->arrival_time + 500) / 1000,
- packet->rtp_timestamp,
- AbsSendTime(packet->send_time, 1000000));
+ IncomingPacket(packet->ssrc, packet->size,
+ (packet->arrival_time + 500) / 1000, packet->rtp_timestamp,
+ AbsSendTime(packet->send_time, 1000000), true);
if (bitrate_observer_->updated()) {
// Verify that new estimates only are triggered by an overuse and a
// rate decrease.
@@ -323,7 +322,7 @@ void RemoteBitrateEstimatorTest::InitialBehaviorTestHelper(
clock_.AdvanceTimeMilliseconds(1000);
// Inserting a packet. Still no valid estimate. We need to wait 1 second.
IncomingPacket(kDefaultSsrc, kMtu, clock_.TimeInMilliseconds(), timestamp,
- absolute_send_time);
+ absolute_send_time, true);
bitrate_estimator_->Process();
EXPECT_FALSE(bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_bps));
EXPECT_EQ(0u, ssrcs.size());
@@ -332,7 +331,7 @@ void RemoteBitrateEstimatorTest::InitialBehaviorTestHelper(
// Inserting packets for one second to get a valid estimate.
for (int i = 0; i < kFramerate; ++i) {
IncomingPacket(kDefaultSsrc, kMtu, clock_.TimeInMilliseconds(), timestamp,
- absolute_send_time);
+ absolute_send_time, true);
clock_.AdvanceTimeMilliseconds(1000 / kFramerate);
timestamp += 90 * kFrameIntervalMs;
absolute_send_time = AddAbsSendTime(absolute_send_time,
@@ -360,13 +359,13 @@ void RemoteBitrateEstimatorTest::RateIncreaseReorderingTestHelper(
uint32_t timestamp = 0;
uint32_t absolute_send_time = 0;
IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp,
- absolute_send_time);
+ absolute_send_time, true);
bitrate_estimator_->Process();
EXPECT_FALSE(bitrate_observer_->updated()); // No valid estimate.
// Inserting packets for one second to get a valid estimate.
for (int i = 0; i < kFramerate; ++i) {
IncomingPacket(kDefaultSsrc, kMtu, clock_.TimeInMilliseconds(), timestamp,
- absolute_send_time);
+ absolute_send_time, true);
clock_.AdvanceTimeMilliseconds(kFrameIntervalMs);
timestamp += 90 * kFrameIntervalMs;
absolute_send_time = AddAbsSendTime(absolute_send_time,
@@ -383,11 +382,12 @@ void RemoteBitrateEstimatorTest::RateIncreaseReorderingTestHelper(
absolute_send_time = AddAbsSendTime(absolute_send_time,
2 * kFrameIntervalAbsSendTime);
IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp,
- absolute_send_time);
- IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(),
- timestamp - 90 * kFrameIntervalMs,
- AddAbsSendTime(absolute_send_time,
- -int(kFrameIntervalAbsSendTime)));
+ absolute_send_time, true);
+ IncomingPacket(
+ kDefaultSsrc, 1000, clock_.TimeInMilliseconds(),
+ timestamp - 90 * kFrameIntervalMs,
+ AddAbsSendTime(absolute_send_time, -int(kFrameIntervalAbsSendTime)),
+ true);
}
bitrate_estimator_->Process();
EXPECT_TRUE(bitrate_observer_->updated());
@@ -525,7 +525,7 @@ void RemoteBitrateEstimatorTest::TestTimestampGroupingTestHelper() {
// Initial set of frames to increase the bitrate.
for (int i = 0; i <= 100; ++i) {
IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp,
- absolute_send_time);
+ absolute_send_time, true);
bitrate_estimator_->Process();
clock_.AdvanceTimeMilliseconds(kFrameIntervalMs);
timestamp += 90 * kFrameIntervalMs;
@@ -546,7 +546,7 @@ void RemoteBitrateEstimatorTest::TestTimestampGroupingTestHelper() {
// Insert |kTimestampGroupLength| frames with just 1 timestamp ticks in
// between. Should be treated as part of the same group by the estimator.
IncomingPacket(kDefaultSsrc, 100, clock_.TimeInMilliseconds(), timestamp,
- absolute_send_time);
+ absolute_send_time, true);
clock_.AdvanceTimeMilliseconds(kFrameIntervalMs / kTimestampGroupLength);
timestamp += 1;
absolute_send_time = AddAbsSendTime(absolute_send_time,
@@ -579,7 +579,7 @@ void RemoteBitrateEstimatorTest::TestGetStatsHelper() {
// Inject propagation_time_delta of kFrameIntervalMs.
for (size_t i = 0; i < 3; ++i) {
IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp,
- absolute_send_time);
+ absolute_send_time, true);
timestamp += kFrameIntervalMs;
// Insert a kFrameIntervalMs propagation_time_delta.
clock_.AdvanceTimeMilliseconds(kFrameIntervalMs * 2);
@@ -597,7 +597,7 @@ void RemoteBitrateEstimatorTest::TestGetStatsHelper() {
// should be adjusted to 0.
for (size_t i = 0; i < 3; ++i) {
IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp,
- absolute_send_time);
+ absolute_send_time, true);
timestamp += 10 * kFrameIntervalMs;
clock_.AdvanceTimeMilliseconds(kBurstThresholdMs + 1);
absolute_send_time = AddAbsSendTime(absolute_send_time,
@@ -610,7 +610,7 @@ void RemoteBitrateEstimatorTest::TestGetStatsHelper() {
// limits.
for (size_t i = 0; i < 1001; ++i) {
IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp,
- absolute_send_time);
+ absolute_send_time, true);
timestamp += kFrameIntervalMs;
absolute_send_time = AddAbsSendTime(absolute_send_time,
kFrameIntervalAbsSendTime);
@@ -635,7 +635,7 @@ void RemoteBitrateEstimatorTest::TestWrappingHelper(
for (size_t i = 0; i < 3000; ++i) {
IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp,
- absolute_send_time);
+ absolute_send_time, true);
timestamp += kFrameIntervalMs;
clock_.AdvanceTimeMilliseconds(kFrameIntervalMs);
absolute_send_time = AddAbsSendTime(absolute_send_time,
@@ -652,7 +652,7 @@ void RemoteBitrateEstimatorTest::TestWrappingHelper(
bitrate_estimator_->Process();
for (size_t i = 0; i < 100; ++i) {
IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp,
- absolute_send_time);
+ absolute_send_time, true);
timestamp += kFrameIntervalMs;
clock_.AdvanceTimeMilliseconds(2 * kFrameIntervalMs);
absolute_send_time = AddAbsSendTime(absolute_send_time,

Powered by Google App Engine
This is Rietveld 408576698