Reland "Change ReceiveStatistics reaction to large sequence numbers jumps"

This reverts commit 7e0299e2452b021fcd14a8fdb86257459eeacf90.

Reason for revert: audio receive stream fix not to use 0 reordering threshold

Original change's description:
> Revert "Change ReceiveStatistics reaction to large sequence numbers jumps"
> 
> This reverts commit c4f120130f495e9726bf221356642de69125f4a2.
> 
> Reason for revert: breaks downstream tests due to zero max reordering for audio receive channels
> 
> Original change's description:
> > Change ReceiveStatistics reaction to large sequence numbers jumps
> > 
> > Consider stream restart when two sequential packets arrived far from
> > previous packets' sequence numbers.
> > instead of resetting on single one.
> > For packet loss calculation ignore sequence number gap during reset.
> > 
> > Bug: webrtc:9445, b/38179459
> > Change-Id: I0c2717ef8f9ec182b280ae757b5582f56d9afcef
> > Reviewed-on: https://webrtc-review.googlesource.com/c/111962
> > Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> > Reviewed-by: Åsa Persson <asapersson@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#25890}
> 
> TBR=danilchap@webrtc.org,asapersson@webrtc.org
> 
> Change-Id: Icc9f4d86d9f0b07f0fa2f3d443f9a90aa91f5e21
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:9445, b/38179459
> Reviewed-on: https://webrtc-review.googlesource.com/c/113067
> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#25897}

TBR=danilchap@webrtc.org,asapersson@webrtc.org

Change-Id: I8747aa5cb6209b92fafefed077bc19d305d11db6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:9445, b/38179459
Reviewed-on: https://webrtc-review.googlesource.com/c/113263
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25907}
This commit is contained in:
Danil Chapovalov
2018-12-05 14:55:46 +00:00
committed by Commit Bot
parent dc107965bd
commit b438b5a33d
3 changed files with 295 additions and 61 deletions

View File

@ -17,6 +17,8 @@
#include <map>
#include <vector>
#include "absl/types/optional.h"
#include "modules/include/module_common_types_public.h"
#include "rtc_base/criticalsection.h"
#include "rtc_base/rate_statistics.h"
#include "rtc_base/thread_annotations.h"
@ -58,7 +60,18 @@ class StreamStatisticianImpl : public StreamStatistician,
RTC_EXCLUSIVE_LOCKS_REQUIRED(stream_lock_);
void UpdateJitter(const RtpPacketReceived& packet, int64_t receive_time_ms)
RTC_EXCLUSIVE_LOCKS_REQUIRED(stream_lock_);
// Updates StreamStatistician for out of order packets.
// Returns true if packet considered to be out of order.
bool UpdateOutOfOrder(const RtpPacketReceived& packet,
int64_t sequence_number,
int64_t now_ms)
RTC_EXCLUSIVE_LOCKS_REQUIRED(stream_lock_);
// Updates StreamStatistician for incoming packets.
StreamDataCounters UpdateCounters(const RtpPacketReceived& packet);
// Checks if this StreamStatistician received any rtp packets.
bool ReceivedRtpPacket() const RTC_EXCLUSIVE_LOCKS_REQUIRED(stream_lock_) {
return received_seq_max_ >= 0;
}
const uint32_t ssrc_;
Clock* const clock_;
@ -74,9 +87,13 @@ class StreamStatisticianImpl : public StreamStatistician,
int64_t last_receive_time_ms_ RTC_GUARDED_BY(&stream_lock_);
uint32_t last_received_timestamp_ RTC_GUARDED_BY(&stream_lock_);
uint16_t received_seq_first_ RTC_GUARDED_BY(&stream_lock_);
uint16_t received_seq_max_ RTC_GUARDED_BY(&stream_lock_);
uint16_t received_seq_wraps_ RTC_GUARDED_BY(&stream_lock_);
SequenceNumberUnwrapper seq_unwrapper_ RTC_GUARDED_BY(&stream_lock_);
int64_t received_seq_first_ RTC_GUARDED_BY(&stream_lock_);
int64_t received_seq_max_ RTC_GUARDED_BY(&stream_lock_);
// Assume that the other side restarted when there are two sequential packets
// with large jump from received_seq_max_.
absl::optional<uint16_t> received_seq_out_of_order_
RTC_GUARDED_BY(&stream_lock_);
// Current counter values.
StreamDataCounters receive_counters_ RTC_GUARDED_BY(&stream_lock_);
@ -84,7 +101,7 @@ class StreamStatisticianImpl : public StreamStatistician,
// Counter values when we sent the last report.
uint32_t last_report_inorder_packets_ RTC_GUARDED_BY(&stream_lock_);
uint32_t last_report_old_packets_ RTC_GUARDED_BY(&stream_lock_);
uint16_t last_report_seq_max_ RTC_GUARDED_BY(&stream_lock_);
int64_t last_report_seq_max_ RTC_GUARDED_BY(&stream_lock_);
RtcpStatistics last_reported_statistics_ RTC_GUARDED_BY(&stream_lock_);
// stream_lock_ shouldn't be held when calling callbacks.