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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 } // rtc::Critscope lock(&crit_); | 112 } // rtc::Critscope lock(&crit_); |
113 | 113 |
114 wait_ms = std::min<int64_t>(wait_ms, latest_return_time - now_ms); | 114 wait_ms = std::min<int64_t>(wait_ms, latest_return_time - now_ms); |
115 wait_ms = std::max<int64_t>(wait_ms, 0); | 115 wait_ms = std::max<int64_t>(wait_ms, 0); |
116 } while (new_countinuous_frame_event_.Wait(wait_ms)); | 116 } while (new_countinuous_frame_event_.Wait(wait_ms)); |
117 | 117 |
118 rtc::CritScope lock(&crit_); | 118 rtc::CritScope lock(&crit_); |
119 if (next_frame_it != frames_.end()) { | 119 if (next_frame_it != frames_.end()) { |
120 std::unique_ptr<FrameObject> frame = std::move(next_frame_it->second.frame); | 120 std::unique_ptr<FrameObject> frame = std::move(next_frame_it->second.frame); |
121 int64_t received_time = frame->ReceivedTime(); | |
122 uint32_t timestamp = frame->timestamp; | |
123 | 121 |
124 int64_t frame_delay; | 122 if (!frame->delayed_by_retransmission()) { |
125 if (inter_frame_delay_.CalculateDelay(timestamp, &frame_delay, | 123 int64_t frame_delay; |
126 received_time)) { | 124 |
127 jitter_estimator_->UpdateEstimate(frame_delay, frame->size()); | 125 if (inter_frame_delay_.CalculateDelay(frame->timestamp, &frame_delay, |
| 126 frame->ReceivedTime())) { |
| 127 jitter_estimator_->UpdateEstimate(frame_delay, frame->size()); |
| 128 } |
| 129 |
| 130 float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0; |
| 131 timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult)); |
| 132 timing_->UpdateCurrentDelay(frame->RenderTime(), |
| 133 clock_->TimeInMilliseconds()); |
128 } | 134 } |
129 float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0; | |
130 timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult)); | |
131 timing_->UpdateCurrentDelay(frame->RenderTime(), | |
132 clock_->TimeInMilliseconds()); | |
133 | 135 |
134 UpdateJitterDelay(); | 136 UpdateJitterDelay(); |
135 | 137 |
136 PropagateDecodability(next_frame_it->second); | 138 PropagateDecodability(next_frame_it->second); |
137 AdvanceLastDecodedFrame(next_frame_it); | 139 AdvanceLastDecodedFrame(next_frame_it); |
138 last_decoded_frame_timestamp_ = frame->timestamp; | 140 last_decoded_frame_timestamp_ = frame->timestamp; |
139 *frame_out = std::move(frame); | 141 *frame_out = std::move(frame); |
140 return kFrameFound; | 142 return kFrameFound; |
141 } else { | 143 } else { |
142 return kTimeout; | 144 return kTimeout; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 void FrameBuffer::ClearFramesAndHistory() { | 409 void FrameBuffer::ClearFramesAndHistory() { |
408 frames_.clear(); | 410 frames_.clear(); |
409 last_decoded_frame_it_ = frames_.end(); | 411 last_decoded_frame_it_ = frames_.end(); |
410 last_continuous_frame_it_ = frames_.end(); | 412 last_continuous_frame_it_ = frames_.end(); |
411 num_frames_history_ = 0; | 413 num_frames_history_ = 0; |
412 num_frames_buffered_ = 0; | 414 num_frames_buffered_ = 0; |
413 } | 415 } |
414 | 416 |
415 } // namespace video_coding | 417 } // namespace video_coding |
416 } // namespace webrtc | 418 } // namespace webrtc |
OLD | NEW |