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

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

Issue 2879073002: 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 if (frame_ref->second.num_missing_continuous == 0) { 338 if (frame_ref->second.num_missing_continuous == 0) {
339 frame_ref->second.continuous = true; 339 frame_ref->second.continuous = true;
340 continuous_frames.push(frame_ref); 340 continuous_frames.push(frame_ref);
341 } 341 }
342 } 342 }
343 } 343 }
344 } 344 }
345 345
346 void FrameBuffer::PropagateDecodability(const FrameInfo& info) { 346 void FrameBuffer::PropagateDecodability(const FrameInfo& info) {
347 TRACE_EVENT0("webrtc", "FrameBuffer::PropagateDecodability"); 347 TRACE_EVENT0("webrtc", "FrameBuffer::PropagateDecodability");
348 RTC_CHECK(info.num_dependent_frames < FrameInfo::kMaxNumDependentFrames);
348 for (size_t d = 0; d < info.num_dependent_frames; ++d) { 349 for (size_t d = 0; d < info.num_dependent_frames; ++d) {
349 auto ref_info = frames_.find(info.dependent_frames[d]); 350 auto ref_info = frames_.find(info.dependent_frames[d]);
350 RTC_DCHECK(ref_info != frames_.end()); 351 RTC_DCHECK(ref_info != frames_.end());
351 RTC_DCHECK_GT(ref_info->second.num_missing_decodable, 0U); 352 // TODO(philipel): Look into why we've seen this happen.
352 --ref_info->second.num_missing_decodable; 353 if (ref_info != frames_.end()) {
354 RTC_DCHECK_GT(ref_info->second.num_missing_decodable, 0U);
355 --ref_info->second.num_missing_decodable;
356 }
353 } 357 }
354 } 358 }
355 359
356 void FrameBuffer::AdvanceLastDecodedFrame(FrameMap::iterator decoded) { 360 void FrameBuffer::AdvanceLastDecodedFrame(FrameMap::iterator decoded) {
357 TRACE_EVENT0("webrtc", "FrameBuffer::AdvanceLastDecodedFrame"); 361 TRACE_EVENT0("webrtc", "FrameBuffer::AdvanceLastDecodedFrame");
358 if (last_decoded_frame_it_ == frames_.end()) { 362 if (last_decoded_frame_it_ == frames_.end()) {
359 last_decoded_frame_it_ = frames_.begin(); 363 last_decoded_frame_it_ = frames_.begin();
360 } else { 364 } else {
361 RTC_DCHECK(last_decoded_frame_it_->first < decoded->first); 365 RTC_DCHECK(last_decoded_frame_it_->first < decoded->first);
362 ++last_decoded_frame_it_; 366 ++last_decoded_frame_it_;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 if (ref_info == frames_.end()) 415 if (ref_info == frames_.end())
412 ref_info = frames_.insert(std::make_pair(ref_key, FrameInfo())).first; 416 ref_info = frames_.insert(std::make_pair(ref_key, FrameInfo())).first;
413 417
414 if (ref_info->second.continuous) 418 if (ref_info->second.continuous)
415 --info->second.num_missing_continuous; 419 --info->second.num_missing_continuous;
416 420
417 // Add backwards reference so |frame| can be updated when new 421 // Add backwards reference so |frame| can be updated when new
418 // frames are inserted or decoded. 422 // frames are inserted or decoded.
419 ref_info->second.dependent_frames[ref_info->second.num_dependent_frames] = 423 ref_info->second.dependent_frames[ref_info->second.num_dependent_frames] =
420 key; 424 key;
421 ++ref_info->second.num_dependent_frames; 425 RTC_DCHECK_LT(ref_info->second.num_dependent_frames,
426 (FrameInfo::kMaxNumDependentFrames - 1));
427 // TODO(philipel): Look into why this could happen and handle
428 // appropriately.
429 if (ref_info->second.num_dependent_frames <
430 (FrameInfo::kMaxNumDependentFrames - 1)) {
431 ++ref_info->second.num_dependent_frames;
432 }
422 } 433 }
423 RTC_DCHECK_LE(ref_info->second.num_missing_continuous, 434 RTC_DCHECK_LE(ref_info->second.num_missing_continuous,
424 ref_info->second.num_missing_decodable); 435 ref_info->second.num_missing_decodable);
425 } 436 }
426 437
427 // Check if we have the lower spatial layer frame. 438 // Check if we have the lower spatial layer frame.
428 if (frame.inter_layer_predicted) { 439 if (frame.inter_layer_predicted) {
429 ++info->second.num_missing_continuous; 440 ++info->second.num_missing_continuous;
430 ++info->second.num_missing_decodable; 441 ++info->second.num_missing_decodable;
431 442
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 frames_.clear(); 489 frames_.clear();
479 last_decoded_frame_it_ = frames_.end(); 490 last_decoded_frame_it_ = frames_.end();
480 last_continuous_frame_it_ = frames_.end(); 491 last_continuous_frame_it_ = frames_.end();
481 next_frame_it_ = frames_.end(); 492 next_frame_it_ = frames_.end();
482 num_frames_history_ = 0; 493 num_frames_history_ = 0;
483 num_frames_buffered_ = 0; 494 num_frames_buffered_ = 0;
484 } 495 }
485 496
486 } // namespace video_coding 497 } // namespace video_coding
487 } // namespace webrtc 498 } // 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