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

Side by Side Diff: media/filters/video_renderer_base.cc

Issue 10248002: Report VideoDecoder status through ReadCB instead of through FilterHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revised on comments. Created 8 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 | Annotate | Revision Log
OLDNEW
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
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(VideoDecoder::Status status,
363 scoped_refptr<VideoFrame> frame) {
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 }
381
382 DCHECK_EQ(status, VideoDecoder::kOk);
383
369 // Already-queued Decoder ReadCB's can fire after various state transitions 384 // Already-queued Decoder ReadCB's can fire after various state transitions
370 // have happened; in that case just drop those frames immediately. 385 // have happened; in that case just drop those frames immediately.
371 if (state_ == kStopped || state_ == kError || state_ == kFlushed || 386 if (state_ == kStopped || state_ == kError || state_ == kFlushed ||
372 state_ == kFlushingDecoder) 387 state_ == kFlushingDecoder)
373 return; 388 return;
374 389
375 if (state_ == kFlushing) { 390 if (state_ == kFlushing) {
376 AttemptFlush_Locked(); 391 AttemptFlush_Locked();
377 return; 392 return;
378 } 393 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 535
521 int VideoRendererBase::NumFrames_Locked() const { 536 int VideoRendererBase::NumFrames_Locked() const {
522 lock_.AssertAcquired(); 537 lock_.AssertAcquired();
523 int outstanding_frames = 538 int outstanding_frames =
524 (current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) + 539 (current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) +
525 (current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0); 540 (current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0);
526 return ready_frames_.size() + outstanding_frames; 541 return ready_frames_.size() + outstanding_frames;
527 } 542 }
528 543
529 } // namespace media 544 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698