| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_impl.h" | 5 #include "media/filters/video_renderer_impl.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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 VideoRendererImpl::VideoRendererImpl( | 25 VideoRendererImpl::VideoRendererImpl( |
| 26 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 26 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 27 ScopedVector<VideoDecoder> decoders, | 27 ScopedVector<VideoDecoder> decoders, |
| 28 const SetDecryptorReadyCB& set_decryptor_ready_cb, | 28 const SetDecryptorReadyCB& set_decryptor_ready_cb, |
| 29 const PaintCB& paint_cb, | 29 const PaintCB& paint_cb, |
| 30 const SetOpaqueCB& set_opaque_cb, | 30 const SetOpaqueCB& set_opaque_cb, |
| 31 bool drop_frames) | 31 bool drop_frames) |
| 32 : task_runner_(task_runner), | 32 : task_runner_(task_runner), |
| 33 weak_factory_(this), | 33 video_frame_stream_(task_runner, decoders.Pass(), set_decryptor_ready_cb), |
| 34 video_frame_stream_( | |
| 35 task_runner, decoders.Pass(), set_decryptor_ready_cb), | |
| 36 received_end_of_stream_(false), | 34 received_end_of_stream_(false), |
| 37 frame_available_(&lock_), | 35 frame_available_(&lock_), |
| 38 state_(kUninitialized), | 36 state_(kUninitialized), |
| 39 thread_(), | 37 thread_(), |
| 40 pending_read_(false), | 38 pending_read_(false), |
| 41 drop_frames_(drop_frames), | 39 drop_frames_(drop_frames), |
| 42 playback_rate_(0), | 40 playback_rate_(0), |
| 43 paint_cb_(paint_cb), | 41 paint_cb_(paint_cb), |
| 44 set_opaque_cb_(set_opaque_cb), | 42 set_opaque_cb_(set_opaque_cb), |
| 45 last_timestamp_(kNoTimestamp()), | 43 last_timestamp_(kNoTimestamp()), |
| 46 frames_decoded_(0), | 44 frames_decoded_(0), |
| 47 frames_dropped_(0) { | 45 frames_dropped_(0), |
| 46 weak_factory_(this) { |
| 48 DCHECK(!paint_cb_.is_null()); | 47 DCHECK(!paint_cb_.is_null()); |
| 49 } | 48 } |
| 50 | 49 |
| 51 VideoRendererImpl::~VideoRendererImpl() { | 50 VideoRendererImpl::~VideoRendererImpl() { |
| 52 base::AutoLock auto_lock(lock_); | 51 base::AutoLock auto_lock(lock_); |
| 53 CHECK(state_ == kStopped || state_ == kUninitialized) << state_; | 52 CHECK(state_ == kStopped || state_ == kUninitialized) << state_; |
| 54 CHECK(thread_.is_null()); | 53 CHECK(thread_.is_null()); |
| 55 } | 54 } |
| 56 | 55 |
| 57 void VideoRendererImpl::Play(const base::Closure& callback) { | 56 void VideoRendererImpl::Play(const base::Closure& callback) { |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 statistics_cb_.Run(statistics); | 539 statistics_cb_.Run(statistics); |
| 541 | 540 |
| 542 frames_decoded_ = 0; | 541 frames_decoded_ = 0; |
| 543 frames_dropped_ = 0; | 542 frames_dropped_ = 0; |
| 544 } | 543 } |
| 545 | 544 |
| 546 frame_available_.TimedWait(wait_duration); | 545 frame_available_.TimedWait(wait_duration); |
| 547 } | 546 } |
| 548 | 547 |
| 549 } // namespace media | 548 } // namespace media |
| OLD | NEW |