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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 | 137 |
138 float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0; | 138 float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0; |
139 timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult)); | 139 timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult)); |
140 timing_->UpdateCurrentDelay(frame->RenderTime(), now_ms); | 140 timing_->UpdateCurrentDelay(frame->RenderTime(), now_ms); |
141 } | 141 } |
142 | 142 |
143 UpdateJitterDelay(); | 143 UpdateJitterDelay(); |
144 | 144 |
145 PropagateDecodability(next_frame_it_->second); | 145 PropagateDecodability(next_frame_it_->second); |
146 AdvanceLastDecodedFrame(next_frame_it_); | 146 AdvanceLastDecodedFrame(next_frame_it_); |
147 // Sanity check for RTP timestamp monotonicity. | |
148 // TODO(brandtr): Consider clearing the entire buffer when we hit these | |
149 // conditions. | |
150 if (last_decoded_frame_it_ != frames_.end()) { | |
philipel
2017/04/26 15:26:37
This should work, right?
if (last_decoded_frame_i
brandtr
2017/04/26 15:51:19
I don't think that would catch this situation:
* f
| |
151 const FrameKey& last_decoded_frame_key = last_decoded_frame_it_->first; | |
152 const FrameKey frame_key(frame->picture_id, frame->spatial_layer); | |
153 | |
154 const bool frame_is_higher_spatial_layer_of_last_decoded_frame = | |
155 last_decoded_frame_timestamp_ == frame->timestamp && | |
156 last_decoded_frame_key.picture_id == frame_key.picture_id && | |
157 last_decoded_frame_key.spatial_layer < frame_key.spatial_layer; | |
158 | |
159 if (AheadOrAt(last_decoded_frame_timestamp_, frame->timestamp) && | |
160 !frame_is_higher_spatial_layer_of_last_decoded_frame) { | |
161 LOG(LS_WARNING) << "Frame with (timestamp:picture_id:spatial_id) (" | |
162 << frame->timestamp << ":" << frame->picture_id << ":" | |
163 << static_cast<int>(frame->spatial_layer) << ")" | |
164 << " sent to decoder after frame with" | |
165 << " (timestamp:picture_id:spatial_id) (" | |
166 << last_decoded_frame_timestamp_ << ":" | |
167 << last_decoded_frame_key.picture_id << ":" | |
168 << static_cast<int>( | |
169 last_decoded_frame_key.spatial_layer) | |
170 << ")."; | |
171 } | |
172 } | |
147 last_decoded_frame_timestamp_ = frame->timestamp; | 173 last_decoded_frame_timestamp_ = frame->timestamp; |
148 *frame_out = std::move(frame); | 174 *frame_out = std::move(frame); |
149 return kFrameFound; | 175 return kFrameFound; |
150 } | 176 } |
151 } | 177 } |
152 | 178 |
153 if (latest_return_time_ms - now_ms > 0) { | 179 if (latest_return_time_ms - now_ms > 0) { |
154 // If |next_frame_it_ == frames_.end()| and there is still time left, it | 180 // If |next_frame_it_ == frames_.end()| and there is still time left, it |
155 // means that the frame buffer was cleared as the thread in this function | 181 // means that the frame buffer was cleared as the thread in this function |
156 // was waiting to acquire |crit_| in order to return. Wait for the | 182 // was waiting to acquire |crit_| in order to return. Wait for the |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
440 frames_.clear(); | 466 frames_.clear(); |
441 last_decoded_frame_it_ = frames_.end(); | 467 last_decoded_frame_it_ = frames_.end(); |
442 last_continuous_frame_it_ = frames_.end(); | 468 last_continuous_frame_it_ = frames_.end(); |
443 next_frame_it_ = frames_.end(); | 469 next_frame_it_ = frames_.end(); |
444 num_frames_history_ = 0; | 470 num_frames_history_ = 0; |
445 num_frames_buffered_ = 0; | 471 num_frames_buffered_ = 0; |
446 } | 472 } |
447 | 473 |
448 } // namespace video_coding | 474 } // namespace video_coding |
449 } // namespace webrtc | 475 } // namespace webrtc |
OLD | NEW |