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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/threading/platform_thread.h" | 8 #include "base/threading/platform_thread.h" |
9 #include "media/base/buffers.h" | 9 #include "media/base/buffers.h" |
10 #include "media/base/filter_host.h" | 10 #include "media/base/filter_host.h" |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 if (state_ == kFlushing) { | 352 if (state_ == kFlushing) { |
353 AttemptFlush_Locked(); | 353 AttemptFlush_Locked(); |
354 return; | 354 return; |
355 } | 355 } |
356 | 356 |
357 if (state_ == kError || state_ == kStopped) { | 357 if (state_ == kError || state_ == kStopped) { |
358 DoStopOrError_Locked(); | 358 DoStopOrError_Locked(); |
359 } | 359 } |
360 } | 360 } |
361 | 361 |
362 void VideoRendererBase::FrameReady(scoped_refptr<VideoFrame> frame) { | 362 void VideoRendererBase::FrameReady(scoped_refptr<VideoFrame> frame, |
363 VideoDecoder::Status status) { | |
363 base::AutoLock auto_lock(lock_); | 364 base::AutoLock auto_lock(lock_); |
364 DCHECK_NE(state_, kUninitialized); | 365 DCHECK_NE(state_, kUninitialized); |
365 | 366 |
366 CHECK(pending_read_); | 367 CHECK(pending_read_); |
367 pending_read_ = false; | 368 pending_read_ = false; |
368 | 369 |
370 if (status == VideoDecoder::kDecodeError) { | |
371 DCHECK(!frame); | |
372 host()->SetError(PIPELINE_ERROR_DECODE); | |
373 return; | |
374 } | |
375 | |
376 if (status == VideoDecoder::kDecryptError) { | |
377 DCHECK(!frame); | |
378 host()->SetError(PIPELINE_ERROR_DECRYPT); | |
379 return; | |
380 } | |
Ami GONE FROM CHROMIUM
2012/04/27 16:49:14
DCHECK_EQ(status, VideoDecoder::kOk);
?
xhwang
2012/04/27 23:22:30
Done.
| |
381 | |
369 // Already-queued Decoder ReadCB's can fire after various state transitions | 382 // Already-queued Decoder ReadCB's can fire after various state transitions |
370 // have happened; in that case just drop those frames immediately. | 383 // have happened; in that case just drop those frames immediately. |
371 if (state_ == kStopped || state_ == kError || state_ == kFlushed || | 384 if (state_ == kStopped || state_ == kError || state_ == kFlushed || |
372 state_ == kFlushingDecoder) | 385 state_ == kFlushingDecoder) |
373 return; | 386 return; |
374 | 387 |
375 if (state_ == kFlushing) { | 388 if (state_ == kFlushing) { |
376 AttemptFlush_Locked(); | 389 AttemptFlush_Locked(); |
377 return; | 390 return; |
378 } | 391 } |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
520 | 533 |
521 int VideoRendererBase::NumFrames_Locked() const { | 534 int VideoRendererBase::NumFrames_Locked() const { |
522 lock_.AssertAcquired(); | 535 lock_.AssertAcquired(); |
523 int outstanding_frames = | 536 int outstanding_frames = |
524 (current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) + | 537 (current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) + |
525 (current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0); | 538 (current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0); |
526 return ready_frames_.size() + outstanding_frames; | 539 return ready_frames_.size() + outstanding_frames; |
527 } | 540 } |
528 | 541 |
529 } // namespace media | 542 } // namespace media |
OLD | NEW |