From c4991048b299e85dbb1513c24663c157cfd0ab6e Mon Sep 17 00:00:00 2001 From: Jeremy Leconte Date: Tue, 10 Jan 2023 11:14:03 +0000 Subject: [PATCH] Revert "[Unwrap] Migrate ReceiveStatisticsImpl to use RtpSequenceNumberUnwrapper" This reverts commit 6762fbd9882c6b0436b4bcd0b04f070312c52981. Reason for revert: attempt to fix some broken tests. Original change's description: > [Unwrap] Migrate ReceiveStatisticsImpl to use RtpSequenceNumberUnwrapper > > Bug: webrtc:13982 > Change-Id: Ic971371d4295e87380a77ef6aa7986a83d86f615 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/288962 > Commit-Queue: Evan Shrubsole > Auto-Submit: Evan Shrubsole > Reviewed-by: Danil Chapovalov > Cr-Commit-Position: refs/heads/main@{#39046} Bug: webrtc:13982 Change-Id: Iad8dcacdce299b9671d6215bf90b0077da3bdf7a No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/290760 Bot-Commit: rubber-stamper@appspot.gserviceaccount.com Reviewed-by: Jeremy Leconte Owners-Override: Jeremy Leconte Commit-Queue: Jeremy Leconte Reviewed-by: Jeremy Leconte Cr-Commit-Position: refs/heads/main@{#39054} --- modules/rtp_rtcp/source/receive_statistics_impl.cc | 9 ++++----- modules/rtp_rtcp/source/receive_statistics_impl.h | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/rtp_rtcp/source/receive_statistics_impl.cc b/modules/rtp_rtcp/source/receive_statistics_impl.cc index 1dc756d876..deae14e8c5 100644 --- a/modules/rtp_rtcp/source/receive_statistics_impl.cc +++ b/modules/rtp_rtcp/source/receive_statistics_impl.cc @@ -21,6 +21,7 @@ #include "modules/rtp_rtcp/source/rtcp_packet/report_block.h" #include "modules/rtp_rtcp/source/rtp_packet_received.h" #include "modules/rtp_rtcp/source/rtp_rtcp_config.h" +#include "modules/rtp_rtcp/source/time_util.h" #include "rtc_base/logging.h" #include "rtc_base/time_utils.h" #include "system_wrappers/include/clock.h" @@ -116,9 +117,8 @@ void StreamStatisticianImpl::UpdateCounters(const RtpPacketReceived& packet) { receive_counters_.transmitted.AddPacket(packet); --cumulative_loss_; - // Use PeekUnwrap and later update the state to avoid updating the state for - // out of order packets. - int64_t sequence_number = seq_unwrapper_.PeekUnwrap(packet.SequenceNumber()); + int64_t sequence_number = + seq_unwrapper_.UnwrapWithoutUpdate(packet.SequenceNumber()); if (!ReceivedRtpPacket()) { received_seq_first_ = sequence_number; @@ -131,8 +131,7 @@ void StreamStatisticianImpl::UpdateCounters(const RtpPacketReceived& packet) { // In order packet. cumulative_loss_ += sequence_number - received_seq_max_; received_seq_max_ = sequence_number; - // Update the internal state of `seq_unwrapper_`. - seq_unwrapper_.Unwrap(packet.SequenceNumber()); + seq_unwrapper_.UpdateLast(sequence_number); // If new time stamp and more than one in-order packet received, calculate // new jitter statistics. diff --git a/modules/rtp_rtcp/source/receive_statistics_impl.h b/modules/rtp_rtcp/source/receive_statistics_impl.h index 11853b3244..4aac20a74b 100644 --- a/modules/rtp_rtcp/source/receive_statistics_impl.h +++ b/modules/rtp_rtcp/source/receive_statistics_impl.h @@ -18,10 +18,10 @@ #include #include "absl/types/optional.h" +#include "modules/include/module_common_types_public.h" #include "modules/rtp_rtcp/include/receive_statistics.h" #include "modules/rtp_rtcp/source/rtcp_packet/report_block.h" #include "rtc_base/containers/flat_map.h" -#include "rtc_base/numerics/sequence_number_unwrapper.h" #include "rtc_base/rate_statistics.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/thread_annotations.h" @@ -96,7 +96,7 @@ class StreamStatisticianImpl : public StreamStatisticianImplInterface { int64_t last_receive_time_ms_; uint32_t last_received_timestamp_; - RtpSequenceNumberUnwrapper seq_unwrapper_; + SequenceNumberUnwrapper seq_unwrapper_; int64_t received_seq_first_; int64_t received_seq_max_; // Assume that the other side restarted when there are two sequential packets