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/renderers/video_renderer_impl.h" | 5 #include "media/renderers/video_renderer_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_to_current_loop.h" |
8 #include "base/callback.h" | 9 #include "base/callback.h" |
9 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
10 #include "base/location.h" | 11 #include "base/location.h" |
11 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
12 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
13 #include "base/time/default_tick_clock.h" | 14 #include "base/time/default_tick_clock.h" |
14 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
15 #include "media/base/bind_to_current_loop.h" | |
16 #include "media/base/buffers.h" | 16 #include "media/base/buffers.h" |
17 #include "media/base/limits.h" | 17 #include "media/base/limits.h" |
18 #include "media/base/pipeline.h" | 18 #include "media/base/pipeline.h" |
19 #include "media/base/video_frame.h" | 19 #include "media/base/video_frame.h" |
20 | 20 |
21 namespace media { | 21 namespace media { |
22 | 22 |
23 VideoRendererImpl::VideoRendererImpl( | 23 VideoRendererImpl::VideoRendererImpl( |
24 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 24 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
25 VideoRendererSink* sink, | 25 VideoRendererSink* sink, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 DCHECK(!statistics_cb.is_null()); | 120 DCHECK(!statistics_cb.is_null()); |
121 DCHECK(!buffering_state_cb.is_null()); | 121 DCHECK(!buffering_state_cb.is_null()); |
122 DCHECK(!ended_cb.is_null()); | 122 DCHECK(!ended_cb.is_null()); |
123 DCHECK(!wall_clock_time_cb.is_null()); | 123 DCHECK(!wall_clock_time_cb.is_null()); |
124 DCHECK_EQ(kUninitialized, state_); | 124 DCHECK_EQ(kUninitialized, state_); |
125 | 125 |
126 low_delay_ = (stream->liveness() == DemuxerStream::LIVENESS_LIVE); | 126 low_delay_ = (stream->liveness() == DemuxerStream::LIVENESS_LIVE); |
127 | 127 |
128 // Always post |init_cb_| because |this| could be destroyed if initialization | 128 // Always post |init_cb_| because |this| could be destroyed if initialization |
129 // failed. | 129 // failed. |
130 init_cb_ = BindToCurrentLoop(init_cb); | 130 init_cb_ = base::BindToCurrentLoop(init_cb); |
131 | 131 |
132 statistics_cb_ = statistics_cb; | 132 statistics_cb_ = statistics_cb; |
133 buffering_state_cb_ = buffering_state_cb; | 133 buffering_state_cb_ = buffering_state_cb; |
134 paint_cb_ = base::Bind(&VideoRendererSink::PaintFrameUsingOldRenderingPath, | 134 paint_cb_ = base::Bind(&VideoRendererSink::PaintFrameUsingOldRenderingPath, |
135 base::Unretained(sink_)); | 135 base::Unretained(sink_)); |
136 ended_cb_ = ended_cb; | 136 ended_cb_ = ended_cb; |
137 error_cb_ = error_cb; | 137 error_cb_ = error_cb; |
138 wall_clock_time_cb_ = wall_clock_time_cb; | 138 wall_clock_time_cb_ = wall_clock_time_cb; |
139 state_ = kInitializing; | 139 state_ = kInitializing; |
140 | 140 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 task_runner_->PostTask(FROM_HERE, base::Bind(statistics_cb_, statistics)); | 474 task_runner_->PostTask(FROM_HERE, base::Bind(statistics_cb_, statistics)); |
475 | 475 |
476 frames_decoded_ = 0; | 476 frames_decoded_ = 0; |
477 frames_dropped_ = 0; | 477 frames_dropped_ = 0; |
478 } | 478 } |
479 | 479 |
480 frame_available_.TimedWait(wait_duration); | 480 frame_available_.TimedWait(wait_duration); |
481 } | 481 } |
482 | 482 |
483 } // namespace media | 483 } // namespace media |
OLD | NEW |