Improve probing by ignoring small packets which otherwise break the mechanism.

These small packets are common for H.264 where the first packet of an IDR
contains the parameter sets.

BUG=4806

Review URL: https://codereview.webrtc.org/1221943002

Cr-Commit-Position: refs/heads/master@{#9639}
This commit is contained in:
stefan
2015-07-27 03:13:32 -07:00
committed by Commit bot
parent b28678ce70
commit fe0c90501b
4 changed files with 44 additions and 3 deletions

View File

@ -16,6 +16,7 @@
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread_annotations.h"
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
#include "webrtc/modules/pacing/bitrate_prober.h"
#include "webrtc/system_wrappers/interface/clock.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/logging.h"
@ -268,7 +269,10 @@ void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo(
uint32_t ts_delta = 0;
int64_t t_delta = 0;
int size_delta = 0;
// For now only try to detect probes while we don't have a valid estimate.
// For now only try to detect probes while we don't have a valid estimate, and
// make sure the packet was paced. We currently assume that only packets
// larger than 200 bytes are paced by the sender.
was_paced = was_paced && payload_size > BitrateProber::kMinProbePacketSize;
if (was_paced &&
(!remote_rate_.ValidEstimate() ||
now_ms - first_packet_time_ms_ < kInitialProbingIntervalMs)) {

View File

@ -38,7 +38,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, RateIncreaseReordering) {
}
TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, RateIncreaseRtpTimestamps) {
RateIncreaseRtpTimestampsTestHelper(1089);
RateIncreaseRtpTimestampsTestHelper(1240);
}
TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, CapacityDropOneStream) {
@ -259,4 +259,36 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest,
EXPECT_TRUE(bitrate_observer_->updated());
EXPECT_NEAR(bitrate_observer_->latest_bitrate(), 4000000u, 10000);
}
TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, ProbingIgnoresSmallPackets) {
const int kProbeLength = 5;
int64_t now_ms = clock_.TimeInMilliseconds();
// Probing with 200 bytes every 10 ms, should be ignored by the probe
// detection.
for (int i = 0; i < kProbeLength; ++i) {
clock_.AdvanceTimeMilliseconds(10);
now_ms = clock_.TimeInMilliseconds();
IncomingPacket(0, 200, now_ms, 90 * now_ms, AbsSendTime(now_ms, 1000),
true);
}
EXPECT_EQ(0, bitrate_estimator_->Process());
EXPECT_FALSE(bitrate_observer_->updated());
// Followed by a probe with 1000 bytes packets, should be detected as a
// probe.
for (int i = 0; i < kProbeLength; ++i) {
clock_.AdvanceTimeMilliseconds(10);
now_ms = clock_.TimeInMilliseconds();
IncomingPacket(0, 1000, now_ms, 90 * now_ms, AbsSendTime(now_ms, 1000),
true);
}
// Wait long enough so that we can call Process again.
clock_.AdvanceTimeMilliseconds(1000);
EXPECT_EQ(0, bitrate_estimator_->Process());
EXPECT_TRUE(bitrate_observer_->updated());
EXPECT_NEAR(bitrate_observer_->latest_bitrate(), 800000u, 10000);
}
} // namespace webrtc