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 <alexnarest@webrtc.org>
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21943}
This commit is contained in:
Henrik Lundin
2018-02-07 15:17:37 +01:00
committed by Commit Bot
parent 4b381afd8e
commit 2cbc20bb56

View File

@ -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],