Jitter delay now depend on protection mode (FEC/NACK).
R=stefan@webrtc.org
Review URL: https://codereview.webrtc.org/1942683003 .
Cr-Commit-Position: refs/heads/master@{#12661}
diff --git a/webrtc/modules/video_coding/jitter_buffer.cc b/webrtc/modules/video_coding/jitter_buffer.cc
index b70f44f..9c50a94 100644
--- a/webrtc/modules/video_coding/jitter_buffer.cc
+++ b/webrtc/modules/video_coding/jitter_buffer.cc
@@ -601,7 +601,8 @@
// Frame pulled out from jitter buffer, update the jitter estimate.
const bool retransmitted = (frame->GetNackCount() > 0);
if (retransmitted) {
- jitter_estimate_.FrameNacked();
+ if (WaitForRetransmissions())
+ jitter_estimate_.FrameNacked();
} else if (frame->Length() > 0) {
// Ignore retransmitted and empty frames.
if (waiting_for_completion_.latest_packet_time >= 0) {
@@ -958,6 +959,8 @@
jitter_estimate_.UpdateRtt(rtt_ms);
if (nack_module_)
nack_module_->UpdateRtt(rtt_ms);
+ if (!WaitForRetransmissions())
+ jitter_estimate_.ResetNackCount();
}
void VCMJitterBuffer::SetNackMode(VCMNackMode mode,
diff --git a/webrtc/modules/video_coding/media_opt_util.h b/webrtc/modules/video_coding/media_opt_util.h
index 1501f72..a8455cb 100644
--- a/webrtc/modules/video_coding/media_opt_util.h
+++ b/webrtc/modules/video_coding/media_opt_util.h
@@ -45,6 +45,10 @@
// common to media optimization and the jitter buffer.
const int64_t kLowRttNackMs = 20;
+// If the RTT is higher than this an extra RTT wont be added to to the jitter
+// buffer delay.
+const int kMaxRttDelayThreshold = 500;
+
struct VCMProtectionParameters {
VCMProtectionParameters()
: rtt(0),
diff --git a/webrtc/modules/video_coding/video_receiver.cc b/webrtc/modules/video_coding/video_receiver.cc
index 721c35d..a832e21 100644
--- a/webrtc/modules/video_coding/video_receiver.cc
+++ b/webrtc/modules/video_coding/video_receiver.cc
@@ -168,7 +168,9 @@
case kProtectionNackFEC: {
rtc::CritScope cs(&receive_crit_);
RTC_DCHECK(enable);
- _receiver.SetNackMode(kNack, media_optimization::kLowRttNackMs, -1);
+ _receiver.SetNackMode(kNack,
+ media_optimization::kLowRttNackMs,
+ media_optimization::kMaxRttDelayThreshold);
_receiver.SetDecodeErrorMode(kNoErrors);
break;
}