| 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(); | |
| 152 } | 150 } |
| 153 | 151 |
| 154 // Gracefully handle bad RTP timestamps and render time issues. | 152 // Gracefully handle bad RTP timestamps and render time issues. |
| 155 if (HasBadRenderTiming(*frame, now_ms)) { | 153 if (HasBadRenderTiming(*frame, now_ms)) { |
| 156 jitter_estimator_->Reset(); | 154 jitter_estimator_->Reset(); |
| 157 timing_->Reset(); | 155 timing_->Reset(); |
| 158 frame->SetRenderTime(timing_->RenderTimeMs(frame->timestamp, now_ms)); | 156 frame->SetRenderTime(timing_->RenderTimeMs(frame->timestamp, now_ms)); |
| 159 } | 157 } |
| 160 | 158 |
| 161 UpdateJitterDelay(); | 159 UpdateJitterDelay(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 stopped_ = false; | 240 stopped_ = false; |
| 243 } | 241 } |
| 244 | 242 |
| 245 void FrameBuffer::Stop() { | 243 void FrameBuffer::Stop() { |
| 246 TRACE_EVENT0("webrtc", "FrameBuffer::Stop"); | 244 TRACE_EVENT0("webrtc", "FrameBuffer::Stop"); |
| 247 rtc::CritScope lock(&crit_); | 245 rtc::CritScope lock(&crit_); |
| 248 stopped_ = true; | 246 stopped_ = true; |
| 249 new_continuous_frame_event_.Set(); | 247 new_continuous_frame_event_.Set(); |
| 250 } | 248 } |
| 251 | 249 |
| 252 void FrameBuffer::UpdateRtt(int64_t rtt_ms) { | |
| 253 rtc::CritScope lock(&crit_); | |
| 254 jitter_estimator_->UpdateRtt(rtt_ms); | |
| 255 } | |
| 256 | |
| 257 bool FrameBuffer::ValidReferences(const FrameObject& frame) const { | 250 bool FrameBuffer::ValidReferences(const FrameObject& frame) const { |
| 258 for (size_t i = 0; i < frame.num_references; ++i) { | 251 for (size_t i = 0; i < frame.num_references; ++i) { |
| 259 if (AheadOrAt(frame.references[i], frame.picture_id)) | 252 if (AheadOrAt(frame.references[i], frame.picture_id)) |
| 260 return false; | 253 return false; |
| 261 for (size_t j = i + 1; j < frame.num_references; ++j) { | 254 for (size_t j = i + 1; j < frame.num_references; ++j) { |
| 262 if (frame.references[i] == frame.references[j]) | 255 if (frame.references[i] == frame.references[j]) |
| 263 return false; | 256 return false; |
| 264 } | 257 } |
| 265 } | 258 } |
| 266 | 259 |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 frames_.clear(); | 559 frames_.clear(); |
| 567 last_decoded_frame_it_ = frames_.end(); | 560 last_decoded_frame_it_ = frames_.end(); |
| 568 last_continuous_frame_it_ = frames_.end(); | 561 last_continuous_frame_it_ = frames_.end(); |
| 569 next_frame_it_ = frames_.end(); | 562 next_frame_it_ = frames_.end(); |
| 570 num_frames_history_ = 0; | 563 num_frames_history_ = 0; |
| 571 num_frames_buffered_ = 0; | 564 num_frames_buffered_ = 0; |
| 572 } | 565 } |
| 573 | 566 |
| 574 } // namespace video_coding | 567 } // namespace video_coding |
| 575 } // namespace webrtc | 568 } // namespace webrtc |
| OLD | NEW |