OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_RENDERER_IMPL_H_ | 5 #ifndef MEDIA_RENDERERS_RENDERER_IMPL_H_ |
6 #define MEDIA_RENDERERS_RENDERER_IMPL_H_ | 6 #define MEDIA_RENDERERS_RENDERER_IMPL_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/cancelable_callback.h" | 11 #include "base/cancelable_callback.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "base/time/clock.h" | 16 #include "base/time/clock.h" |
17 #include "base/time/default_tick_clock.h" | 17 #include "base/time/default_tick_clock.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "media/base/buffering_state.h" | 19 #include "media/base/buffering_state.h" |
20 #include "media/base/decryptor.h" | 20 #include "media/base/decryptor.h" |
21 #include "media/base/media_export.h" | 21 #include "media/base/media_export.h" |
22 #include "media/base/pipeline_status.h" | 22 #include "media/base/pipeline_status.h" |
23 #include "media/base/renderer.h" | 23 #include "media/base/renderer.h" |
(...skipping 10 matching lines...) Expand all Loading... |
34 class VideoRenderer; | 34 class VideoRenderer; |
35 class WallClockTimeSource; | 35 class WallClockTimeSource; |
36 | 36 |
37 class MEDIA_EXPORT RendererImpl : public Renderer { | 37 class MEDIA_EXPORT RendererImpl : public Renderer { |
38 public: | 38 public: |
39 // Renders audio/video streams using |audio_renderer| and |video_renderer| | 39 // Renders audio/video streams using |audio_renderer| and |video_renderer| |
40 // provided. All methods except for GetMediaTime() run on the |task_runner|. | 40 // provided. All methods except for GetMediaTime() run on the |task_runner|. |
41 // GetMediaTime() runs on the render main thread because it's part of JS sync | 41 // GetMediaTime() runs on the render main thread because it's part of JS sync |
42 // API. | 42 // API. |
43 RendererImpl(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 43 RendererImpl(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
44 scoped_ptr<AudioRenderer> audio_renderer, | 44 std::unique_ptr<AudioRenderer> audio_renderer, |
45 scoped_ptr<VideoRenderer> video_renderer); | 45 std::unique_ptr<VideoRenderer> video_renderer); |
46 | 46 |
47 ~RendererImpl() final; | 47 ~RendererImpl() final; |
48 | 48 |
49 // Renderer implementation. | 49 // Renderer implementation. |
50 void Initialize(DemuxerStreamProvider* demuxer_stream_provider, | 50 void Initialize(DemuxerStreamProvider* demuxer_stream_provider, |
51 const PipelineStatusCB& init_cb, | 51 const PipelineStatusCB& init_cb, |
52 const StatisticsCB& statistics_cb, | 52 const StatisticsCB& statistics_cb, |
53 const BufferingStateCB& buffering_state_cb, | 53 const BufferingStateCB& buffering_state_cb, |
54 const base::Closure& ended_cb, | 54 const base::Closure& ended_cb, |
55 const PipelineStatusCB& error_cb, | 55 const PipelineStatusCB& error_cb, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 StatisticsCB statistics_cb_; | 141 StatisticsCB statistics_cb_; |
142 base::Closure ended_cb_; | 142 base::Closure ended_cb_; |
143 PipelineStatusCB error_cb_; | 143 PipelineStatusCB error_cb_; |
144 BufferingStateCB buffering_state_cb_; | 144 BufferingStateCB buffering_state_cb_; |
145 base::Closure waiting_for_decryption_key_cb_; | 145 base::Closure waiting_for_decryption_key_cb_; |
146 | 146 |
147 // Temporary callback used for Initialize() and Flush(). | 147 // Temporary callback used for Initialize() and Flush(). |
148 PipelineStatusCB init_cb_; | 148 PipelineStatusCB init_cb_; |
149 base::Closure flush_cb_; | 149 base::Closure flush_cb_; |
150 | 150 |
151 scoped_ptr<AudioRenderer> audio_renderer_; | 151 std::unique_ptr<AudioRenderer> audio_renderer_; |
152 scoped_ptr<VideoRenderer> video_renderer_; | 152 std::unique_ptr<VideoRenderer> video_renderer_; |
153 | 153 |
154 // Renderer-provided time source used to control playback. | 154 // Renderer-provided time source used to control playback. |
155 TimeSource* time_source_; | 155 TimeSource* time_source_; |
156 scoped_ptr<WallClockTimeSource> wall_clock_time_source_; | 156 std::unique_ptr<WallClockTimeSource> wall_clock_time_source_; |
157 bool time_ticking_; | 157 bool time_ticking_; |
158 double playback_rate_; | 158 double playback_rate_; |
159 | 159 |
160 // The time to start playback from after starting/seeking has completed. | 160 // The time to start playback from after starting/seeking has completed. |
161 base::TimeDelta start_time_; | 161 base::TimeDelta start_time_; |
162 | 162 |
163 BufferingState audio_buffering_state_; | 163 BufferingState audio_buffering_state_; |
164 BufferingState video_buffering_state_; | 164 BufferingState video_buffering_state_; |
165 | 165 |
166 // Whether we've received the audio/video ended events. | 166 // Whether we've received the audio/video ended events. |
(...skipping 15 matching lines...) Expand all Loading... |
182 | 182 |
183 base::WeakPtr<RendererImpl> weak_this_; | 183 base::WeakPtr<RendererImpl> weak_this_; |
184 base::WeakPtrFactory<RendererImpl> weak_factory_; | 184 base::WeakPtrFactory<RendererImpl> weak_factory_; |
185 | 185 |
186 DISALLOW_COPY_AND_ASSIGN(RendererImpl); | 186 DISALLOW_COPY_AND_ASSIGN(RendererImpl); |
187 }; | 187 }; |
188 | 188 |
189 } // namespace media | 189 } // namespace media |
190 | 190 |
191 #endif // MEDIA_RENDERERS_RENDERER_IMPL_H_ | 191 #endif // MEDIA_RENDERERS_RENDERER_IMPL_H_ |
OLD | NEW |