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_FILTERS_RENDERER_IMPL_H_ | 5 #ifndef MEDIA_FILTERS_RENDERER_IMPL_H_ |
6 #define MEDIA_FILTERS_RENDERER_IMPL_H_ | 6 #define MEDIA_FILTERS_RENDERER_IMPL_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "base/time/clock.h" | 12 #include "base/time/clock.h" |
13 #include "base/time/default_tick_clock.h" | 13 #include "base/time/default_tick_clock.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "media/base/buffering_state.h" | 15 #include "media/base/buffering_state.h" |
16 #include "media/base/media_export.h" | 16 #include "media/base/media_export.h" |
17 #include "media/base/pipeline_status.h" | 17 #include "media/base/pipeline_status.h" |
18 #include "media/base/renderer.h" | 18 #include "media/base/renderer.h" |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class SingleThreadTaskRunner; | 21 class SingleThreadTaskRunner; |
22 } | 22 } |
23 | 23 |
24 namespace media { | 24 namespace media { |
25 | 25 |
26 class AudioRenderer; | 26 class AudioRenderer; |
27 class Demuxer; | 27 class Demuxer; |
28 class FilterCollection; | |
29 class TimeDeltaInterpolator; | 28 class TimeDeltaInterpolator; |
30 class TimeSource; | 29 class TimeSource; |
31 class VideoRenderer; | 30 class VideoRenderer; |
32 | 31 |
33 class MEDIA_EXPORT RendererImpl : public Renderer { | 32 class MEDIA_EXPORT RendererImpl : public Renderer { |
34 public: | 33 public: |
35 // Renders audio/video streams in |demuxer| using |audio_renderer| and | 34 // Renders audio/video streams in |demuxer| using |audio_renderer| and |
36 // |video_renderer| provided. All methods except for GetMediaTime() run on the | 35 // |video_renderer| provided. All methods except for GetMediaTime() run on the |
37 // |task_runner|. GetMediaTime() runs on the render main thread because it's | 36 // |task_runner|. GetMediaTime() runs on the render main thread because it's |
38 // part of JS sync API. |get_duration_cb| is used to get the duration of the | 37 // part of JS sync API. |get_duration_cb| is used to get the duration of the |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // Callback executed when a runtime error happens. | 121 // Callback executed when a runtime error happens. |
123 void OnError(PipelineStatus error); | 122 void OnError(PipelineStatus error); |
124 | 123 |
125 void FireAllPendingCallbacks(); | 124 void FireAllPendingCallbacks(); |
126 | 125 |
127 State state_; | 126 State state_; |
128 | 127 |
129 // Task runner used to execute pipeline tasks. | 128 // Task runner used to execute pipeline tasks. |
130 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 129 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
131 | 130 |
132 scoped_ptr<FilterCollection> filter_collection_; | |
133 Demuxer* demuxer_; | 131 Demuxer* demuxer_; |
134 | 132 |
135 // Permanent callback to get the media duration. | 133 // Permanent callback to get the media duration. |
136 TimeDeltaCB get_duration_cb_; | 134 TimeDeltaCB get_duration_cb_; |
137 | 135 |
138 // Permanent callbacks to notify various renderer states/stats. | 136 // Permanent callbacks to notify various renderer states/stats. |
139 StatisticsCB statistics_cb_; | 137 StatisticsCB statistics_cb_; |
140 base::Closure ended_cb_; | 138 base::Closure ended_cb_; |
141 PipelineStatusCB error_cb_; | 139 PipelineStatusCB error_cb_; |
142 BufferingStateCB buffering_state_cb_; | 140 BufferingStateCB buffering_state_cb_; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // NOTE: Weak pointers must be invalidated before all other member variables. | 190 // NOTE: Weak pointers must be invalidated before all other member variables. |
193 base::WeakPtrFactory<RendererImpl> weak_factory_; | 191 base::WeakPtrFactory<RendererImpl> weak_factory_; |
194 base::WeakPtr<RendererImpl> weak_this_; | 192 base::WeakPtr<RendererImpl> weak_this_; |
195 | 193 |
196 DISALLOW_COPY_AND_ASSIGN(RendererImpl); | 194 DISALLOW_COPY_AND_ASSIGN(RendererImpl); |
197 }; | 195 }; |
198 | 196 |
199 } // namespace media | 197 } // namespace media |
200 | 198 |
201 #endif // MEDIA_FILTERS_RENDERER_IMPL_H_ | 199 #endif // MEDIA_FILTERS_RENDERER_IMPL_H_ |
OLD | NEW |