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