Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1011)

Side by Side Diff: webrtc/modules/video_coding/frame_buffer2.cc

Issue 2891073002: Add a couple of checks to FrameBuffer while we're continuing to look at RtpFrameReferenceFinder. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 if (frame_ref->second.num_missing_continuous == 0) { 311 if (frame_ref->second.num_missing_continuous == 0) {
312 frame_ref->second.continuous = true; 312 frame_ref->second.continuous = true;
313 continuous_frames.push(frame_ref); 313 continuous_frames.push(frame_ref);
314 } 314 }
315 } 315 }
316 } 316 }
317 } 317 }
318 318
319 void FrameBuffer::PropagateDecodability(const FrameInfo& info) { 319 void FrameBuffer::PropagateDecodability(const FrameInfo& info) {
320 TRACE_EVENT0("webrtc", "FrameBuffer::PropagateDecodability"); 320 TRACE_EVENT0("webrtc", "FrameBuffer::PropagateDecodability");
321 RTC_CHECK(info.num_dependent_frames < FrameInfo::kMaxNumDependentFrames);
321 for (size_t d = 0; d < info.num_dependent_frames; ++d) { 322 for (size_t d = 0; d < info.num_dependent_frames; ++d) {
322 auto ref_info = frames_.find(info.dependent_frames[d]); 323 auto ref_info = frames_.find(info.dependent_frames[d]);
323 RTC_DCHECK(ref_info != frames_.end()); 324 RTC_DCHECK(ref_info != frames_.end());
324 RTC_DCHECK_GT(ref_info->second.num_missing_decodable, 0U); 325 // TODO(philipel): Look into why we've seen this happen.
325 --ref_info->second.num_missing_decodable; 326 if (ref_info != frames_.end()) {
327 RTC_DCHECK_GT(ref_info->second.num_missing_decodable, 0U);
328 --ref_info->second.num_missing_decodable;
329 }
326 } 330 }
327 } 331 }
328 332
329 void FrameBuffer::AdvanceLastDecodedFrame(FrameMap::iterator decoded) { 333 void FrameBuffer::AdvanceLastDecodedFrame(FrameMap::iterator decoded) {
330 TRACE_EVENT0("webrtc", "FrameBuffer::AdvanceLastDecodedFrame"); 334 TRACE_EVENT0("webrtc", "FrameBuffer::AdvanceLastDecodedFrame");
331 if (last_decoded_frame_it_ == frames_.end()) { 335 if (last_decoded_frame_it_ == frames_.end()) {
332 last_decoded_frame_it_ = frames_.begin(); 336 last_decoded_frame_it_ = frames_.begin();
333 } else { 337 } else {
334 RTC_DCHECK(last_decoded_frame_it_->first < decoded->first); 338 RTC_DCHECK(last_decoded_frame_it_->first < decoded->first);
335 ++last_decoded_frame_it_; 339 ++last_decoded_frame_it_;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 if (ref_info == frames_.end()) 388 if (ref_info == frames_.end())
385 ref_info = frames_.insert(std::make_pair(ref_key, FrameInfo())).first; 389 ref_info = frames_.insert(std::make_pair(ref_key, FrameInfo())).first;
386 390
387 if (ref_info->second.continuous) 391 if (ref_info->second.continuous)
388 --info->second.num_missing_continuous; 392 --info->second.num_missing_continuous;
389 393
390 // Add backwards reference so |frame| can be updated when new 394 // Add backwards reference so |frame| can be updated when new
391 // frames are inserted or decoded. 395 // frames are inserted or decoded.
392 ref_info->second.dependent_frames[ref_info->second.num_dependent_frames] = 396 ref_info->second.dependent_frames[ref_info->second.num_dependent_frames] =
393 key; 397 key;
394 ++ref_info->second.num_dependent_frames; 398 RTC_DCHECK_LT(ref_info->second.num_dependent_frames,
399 (FrameInfo::kMaxNumDependentFrames - 1));
400 // TODO(philipel): Look into why this could happen and handle
401 // appropriately.
402 if (ref_info->second.num_dependent_frames <
403 (FrameInfo::kMaxNumDependentFrames - 1)) {
404 ++ref_info->second.num_dependent_frames;
405 }
395 } 406 }
396 RTC_DCHECK_LE(ref_info->second.num_missing_continuous, 407 RTC_DCHECK_LE(ref_info->second.num_missing_continuous,
397 ref_info->second.num_missing_decodable); 408 ref_info->second.num_missing_decodable);
398 } 409 }
399 410
400 // Check if we have the lower spatial layer frame. 411 // Check if we have the lower spatial layer frame.
401 if (frame.inter_layer_predicted) { 412 if (frame.inter_layer_predicted) {
402 ++info->second.num_missing_continuous; 413 ++info->second.num_missing_continuous;
403 ++info->second.num_missing_decodable; 414 ++info->second.num_missing_decodable;
404 415
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 frames_.clear(); 462 frames_.clear();
452 last_decoded_frame_it_ = frames_.end(); 463 last_decoded_frame_it_ = frames_.end();
453 last_continuous_frame_it_ = frames_.end(); 464 last_continuous_frame_it_ = frames_.end();
454 next_frame_it_ = frames_.end(); 465 next_frame_it_ = frames_.end();
455 num_frames_history_ = 0; 466 num_frames_history_ = 0;
456 num_frames_buffered_ = 0; 467 num_frames_buffered_ = 0;
457 } 468 }
458 469
459 } // namespace video_coding 470 } // namespace video_coding
460 } // namespace webrtc 471 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698