Reland "[Unwrap] Migrate ReceiveStatisticsImpl to use RtpSequenceNumberUnwrapper"

This is a reland of commit 6762fbd9882c6b0436b4bcd0b04f070312c52981

Can reland now that upstream tests are fixed.

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 <eshr@webrtc.org>
> Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#39046}

Bug: webrtc:13982
Change-Id: I1cb4faf5c6348be00e15d9f499a957a508199df6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/290800
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39067}
This commit is contained in:
Evan Shrubsole 2023-01-09 14:34:34 +00:00 committed by WebRTC LUCI CQ
parent e137c4592e
commit 7b4c8adb75
2 changed files with 7 additions and 6 deletions

View File

@ -21,7 +21,6 @@
#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"
@ -117,8 +116,9 @@ void StreamStatisticianImpl::UpdateCounters(const RtpPacketReceived& packet) {
receive_counters_.transmitted.AddPacket(packet);
--cumulative_loss_;
int64_t sequence_number =
seq_unwrapper_.UnwrapWithoutUpdate(packet.SequenceNumber());
// 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());
if (!ReceivedRtpPacket()) {
received_seq_first_ = sequence_number;
@ -131,7 +131,8 @@ void StreamStatisticianImpl::UpdateCounters(const RtpPacketReceived& packet) {
// In order packet.
cumulative_loss_ += sequence_number - received_seq_max_;
received_seq_max_ = sequence_number;
seq_unwrapper_.UpdateLast(sequence_number);
// Update the internal state of `seq_unwrapper_`.
seq_unwrapper_.Unwrap(packet.SequenceNumber());
// If new time stamp and more than one in-order packet received, calculate
// new jitter statistics.

View File

@ -18,10 +18,10 @@
#include <vector>
#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_;
SequenceNumberUnwrapper seq_unwrapper_;
RtpSequenceNumberUnwrapper seq_unwrapper_;
int64_t received_seq_first_;
int64_t received_seq_max_;
// Assume that the other side restarted when there are two sequential packets