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

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

Issue 2029593002: Update RateStatistics to handle too-little-data case. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comment Created 4 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 f04d9e68c09a53527085cc6ef0f32ac769bad704..3cff49882d88e4886e55401eaddcc27ad2e42375 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
@@ -18,6 +18,9 @@ namespace webrtc {
const size_t kMtu = 1200;
const uint32_t kAcceptedBitrateErrorBps = 50000;
+// Number of packets needed before we have a valid estimate.
+const int kNumInitialPackets = 2;
+
namespace testing {
void TestBitrateObserver::OnReceiveBitrateChanged(
@@ -317,16 +320,16 @@ void RemoteBitrateEstimatorTest::InitialBehaviorTestHelper(
EXPECT_FALSE(bitrate_observer_->updated());
bitrate_observer_->Reset();
clock_.AdvanceTimeMilliseconds(1000);
- // Inserting a packet. Still no valid estimate. We need to wait 5 seconds.
- IncomingPacket(kDefaultSsrc, kMtu, clock_.TimeInMilliseconds(), timestamp,
- absolute_send_time, true);
- bitrate_estimator_->Process();
- EXPECT_FALSE(bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_bps));
- EXPECT_EQ(0u, ssrcs.size());
- EXPECT_FALSE(bitrate_observer_->updated());
- bitrate_observer_->Reset();
// Inserting packets for 5 seconds to get a valid estimate.
- for (int i = 0; i < 5 * kFramerate + 1; ++i) {
+ for (int i = 0; i < 5 * kFramerate + 1 + kNumInitialPackets; ++i) {
+ if (i == kNumInitialPackets) {
+ bitrate_estimator_->Process();
+ EXPECT_FALSE(bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_bps));
+ EXPECT_EQ(0u, ssrcs.size());
+ EXPECT_FALSE(bitrate_observer_->updated());
+ bitrate_observer_->Reset();
+ }
+
IncomingPacket(kDefaultSsrc, kMtu, clock_.TimeInMilliseconds(), timestamp,
absolute_send_time, true);
clock_.AdvanceTimeMilliseconds(1000 / kFramerate);
@@ -355,12 +358,16 @@ void RemoteBitrateEstimatorTest::RateIncreaseReorderingTestHelper(
const uint32_t kFrameIntervalAbsSendTime = AbsSendTime(1, kFramerate);
uint32_t timestamp = 0;
uint32_t absolute_send_time = 0;
- IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp,
- 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 < 5 * kFramerate + 1; ++i) {
+ // Inserting packets for five seconds to get a valid estimate.
+ for (int i = 0; i < 5 * kFramerate + 1 + kNumInitialPackets; ++i) {
+ // TODO(sprang): Remove this hack once the single stream estimator is gone,
+ // as it doesn't do anything in Process().
+ if (i == kNumInitialPackets) {
+ // Process after we have enough frames to get a valid input rate estimate.
+ bitrate_estimator_->Process();
+ EXPECT_FALSE(bitrate_observer_->updated()); // No valid estimate.
+ }
+
IncomingPacket(kDefaultSsrc, kMtu, clock_.TimeInMilliseconds(), timestamp,
absolute_send_time, true);
clock_.AdvanceTimeMilliseconds(kFrameIntervalMs);

Powered by Google App Engine
This is Rietveld 408576698