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 #ifndef MEDIA_RENDERERS_VIDEO_RENDERER_IMPL_H_ | 5 #ifndef MEDIA_RENDERERS_VIDEO_RENDERER_IMPL_H_ |
6 #define MEDIA_RENDERERS_VIDEO_RENDERER_IMPL_H_ | 6 #define MEDIA_RENDERERS_VIDEO_RENDERER_IMPL_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 ~VideoRendererImpl() override; | 58 ~VideoRendererImpl() override; |
59 | 59 |
60 // VideoRenderer implementation. | 60 // VideoRenderer implementation. |
61 void Initialize(DemuxerStream* stream, | 61 void Initialize(DemuxerStream* stream, |
62 const PipelineStatusCB& init_cb, | 62 const PipelineStatusCB& init_cb, |
63 const SetDecryptorReadyCB& set_decryptor_ready_cb, | 63 const SetDecryptorReadyCB& set_decryptor_ready_cb, |
64 const StatisticsCB& statistics_cb, | 64 const StatisticsCB& statistics_cb, |
65 const BufferingStateCB& buffering_state_cb, | 65 const BufferingStateCB& buffering_state_cb, |
66 const base::Closure& ended_cb, | 66 const base::Closure& ended_cb, |
67 const PipelineStatusCB& error_cb, | 67 const PipelineStatusCB& error_cb, |
68 const WallClockTimeCB& wall_clock_time_cb, | 68 const TimeSource::WallClockTimeCB& wall_clock_time_cb, |
69 const base::Closure& waiting_for_decryption_key_cb) override; | 69 const base::Closure& waiting_for_decryption_key_cb) override; |
70 void Flush(const base::Closure& callback) override; | 70 void Flush(const base::Closure& callback) override; |
71 void StartPlayingFrom(base::TimeDelta timestamp) override; | 71 void StartPlayingFrom(base::TimeDelta timestamp) override; |
72 void OnTimeStateChanged(bool time_progressing) override; | 72 void OnTimeStateChanged(bool time_progressing) override; |
73 | 73 |
74 // PlatformThread::Delegate implementation. | 74 // PlatformThread::Delegate implementation. |
75 void ThreadMain() override; | 75 void ThreadMain() override; |
76 | 76 |
77 void SetTickClockForTesting(scoped_ptr<base::TickClock> tick_clock); | 77 void SetTickClockForTesting(scoped_ptr<base::TickClock> tick_clock); |
78 | 78 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 // Starts or stops |sink_| respectively. Do not call while |lock_| is held. | 144 // Starts or stops |sink_| respectively. Do not call while |lock_| is held. |
145 void StartSink(); | 145 void StartSink(); |
146 void StopSink(); | 146 void StopSink(); |
147 | 147 |
148 // Fires |ended_cb_| if there are no remaining usable frames and | 148 // Fires |ended_cb_| if there are no remaining usable frames and |
149 // |received_end_of_stream_| is true. Sets |rendered_end_of_stream_| if it | 149 // |received_end_of_stream_| is true. Sets |rendered_end_of_stream_| if it |
150 // does so. Returns algorithm_->EffectiveFramesQueued(). | 150 // does so. Returns algorithm_->EffectiveFramesQueued(). |
151 size_t MaybeFireEndedCallback(); | 151 size_t MaybeFireEndedCallback(); |
152 | 152 |
| 153 // Helper method for converting a single media timestamp to wall clock time. |
| 154 base::TimeTicks ConvertMediaTimestamp(base::TimeDelta media_timestamp); |
| 155 |
153 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 156 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
154 | 157 |
155 // Enables the use of VideoRendererAlgorithm and VideoRendererSink for frame | 158 // Enables the use of VideoRendererAlgorithm and VideoRendererSink for frame |
156 // rendering instead of using a thread in a sleep-loop. Set via the command | 159 // rendering instead of using a thread in a sleep-loop. Set via the command |
157 // line flag kEnableNewVideoRenderer or via test methods. | 160 // line flag kEnableNewVideoRenderer or via test methods. |
158 bool use_new_video_renderering_path_; | 161 bool use_new_video_renderering_path_; |
159 | 162 |
160 // Sink which calls into VideoRendererImpl via Render() for video frames. Do | 163 // Sink which calls into VideoRendererImpl via Render() for video frames. Do |
161 // not call any methods on the sink while |lock_| is held or the two threads | 164 // not call any methods on the sink while |lock_| is held or the two threads |
162 // might deadlock. Do not call Start() or Stop() on the sink directly, use | 165 // might deadlock. Do not call Start() or Stop() on the sink directly, use |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 228 |
226 // Playback operation callbacks. | 229 // Playback operation callbacks. |
227 base::Closure flush_cb_; | 230 base::Closure flush_cb_; |
228 | 231 |
229 // Event callbacks. | 232 // Event callbacks. |
230 PipelineStatusCB init_cb_; | 233 PipelineStatusCB init_cb_; |
231 StatisticsCB statistics_cb_; | 234 StatisticsCB statistics_cb_; |
232 BufferingStateCB buffering_state_cb_; | 235 BufferingStateCB buffering_state_cb_; |
233 base::Closure ended_cb_; | 236 base::Closure ended_cb_; |
234 PipelineStatusCB error_cb_; | 237 PipelineStatusCB error_cb_; |
235 WallClockTimeCB wall_clock_time_cb_; | 238 TimeSource::WallClockTimeCB wall_clock_time_cb_; |
236 | 239 |
237 base::TimeDelta start_timestamp_; | 240 base::TimeDelta start_timestamp_; |
238 | 241 |
239 // Embedder callback for notifying a new frame is available for painting. | 242 // Embedder callback for notifying a new frame is available for painting. |
240 PaintCB paint_cb_; | 243 PaintCB paint_cb_; |
241 | 244 |
242 // The wallclock times of the last frame removed from the |ready_frames_| | 245 // The wallclock times of the last frame removed from the |ready_frames_| |
243 // queue, either for calling |paint_cb_| or for dropping. Set to null during | 246 // queue, either for calling |paint_cb_| or for dropping. Set to null during |
244 // flushing. | 247 // flushing. |
245 base::TimeTicks last_media_time_; | 248 base::TimeTicks last_media_time_; |
(...skipping 30 matching lines...) Expand all Loading... |
276 | 279 |
277 // NOTE: Weak pointers must be invalidated before all other member variables. | 280 // NOTE: Weak pointers must be invalidated before all other member variables. |
278 base::WeakPtrFactory<VideoRendererImpl> weak_factory_; | 281 base::WeakPtrFactory<VideoRendererImpl> weak_factory_; |
279 | 282 |
280 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl); | 283 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl); |
281 }; | 284 }; |
282 | 285 |
283 } // namespace media | 286 } // namespace media |
284 | 287 |
285 #endif // MEDIA_RENDERERS_VIDEO_RENDERER_IMPL_H_ | 288 #endif // MEDIA_RENDERERS_VIDEO_RENDERER_IMPL_H_ |
OLD | NEW |