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/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 if (state_ == kError || state_ == kStopped) { | 375 if (state_ == kError || state_ == kStopped) { |
376 DoStopOrError_Locked(); | 376 DoStopOrError_Locked(); |
377 } | 377 } |
378 } | 378 } |
379 | 379 |
380 VideoRendererBase::~VideoRendererBase() { | 380 VideoRendererBase::~VideoRendererBase() { |
381 base::AutoLock auto_lock(lock_); | 381 base::AutoLock auto_lock(lock_); |
382 DCHECK(state_ == kUninitialized || state_ == kStopped) << state_; | 382 DCHECK(state_ == kUninitialized || state_ == kStopped) << state_; |
383 } | 383 } |
384 | 384 |
385 void VideoRendererBase::FrameReady(VideoDecoder::DecoderStatus status, | 385 void VideoRendererBase::FrameReady(VideoDecoder::Status status, |
386 const scoped_refptr<VideoFrame>& frame) { | 386 const scoped_refptr<VideoFrame>& frame) { |
387 base::AutoLock auto_lock(lock_); | 387 base::AutoLock auto_lock(lock_); |
388 DCHECK_NE(state_, kUninitialized); | 388 DCHECK_NE(state_, kUninitialized); |
389 | 389 |
390 CHECK(pending_read_); | 390 CHECK(pending_read_); |
391 pending_read_ = false; | 391 pending_read_ = false; |
392 | 392 |
393 if (status != VideoDecoder::kOk) { | 393 if (status != VideoDecoder::kOk) { |
394 DCHECK(!frame); | 394 DCHECK(!frame); |
395 PipelineStatus error = PIPELINE_ERROR_DECODE; | 395 PipelineStatus error = PIPELINE_ERROR_DECODE; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 | 557 |
558 int VideoRendererBase::NumFrames_Locked() const { | 558 int VideoRendererBase::NumFrames_Locked() const { |
559 lock_.AssertAcquired(); | 559 lock_.AssertAcquired(); |
560 int outstanding_frames = | 560 int outstanding_frames = |
561 (current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) + | 561 (current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) + |
562 (current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0); | 562 (current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0); |
563 return ready_frames_.size() + outstanding_frames; | 563 return ready_frames_.size() + outstanding_frames; |
564 } | 564 } |
565 | 565 |
566 } // namespace media | 566 } // namespace media |
OLD | NEW |