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

Unified Diff: webrtc/modules/audio_coding/neteq/neteq_unittest.cc

Issue 1296633002: NetEq/ACM: Refactor how packet waiting times are calculated (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebasing Created 5 years, 4 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/audio_coding/neteq/neteq_unittest.cc
diff --git a/webrtc/modules/audio_coding/neteq/neteq_unittest.cc b/webrtc/modules/audio_coding/neteq/neteq_unittest.cc
index 03fde538898ce8236097a73054de4dee58278787..0c430247996557d3623595478acfdce3bcf36573 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_unittest.cc
@@ -507,46 +507,23 @@ TEST_F(NetEqDecodingTestFaxMode, TestFrameWaitingTimeStatistics) {
ASSERT_EQ(kBlockSize16kHz, out_len);
}
- std::vector<int> waiting_times;
- neteq_->WaitingTimes(&waiting_times);
- EXPECT_EQ(num_frames, waiting_times.size());
+ NetEqNetworkStatistics stats;
+ EXPECT_EQ(0, neteq_->NetworkStatistics(&stats));
// Since all frames are dumped into NetEQ at once, but pulled out with 10 ms
// spacing (per definition), we expect the delay to increase with 10 ms for
- // each packet.
- for (size_t i = 0; i < waiting_times.size(); ++i) {
- EXPECT_EQ(static_cast<int>(i + 1) * 10, waiting_times[i]);
- }
+ // each packet. Thus, we are calculating the statistics for a series from 10
+ // to 300, in steps of 10 ms.
+ EXPECT_EQ(155, stats.mean_waiting_time_ms);
+ EXPECT_EQ(155, stats.median_waiting_time_ms);
+ EXPECT_EQ(10, stats.min_waiting_time_ms);
+ EXPECT_EQ(300, stats.max_waiting_time_ms);
// Check statistics again and make sure it's been reset.
- neteq_->WaitingTimes(&waiting_times);
- int len = waiting_times.size();
- EXPECT_EQ(0, len);
-
- // Process > 100 frames, and make sure that that we get statistics
- // only for 100 frames. Note the new SSRC, causing NetEQ to reset.
- num_frames = 110;
- for (size_t i = 0; i < num_frames; ++i) {
- uint16_t payload[kSamples] = {0};
- WebRtcRTPHeader rtp_info;
- rtp_info.header.sequenceNumber = i;
- rtp_info.header.timestamp = i * kSamples;
- rtp_info.header.ssrc = 0x1235; // Just an arbitrary SSRC.
- rtp_info.header.payloadType = 94; // PCM16b WB codec.
- rtp_info.header.markerBit = 0;
- ASSERT_EQ(0, neteq_->InsertPacket(
- rtp_info,
- reinterpret_cast<uint8_t*>(payload),
- kPayloadBytes, 0));
- size_t out_len;
- int num_channels;
- NetEqOutputType type;
- ASSERT_EQ(0, neteq_->GetAudio(kMaxBlockSize, out_data_, &out_len,
- &num_channels, &type));
- ASSERT_EQ(kBlockSize16kHz, out_len);
- }
-
- neteq_->WaitingTimes(&waiting_times);
- EXPECT_EQ(100u, waiting_times.size());
+ EXPECT_EQ(0, neteq_->NetworkStatistics(&stats));
+ EXPECT_EQ(-1, stats.mean_waiting_time_ms);
+ EXPECT_EQ(-1, stats.median_waiting_time_ms);
+ EXPECT_EQ(-1, stats.min_waiting_time_ms);
+ EXPECT_EQ(-1, stats.max_waiting_time_ms);
}
TEST_F(NetEqDecodingTest, TestAverageInterArrivalTimeNegative) {

Powered by Google App Engine
This is Rietveld 408576698