From 876a3dc88ac44768cab57dd6f23c8758bfb6b5bd Mon Sep 17 00:00:00 2001 From: Ivo Creusen Date: Tue, 18 Aug 2020 17:08:18 +0200 Subject: [PATCH] Fix for NetEq simulations containing large gaps and multiple SSRCs. This CL fixes 2 issues that affect NetEq simulations. - When using event logs with multiple SSRCs, it does not make sense to use more than a single SSRC. If the user does not provide an SSRC filter, we should use the first SSRC we find and no others. - It is possible for event logs to have a gap in the middle, and sometimes we don't store/mark the gap properly. If is possible to detect gaps by looking at the wallclock time delta between getAudio events. These should be 10 ms nominally, so values greater than 1000 should never happen and indicate an error. Bug: webrtc:11855 Change-Id: Idc3b8a7902be4159da48b063ef5c5c82fd484071 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181940 Reviewed-by: Jakob Ivarsson Commit-Queue: Ivo Creusen Cr-Commit-Position: refs/heads/master@{#31960} --- modules/audio_coding/neteq/tools/neteq_test.cc | 8 ++++++-- modules/audio_coding/neteq/tools/rtc_event_log_source.cc | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/audio_coding/neteq/tools/neteq_test.cc b/modules/audio_coding/neteq/tools/neteq_test.cc index a263a73721..7e2093de0e 100644 --- a/modules/audio_coding/neteq/tools/neteq_test.cc +++ b/modules/audio_coding/neteq/tools/neteq_test.cc @@ -267,8 +267,12 @@ NetEqTest::SimulationStepResult NetEqTest::RunToNextGetAudio() { prev_lifetime_stats_ = lifetime_stats; const bool no_more_packets_to_decode = !input_->NextPacketTime() && !operations_state.next_packet_available; - result.is_simulation_finished = - no_more_packets_to_decode || input_->ended(); + // End the simulation if the gap is too large. This indicates an issue + // with the event log file. + const bool simulation_step_too_large = result.simulation_step_ms > 1000; + result.is_simulation_finished = simulation_step_too_large || + no_more_packets_to_decode || + input_->ended(); prev_ops_state_ = operations_state; return result; } diff --git a/modules/audio_coding/neteq/tools/rtc_event_log_source.cc b/modules/audio_coding/neteq/tools/rtc_event_log_source.cc index 789cc52f76..4719922b98 100644 --- a/modules/audio_coding/neteq/tools/rtc_event_log_source.cc +++ b/modules/audio_coding/neteq/tools/rtc_event_log_source.cc @@ -138,6 +138,11 @@ bool RtcEventLogSource::Initialize(const ParsedRtcEventLog& parsed_log, continue; } event_processor.AddEvents(rtp_packets.incoming_packets, handle_rtp_packet); + // If no SSRC filter has been set, use the first SSRC only. The simulator + // does not work properly with interleaved packets from multiple SSRCs. + if (!ssrc_filter.has_value()) { + ssrc_filter = rtp_packets.ssrc; + } } for (const auto& audio_playouts : parsed_log.audio_playout_events()) {