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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 frame_it = last_decoded_frame_it_; | 86 frame_it = last_decoded_frame_it_; |
87 ++frame_it; | 87 ++frame_it; |
88 } | 88 } |
89 | 89 |
90 // |continuous_end_it| points to the first frame after the | 90 // |continuous_end_it| points to the first frame after the |
91 // |last_continuous_frame_it_|. | 91 // |last_continuous_frame_it_|. |
92 auto continuous_end_it = last_continuous_frame_it_; | 92 auto continuous_end_it = last_continuous_frame_it_; |
93 if (continuous_end_it != frames_.end()) | 93 if (continuous_end_it != frames_.end()) |
94 ++continuous_end_it; | 94 ++continuous_end_it; |
95 | 95 |
96 for (; frame_it != continuous_end_it; ++frame_it) { | 96 for (; frame_it != continuous_end_it; ++frame_it) { |
stefan-webrtc
2017/04/20 09:36:46
Add a check that continuous_end_it is larger than
| |
97 if (!frame_it->second.continuous || | 97 if (!frame_it->second.continuous || |
98 frame_it->second.num_missing_decodable > 0) { | 98 frame_it->second.num_missing_decodable > 0) { |
99 continue; | 99 continue; |
100 } | 100 } |
101 | 101 |
102 FrameObject* frame = frame_it->second.frame.get(); | 102 FrameObject* frame = frame_it->second.frame.get(); |
103 next_frame_it_ = frame_it; | 103 next_frame_it_ = frame_it; |
104 if (frame->RenderTime() == -1) | 104 if (frame->RenderTime() == -1) |
105 frame->SetRenderTime(timing_->RenderTimeMs(frame->timestamp, now_ms)); | 105 frame->SetRenderTime(timing_->RenderTimeMs(frame->timestamp, now_ms)); |
106 wait_ms = timing_->MaxWaitingTime(frame->RenderTime(), now_ms); | 106 wait_ms = timing_->MaxWaitingTime(frame->RenderTime(), now_ms); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 << static_cast<int>(key.spatial_layer) | 226 << static_cast<int>(key.spatial_layer) |
227 << ") inserted after frame (" | 227 << ") inserted after frame (" |
228 << last_decoded_frame_it_->first.picture_id << ":" | 228 << last_decoded_frame_it_->first.picture_id << ":" |
229 << static_cast<int>( | 229 << static_cast<int>( |
230 last_decoded_frame_it_->first.spatial_layer) | 230 last_decoded_frame_it_->first.spatial_layer) |
231 << ") was handed off for decoding, dropping frame."; | 231 << ") was handed off for decoding, dropping frame."; |
232 return last_continuous_picture_id; | 232 return last_continuous_picture_id; |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 // Test if inserting this frame would cause the order of the frames to become | |
237 // ambiguous (covering more than half the interval of 2^16). This can happen | |
238 // when the picture id make large jumps mid stream. | |
239 if (!frames_.empty() && | |
240 key < frames_.begin()->first && | |
241 frames_.rbegin()->first < key) { | |
242 LOG(LS_WARNING) << "A jump in picture id was detected, clearing buffer."; | |
243 ClearFramesAndHistory(); | |
244 last_continuous_picture_id = -1; | |
245 } | |
246 | |
236 auto info = frames_.insert(std::make_pair(key, FrameInfo())).first; | 247 auto info = frames_.insert(std::make_pair(key, FrameInfo())).first; |
237 | 248 |
238 if (info->second.frame) { | 249 if (info->second.frame) { |
239 LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) (" << key.picture_id | 250 LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) (" << key.picture_id |
240 << ":" << static_cast<int>(key.spatial_layer) | 251 << ":" << static_cast<int>(key.spatial_layer) |
241 << ") already inserted, dropping frame."; | 252 << ") already inserted, dropping frame."; |
242 return last_continuous_picture_id; | 253 return last_continuous_picture_id; |
243 } | 254 } |
244 | 255 |
245 if (!UpdateFrameInfoWithIncomingFrame(*frame, info)) | 256 if (!UpdateFrameInfoWithIncomingFrame(*frame, info)) |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
428 frames_.clear(); | 439 frames_.clear(); |
429 last_decoded_frame_it_ = frames_.end(); | 440 last_decoded_frame_it_ = frames_.end(); |
430 last_continuous_frame_it_ = frames_.end(); | 441 last_continuous_frame_it_ = frames_.end(); |
431 next_frame_it_ = frames_.end(); | 442 next_frame_it_ = frames_.end(); |
432 num_frames_history_ = 0; | 443 num_frames_history_ = 0; |
433 num_frames_buffered_ = 0; | 444 num_frames_buffered_ = 0; |
434 } | 445 } |
435 | 446 |
436 } // namespace video_coding | 447 } // namespace video_coding |
437 } // namespace webrtc | 448 } // namespace webrtc |
OLD | NEW |