Fixes for the neteq_test clock.

The problem occurs when more than one call is made to the method RunToNextGetAudio. Except for the first call to that method, the clock was not properly updated on the first iteration of the inner loop in RunToNextGetAudio.

Pair: lionelk@webrtc.org

Bug: webrtc:14735
Change-Id: If6fb5c2c700b0f715f626fedf95672a56b04ab12
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/285942
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38843}
This commit is contained in:
Jesús de Vicente Peña 2022-12-08 10:51:22 +01:00 committed by WebRTC LUCI CQ
parent 9629ca2c98
commit 01cac31d58
2 changed files with 4 additions and 4 deletions

View File

@ -67,11 +67,11 @@ NetEqTest::NetEqTest(const NetEq::Config& config,
std::unique_ptr<NetEqInput> input,
std::unique_ptr<AudioSink> output,
Callbacks callbacks)
: clock_(0),
: input_(std::move(input)),
clock_(Timestamp::Millis(input_->NextEventTime().value_or(0))),
neteq_(neteq_factory
? neteq_factory->CreateNetEq(config, decoder_factory, &clock_)
: CreateNetEq(config, &clock_, decoder_factory)),
input_(std::move(input)),
output_(std::move(output)),
callbacks_(callbacks),
sample_rate_hz_(config.sample_rate_hz),
@ -99,7 +99,7 @@ int64_t NetEqTest::Run() {
NetEqTest::SimulationStepResult NetEqTest::RunToNextGetAudio() {
SimulationStepResult result;
const int64_t start_time_ms = *input_->NextEventTime();
int64_t time_now_ms = start_time_ms;
int64_t time_now_ms = clock_.CurrentTime().ms();
current_state_.packet_iat_ms.clear();
while (!input_->ended()) {

View File

@ -109,11 +109,11 @@ class NetEqTest : public NetEqSimulator {
private:
void RegisterDecoders(const DecoderMap& codecs);
std::unique_ptr<NetEqInput> input_;
SimulatedClock clock_;
absl::optional<Action> next_action_;
absl::optional<int> last_packet_time_ms_;
std::unique_ptr<NetEq> neteq_;
std::unique_ptr<NetEqInput> input_;
std::unique_ptr<AudioSink> output_;
Callbacks callbacks_;
int sample_rate_hz_;