Don't update the jitter estimate with frames containing retransmitted packets.

BUG=chromium:682636

Review-Url: https://codereview.webrtc.org/2645343002
Cr-Commit-Position: refs/heads/master@{#16273}
This commit is contained in:
philipel 2017-01-25 08:56:23 -08:00 committed by Commit bot
parent 090c9405cc
commit e0754305aa
3 changed files with 22 additions and 10 deletions

View File

@ -118,18 +118,20 @@ FrameBuffer::ReturnReason FrameBuffer::NextFrame(
rtc::CritScope lock(&crit_);
if (next_frame_it != frames_.end()) {
std::unique_ptr<FrameObject> frame = std::move(next_frame_it->second.frame);
int64_t received_time = frame->ReceivedTime();
uint32_t timestamp = frame->timestamp;
int64_t frame_delay;
if (inter_frame_delay_.CalculateDelay(timestamp, &frame_delay,
received_time)) {
jitter_estimator_->UpdateEstimate(frame_delay, frame->size());
if (!frame->delayed_by_retransmission()) {
int64_t frame_delay;
if (inter_frame_delay_.CalculateDelay(frame->timestamp, &frame_delay,
frame->ReceivedTime())) {
jitter_estimator_->UpdateEstimate(frame_delay, frame->size());
}
float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0;
timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult));
timing_->UpdateCurrentDelay(frame->RenderTime(),
clock_->TimeInMilliseconds());
}
float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0;
timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult));
timing_->UpdateCurrentDelay(frame->RenderTime(),
clock_->TimeInMilliseconds());
UpdateJitterDelay();

View File

@ -121,6 +121,10 @@ int64_t RtpFrameObject::RenderTime() const {
return _renderTimeMs;
}
bool RtpFrameObject::delayed_by_retransmission() const {
return times_nacked() > 0;
}
rtc::Optional<RTPVideoTypeHeader> RtpFrameObject::GetCodecHeader() const {
rtc::CritScope lock(&packet_buffer_->crit_);
VCMPacket* packet = packet_buffer_->GetPacket(first_seq_num_);

View File

@ -37,6 +37,11 @@ class FrameObject : public webrtc::VCMEncodedFrame {
// When this frame should be rendered.
virtual int64_t RenderTime() const = 0;
// This information is currently needed by the timing calculation class.
// TODO(philipel): Remove this function when a new timing class has
// been implemented.
virtual bool delayed_by_retransmission() const { return 0; }
size_t size() { return _length; }
// The tuple (|picture_id|, |spatial_layer|) uniquely identifies a frame
@ -72,6 +77,7 @@ class RtpFrameObject : public FrameObject {
uint32_t Timestamp() const override;
int64_t ReceivedTime() const override;
int64_t RenderTime() const override;
bool delayed_by_retransmission() const override;
rtc::Optional<RTPVideoTypeHeader> GetCodecHeader() const;
private: