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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 ready_frames_.pop_front(); | 324 ready_frames_.pop_front(); |
325 | 325 |
326 PipelineStatistics statistics; | 326 PipelineStatistics statistics; |
327 statistics.video_frames_dropped = 1; | 327 statistics.video_frames_dropped = 1; |
328 statistics_cb_.Run(statistics); | 328 statistics_cb_.Run(statistics); |
329 | 329 |
330 message_loop_->PostTask(FROM_HERE, base::Bind( | 330 message_loop_->PostTask(FROM_HERE, base::Bind( |
331 &VideoRendererBase::AttemptRead, weak_this_)); | 331 &VideoRendererBase::AttemptRead, weak_this_)); |
332 } | 332 } |
333 | 333 |
334 void VideoRendererBase::FrameReady(VideoDecoder::Status status, | 334 void VideoRendererBase::FrameReady(VideoFrameStream::Status status, |
335 const scoped_refptr<VideoFrame>& frame) { | 335 const scoped_refptr<VideoFrame>& frame) { |
336 base::AutoLock auto_lock(lock_); | 336 base::AutoLock auto_lock(lock_); |
337 DCHECK_NE(state_, kUninitialized); | 337 DCHECK_NE(state_, kUninitialized); |
338 DCHECK_NE(state_, kFlushed); | 338 DCHECK_NE(state_, kFlushed); |
339 | 339 |
340 CHECK(pending_read_); | 340 CHECK(pending_read_); |
341 pending_read_ = false; | 341 pending_read_ = false; |
342 | 342 |
343 if (status != VideoDecoder::kOk) { | 343 if (status == VideoFrameStream::DECODE_ERROR || |
| 344 status == VideoFrameStream::DECRYPT_ERROR) { |
344 DCHECK(!frame.get()); | 345 DCHECK(!frame.get()); |
345 PipelineStatus error = PIPELINE_ERROR_DECODE; | 346 PipelineStatus error = PIPELINE_ERROR_DECODE; |
346 if (status == VideoDecoder::kDecryptError) | 347 if (status == VideoFrameStream::DECRYPT_ERROR) |
347 error = PIPELINE_ERROR_DECRYPT; | 348 error = PIPELINE_ERROR_DECRYPT; |
348 | 349 |
349 if (!preroll_cb_.is_null()) { | 350 if (!preroll_cb_.is_null()) { |
350 base::ResetAndReturn(&preroll_cb_).Run(error); | 351 base::ResetAndReturn(&preroll_cb_).Run(error); |
351 return; | 352 return; |
352 } | 353 } |
353 | 354 |
354 error_cb_.Run(error); | 355 error_cb_.Run(error); |
355 return; | 356 return; |
356 } | 357 } |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 // Because we might remain in the prerolled state for an undetermined amount | 513 // Because we might remain in the prerolled state for an undetermined amount |
513 // of time (e.g., we seeked while paused), we'll paint the first prerolled | 514 // of time (e.g., we seeked while paused), we'll paint the first prerolled |
514 // frame. | 515 // frame. |
515 if (!ready_frames_.empty()) | 516 if (!ready_frames_.empty()) |
516 PaintNextReadyFrame_Locked(); | 517 PaintNextReadyFrame_Locked(); |
517 | 518 |
518 base::ResetAndReturn(&preroll_cb_).Run(PIPELINE_OK); | 519 base::ResetAndReturn(&preroll_cb_).Run(PIPELINE_OK); |
519 } | 520 } |
520 | 521 |
521 } // namespace media | 522 } // namespace media |
OLD | NEW |