| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/filters/video_renderer_base.h" | 5 #include "media/filters/video_renderer_base.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 return; | 446 return; |
| 447 } | 447 } |
| 448 | 448 |
| 449 if (state_ == kError || state_ == kStopped) { | 449 if (state_ == kError || state_ == kStopped) { |
| 450 DoStopOrError_Locked(); | 450 DoStopOrError_Locked(); |
| 451 } | 451 } |
| 452 } | 452 } |
| 453 | 453 |
| 454 VideoRendererBase::~VideoRendererBase() { | 454 VideoRendererBase::~VideoRendererBase() { |
| 455 base::AutoLock auto_lock(lock_); | 455 base::AutoLock auto_lock(lock_); |
| 456 DCHECK(state_ == kUninitialized || state_ == kStopped) << state_; | 456 CHECK(state_ == kUninitialized || state_ == kStopped) << state_; |
| 457 CHECK_EQ(thread_, base::kNullThreadHandle); |
| 457 } | 458 } |
| 458 | 459 |
| 459 void VideoRendererBase::FrameReady(VideoDecoder::Status status, | 460 void VideoRendererBase::FrameReady(VideoDecoder::Status status, |
| 460 const scoped_refptr<VideoFrame>& frame) { | 461 const scoped_refptr<VideoFrame>& frame) { |
| 461 base::AutoLock auto_lock(lock_); | 462 base::AutoLock auto_lock(lock_); |
| 462 DCHECK_NE(state_, kUninitialized); | 463 DCHECK_NE(state_, kUninitialized); |
| 463 | 464 |
| 464 CHECK(pending_read_); | 465 CHECK(pending_read_); |
| 465 pending_read_ = false; | 466 pending_read_ = false; |
| 466 | 467 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 | 668 |
| 668 int VideoRendererBase::NumFrames_Locked() const { | 669 int VideoRendererBase::NumFrames_Locked() const { |
| 669 lock_.AssertAcquired(); | 670 lock_.AssertAcquired(); |
| 670 int outstanding_frames = | 671 int outstanding_frames = |
| 671 (current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) + | 672 (current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) + |
| 672 (current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0); | 673 (current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0); |
| 673 return ready_frames_.size() + outstanding_frames; | 674 return ready_frames_.size() + outstanding_frames; |
| 674 } | 675 } |
| 675 | 676 |
| 676 } // namespace media | 677 } // namespace media |
| OLD | NEW |