From 2cbc20bb5628d4699a84c343041ef9e2b1b6fd05 Mon Sep 17 00:00:00 2001 From: Henrik Lundin Date: Wed, 7 Feb 2018 15:17:37 +0100 Subject: [PATCH] NetEq quality tests: avoid default preloading of the buffer Before this change, the test used to preload the buffer with 10 packets before starting to pull out audio. With this change, the preloading is determined by a new flag (--preload_packets) which defaults to 0. This affects all tests derived from NetEqQualityTest, i.e., all binaries called neteq_*_quality_test. Bug: none Change-Id: I920845b968a81ea9972ce8a8e646df29aff200ba Reviewed-on: https://webrtc-review.googlesource.com/49261 Reviewed-by: Alex Narest Commit-Queue: Henrik Lundin Cr-Commit-Position: refs/heads/master@{#21943} --- modules/audio_coding/neteq/tools/neteq_quality_test.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/audio_coding/neteq/tools/neteq_quality_test.cc b/modules/audio_coding/neteq/tools/neteq_quality_test.cc index 7df46ff4f3..af5328e76d 100644 --- a/modules/audio_coding/neteq/tools/neteq_quality_test.cc +++ b/modules/audio_coding/neteq/tools/neteq_quality_test.cc @@ -70,6 +70,8 @@ DEFINE_int(burst_length, 30, DEFINE_float(drift_factor, 0.0, "Time drift factor."); +DEFINE_int(preload_packets, 0, "Preload the buffer with this many packets."); + // ProbTrans00Solver() is to calculate the transition probability from no-loss // state to itself in a modified Gilbert Elliot packet loss model. The result is // to achieve the target packet loss rate |loss_rate|, when a packet is not @@ -165,6 +167,9 @@ NetEqQualityTest::NetEqQualityTest(int block_duration_ms, RTC_CHECK_GT(FLAG_drift_factor, -0.1) << "Invalid drift factor, should be greater than -0.1."; + RTC_CHECK_GE(FLAG_preload_packets, 0) + << "Invalid number of packets to preload; must be non-negative."; + const std::string out_filename = FLAG_out_filename; const std::string log_filename = out_filename + ".log"; log_file_.open(log_filename.c_str(), std::ofstream::out); @@ -352,8 +357,9 @@ void NetEqQualityTest::Simulate() { int audio_size_samples; while (decoded_time_ms_ < FLAG_runtime_ms) { - // Assume 10 packets in packets buffer. - while (decodable_time_ms_ - 10 * block_duration_ms_ < decoded_time_ms_) { + // Preload the buffer if needed. + while (decodable_time_ms_ - FLAG_preload_packets * block_duration_ms_ < + decoded_time_ms_) { ASSERT_TRUE(in_file_->Read(in_size_samples_ * channels_, &in_data_[0])); payload_.Clear(); payload_size_bytes_ = EncodeBlock(&in_data_[0],