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}
This commit is contained in:
philipel
2016-05-09 12:14:29 +02:00
parent a1059874a6
commit ae284089cc
5 changed files with 23 additions and 4 deletions

View File

@ -601,6 +601,7 @@ VCMEncodedFrame* VCMJitterBuffer::ExtractAndSetDecode(uint32_t timestamp) {
// Frame pulled out from jitter buffer, update the jitter estimate. // Frame pulled out from jitter buffer, update the jitter estimate.
const bool retransmitted = (frame->GetNackCount() > 0); const bool retransmitted = (frame->GetNackCount() > 0);
if (retransmitted) { if (retransmitted) {
if (WaitForRetransmissions())
jitter_estimate_.FrameNacked(); jitter_estimate_.FrameNacked();
} else if (frame->Length() > 0) { } else if (frame->Length() > 0) {
// Ignore retransmitted and empty frames. // Ignore retransmitted and empty frames.
@ -958,6 +959,8 @@ void VCMJitterBuffer::UpdateRtt(int64_t rtt_ms) {
jitter_estimate_.UpdateRtt(rtt_ms); jitter_estimate_.UpdateRtt(rtt_ms);
if (nack_module_) if (nack_module_)
nack_module_->UpdateRtt(rtt_ms); nack_module_->UpdateRtt(rtt_ms);
if (!WaitForRetransmissions())
jitter_estimate_.ResetNackCount();
} }
void VCMJitterBuffer::SetNackMode(VCMNackMode mode, void VCMJitterBuffer::SetNackMode(VCMNackMode mode,

View File

@ -45,6 +45,10 @@ enum FilterPacketLossMode {
// common to media optimization and the jitter buffer. // common to media optimization and the jitter buffer.
const int64_t kLowRttNackMs = 20; 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 { struct VCMProtectionParameters {
VCMProtectionParameters() VCMProtectionParameters()
: rtt(0), : rtt(0),

View File

@ -168,7 +168,9 @@ int32_t VideoReceiver::SetVideoProtection(VCMVideoProtection videoProtection,
case kProtectionNackFEC: { case kProtectionNackFEC: {
rtc::CritScope cs(&receive_crit_); rtc::CritScope cs(&receive_crit_);
RTC_DCHECK(enable); RTC_DCHECK(enable);
_receiver.SetNackMode(kNack, media_optimization::kLowRttNackMs, -1); _receiver.SetNackMode(kNack,
media_optimization::kLowRttNackMs,
media_optimization::kMaxRttDelayThreshold);
_receiver.SetDecodeErrorMode(kNoErrors); _receiver.SetDecodeErrorMode(kNoErrors);
break; break;
} }

View File

@ -176,6 +176,10 @@ RtpStreamReceiver::RtpStreamReceiver(
config_.rtp.fec.red_rtx_payload_type, config_.rtp.fec.red_rtx_payload_type,
config_.rtp.fec.red_payload_type); config_.rtp.fec.red_payload_type);
} }
rtp_rtcp_->SetGenericFECStatus(true,
config_.rtp.fec.red_payload_type,
config_.rtp.fec.ulpfec_payload_type);
} }
if (config.rtp.rtcp_xr.receiver_reference_time_report) if (config.rtp.rtcp_xr.receiver_reference_time_report)

View File

@ -54,8 +54,14 @@ VideoStreamDecoder::VideoStreamDecoder(
static const int kDefaultRenderDelayMs = 10; static const int kDefaultRenderDelayMs = 10;
video_receiver_->SetRenderDelay(kDefaultRenderDelayMs); video_receiver_->SetRenderDelay(kDefaultRenderDelayMs);
VCMVideoProtection video_protection = enable_nack ? kProtectionNack VCMVideoProtection video_protection = kProtectionNone;
: kProtectionNone; if (enable_nack) {
if (enable_fec)
video_protection = kProtectionNackFEC;
else
video_protection = kProtectionNack;
}
VCMDecodeErrorMode decode_error_mode = enable_nack ? kNoErrors : kWithErrors; VCMDecodeErrorMode decode_error_mode = enable_nack ? kNoErrors : kWithErrors;
video_receiver_->SetVideoProtection(video_protection, true); video_receiver_->SetVideoProtection(video_protection, true);
video_receiver_->SetDecodeErrorMode(decode_error_mode); video_receiver_->SetDecodeErrorMode(decode_error_mode);