OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 int64_t frame_delay; | 140 int64_t frame_delay; |
141 | 141 |
142 if (inter_frame_delay_.CalculateDelay(frame->timestamp, &frame_delay, | 142 if (inter_frame_delay_.CalculateDelay(frame->timestamp, &frame_delay, |
143 frame->ReceivedTime())) { | 143 frame->ReceivedTime())) { |
144 jitter_estimator_->UpdateEstimate(frame_delay, frame->size()); | 144 jitter_estimator_->UpdateEstimate(frame_delay, frame->size()); |
145 } | 145 } |
146 | 146 |
147 float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0; | 147 float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0; |
148 timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult)); | 148 timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult)); |
149 timing_->UpdateCurrentDelay(frame->RenderTime(), now_ms); | 149 timing_->UpdateCurrentDelay(frame->RenderTime(), now_ms); |
| 150 } else { |
| 151 jitter_estimator_->FrameNacked(); |
150 } | 152 } |
151 | 153 |
152 // Gracefully handle bad RTP timestamps and render time issues. | 154 // Gracefully handle bad RTP timestamps and render time issues. |
153 if (HasBadRenderTiming(*frame, now_ms)) { | 155 if (HasBadRenderTiming(*frame, now_ms)) { |
154 jitter_estimator_->Reset(); | 156 jitter_estimator_->Reset(); |
155 timing_->Reset(); | 157 timing_->Reset(); |
156 frame->SetRenderTime(timing_->RenderTimeMs(frame->timestamp, now_ms)); | 158 frame->SetRenderTime(timing_->RenderTimeMs(frame->timestamp, now_ms)); |
157 } | 159 } |
158 | 160 |
159 UpdateJitterDelay(); | 161 UpdateJitterDelay(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 stopped_ = false; | 242 stopped_ = false; |
241 } | 243 } |
242 | 244 |
243 void FrameBuffer::Stop() { | 245 void FrameBuffer::Stop() { |
244 TRACE_EVENT0("webrtc", "FrameBuffer::Stop"); | 246 TRACE_EVENT0("webrtc", "FrameBuffer::Stop"); |
245 rtc::CritScope lock(&crit_); | 247 rtc::CritScope lock(&crit_); |
246 stopped_ = true; | 248 stopped_ = true; |
247 new_continuous_frame_event_.Set(); | 249 new_continuous_frame_event_.Set(); |
248 } | 250 } |
249 | 251 |
| 252 void FrameBuffer::UpdateRtt(int64_t rtt_ms) { |
| 253 rtc::CritScope lock(&crit_); |
| 254 jitter_estimator_->UpdateRtt(rtt_ms); |
| 255 } |
| 256 |
250 bool FrameBuffer::ValidReferences(const FrameObject& frame) const { | 257 bool FrameBuffer::ValidReferences(const FrameObject& frame) const { |
251 if (frame.picture_id < 0) | 258 if (frame.picture_id < 0) |
252 return false; | 259 return false; |
253 | 260 |
254 for (size_t i = 0; i < frame.num_references; ++i) { | 261 for (size_t i = 0; i < frame.num_references; ++i) { |
255 if (frame.references[i] < 0 || frame.references[i] >= frame.picture_id) | 262 if (frame.references[i] < 0 || frame.references[i] >= frame.picture_id) |
256 return false; | 263 return false; |
257 | 264 |
258 for (size_t j = i + 1; j < frame.num_references; ++j) { | 265 for (size_t j = i + 1; j < frame.num_references; ++j) { |
259 if (frame.references[i] == frame.references[j]) | 266 if (frame.references[i] == frame.references[j]) |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 frames_.clear(); | 571 frames_.clear(); |
565 last_decoded_frame_it_ = frames_.end(); | 572 last_decoded_frame_it_ = frames_.end(); |
566 last_continuous_frame_it_ = frames_.end(); | 573 last_continuous_frame_it_ = frames_.end(); |
567 next_frame_it_ = frames_.end(); | 574 next_frame_it_ = frames_.end(); |
568 num_frames_history_ = 0; | 575 num_frames_history_ = 0; |
569 num_frames_buffered_ = 0; | 576 num_frames_buffered_ = 0; |
570 } | 577 } |
571 | 578 |
572 } // namespace video_coding | 579 } // namespace video_coding |
573 } // namespace webrtc | 580 } // namespace webrtc |
OLD | NEW |