Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Side by Side Diff: media/base/pipeline_impl.h

Issue 155396: Revert "Implemented injected message loops for PipelineImpl." (Closed)
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/pipeline.h ('k') | media/base/pipeline_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008-2009 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 // Implementation of Pipeline. 5 // Implementation of Pipeline.
6 6
7 #ifndef MEDIA_BASE_PIPELINE_IMPL_H_ 7 #ifndef MEDIA_BASE_PIPELINE_IMPL_H_
8 #define MEDIA_BASE_PIPELINE_IMPL_H_ 8 #define MEDIA_BASE_PIPELINE_IMPL_H_
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 #include <set> 12 #include <set>
13 13
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/ref_counted.h" 15 #include "base/ref_counted.h"
16 #include "base/thread.h" 16 #include "base/thread.h"
17 #include "base/time.h" 17 #include "base/time.h"
18 #include "media/base/pipeline.h" 18 #include "media/base/pipeline.h"
19 19
20 namespace media { 20 namespace media {
21 21
22 class FilterHostImpl; 22 class FilterHostImpl;
23 class PipelineInternal; 23 class PipelineThread;
24 24
25 // Class which implements the Media::Pipeline contract. The majority of the 25 // Class which implements the Media::Pipeline contract. The majority of the
26 // actual code for this object lives in the PipelineInternal class, which is 26 // actual code for this object lives in the PipelineThread class, which is
27 // responsible for actually building and running the pipeline. This object 27 // responsible for actually building and running the pipeline. This object
28 // is basically a simple container for state information, and is responsible 28 // is basically a simple container for state information, and is responsible
29 // for creating and communicating with the PipelineInternal object. 29 // for creating and communicating with the PipelineThread object.
30 class PipelineImpl : public Pipeline { 30 class PipelineImpl : public Pipeline {
31 public: 31 public:
32 PipelineImpl(MessageLoop* message_loop); 32 PipelineImpl();
33 virtual ~PipelineImpl(); 33 virtual ~PipelineImpl();
34 34
35 // Pipeline implementation. 35 // Pipeline implementation.
36 virtual bool Start(FilterFactory* filter_factory, 36 virtual bool Start(FilterFactory* filter_factory,
37 const std::string& uri, 37 const std::string& uri,
38 PipelineCallback* start_callback); 38 PipelineCallback* start_callback);
39 virtual void Stop(PipelineCallback* stop_callback); 39 virtual void Stop();
40 virtual void Seek(base::TimeDelta time, PipelineCallback* seek_callback); 40 virtual void Seek(base::TimeDelta time, PipelineCallback* seek_callback);
41 virtual bool IsRunning() const;
42 virtual bool IsInitialized() const; 41 virtual bool IsInitialized() const;
43 virtual bool IsRendered(const std::string& major_mime_type) const; 42 virtual bool IsRendered(const std::string& major_mime_type) const;
44 virtual float GetPlaybackRate() const; 43 virtual float GetPlaybackRate() const;
45 virtual void SetPlaybackRate(float playback_rate); 44 virtual void SetPlaybackRate(float playback_rate);
46 virtual float GetVolume() const; 45 virtual float GetVolume() const;
47 virtual void SetVolume(float volume); 46 virtual void SetVolume(float volume);
48 virtual base::TimeDelta GetTime() const; 47 virtual base::TimeDelta GetTime() const;
49 virtual base::TimeDelta GetBufferedTime() const; 48 virtual base::TimeDelta GetBufferedTime() const;
50 virtual base::TimeDelta GetDuration() const; 49 virtual base::TimeDelta GetDuration() const;
51 virtual int64 GetBufferedBytes() const; 50 virtual int64 GetBufferedBytes() const;
52 virtual int64 GetTotalBytes() const; 51 virtual int64 GetTotalBytes() const;
53 virtual void GetVideoSize(size_t* width_out, size_t* height_out) const; 52 virtual void GetVideoSize(size_t* width_out, size_t* height_out) const;
54 virtual PipelineError GetError() const; 53 virtual PipelineError GetError() const;
55 54
56 private: 55 private:
57 friend class FilterHostImpl; 56 friend class FilterHostImpl;
58 friend class PipelineInternal; 57 friend class PipelineThread;
59 58
60 // Reset the state of the pipeline object to the initial state. This method 59 // Reset the state of the pipeline object to the initial state. This method
61 // is used by the constructor, and the Stop method. 60 // is used by the constructor, and the Stop method.
62 void ResetState(); 61 void ResetState();
63 62
64 // Used internally to make sure that the thread is in a state that is 63 // Used internally to make sure that the thread is in a state that is
65 // acceptable to post a task to. It must exist, be initialized, and there 64 // acceptable to post a task to. It must exist, be initialized, and there
66 // must not be an error. 65 // must not be an error.
67 bool IsPipelineOk() const; 66 bool IsPipelineOk() const;
68 67
68 // Returns true if we're currently executing on the pipeline thread. Mostly
69 // used in DCHECKs.
70 bool IsPipelineThread() const;
71
69 // Methods called by FilterHostImpl to update pipeline state. 72 // Methods called by FilterHostImpl to update pipeline state.
70 void SetDuration(base::TimeDelta duration); 73 void SetDuration(base::TimeDelta duration);
71 void SetBufferedTime(base::TimeDelta buffered_time); 74 void SetBufferedTime(base::TimeDelta buffered_time);
72 void SetTotalBytes(int64 total_bytes); 75 void SetTotalBytes(int64 total_bytes);
73 void SetBufferedBytes(int64 buffered_bytes); 76 void SetBufferedBytes(int64 buffered_bytes);
74 void SetVideoSize(size_t width, size_t height); 77 void SetVideoSize(size_t width, size_t height);
75 void SetTime(base::TimeDelta time); 78 void SetTime(base::TimeDelta time);
76 void InternalSetPlaybackRate(float rate); 79 void InternalSetPlaybackRate(float rate);
77 80
78 // Sets the error to the new error code only if the current error state is 81 // Sets the error to the new error code only if the current error state is
79 // PIPELINE_OK. Returns true if error set, otherwise leaves current error 82 // PIPELINE_OK. Returns true if error set, otherwise leaves current error
80 // alone, and returns false. 83 // alone, and returns false.
81 bool InternalSetError(PipelineError error); 84 bool InternalSetError(PipelineError error);
82 85
83 // Method called by the |pipeline_internal_| to insert a mime type into 86 // Method called by the |pipeline_thread_| to insert a mime type into
84 // the |rendered_mime_types_| set. 87 // the |rendered_mime_types_| set.
85 void InsertRenderedMimeType(const std::string& major_mime_type); 88 void InsertRenderedMimeType(const std::string& major_mime_type);
86 89
87 // Message loop used to execute pipeline tasks. 90 // Holds a ref counted reference to the PipelineThread object associated
88 MessageLoop* message_loop_; 91 // with this pipeline. Prior to the call to the Start method, this member
89 92 // will be NULL, since no thread is running.
90 // Holds a ref counted reference to the PipelineInternal object associated 93 scoped_refptr<PipelineThread> pipeline_thread_;
91 // with this pipeline. Prior to the call to the Start() method, this member
92 // will be NULL, since we are not running.
93 scoped_refptr<PipelineInternal> pipeline_internal_;
94 94
95 // After calling Start, if all of the required filters are created and 95 // After calling Start, if all of the required filters are created and
96 // initialized, this member will be set to true by the pipeline thread. 96 // initialized, this member will be set to true by the pipeline thread.
97 bool initialized_; 97 bool initialized_;
98 98
99 // Duration of the media in microseconds. Set by a FilterHostImpl object on 99 // Duration of the media in microseconds. Set by a FilterHostImpl object on
100 // behalf of a filter. 100 // behalf of a filter.
101 base::TimeDelta duration_; 101 base::TimeDelta duration_;
102 102
103 // Amount of available buffered data in microseconds. Set by a 103 // Amount of available buffered data in microseconds. Set by a
(...skipping 13 matching lines...) Expand all
117 117
118 // Video width and height. Set by a FilterHostImpl object on behalf 118 // Video width and height. Set by a FilterHostImpl object on behalf
119 // of a filter. The video_size_access_lock_ is used to make sure access 119 // of a filter. The video_size_access_lock_ is used to make sure access
120 // to the pair of width and height are modified or read in thread safe way. 120 // to the pair of width and height are modified or read in thread safe way.
121 size_t video_width_; 121 size_t video_width_;
122 size_t video_height_; 122 size_t video_height_;
123 123
124 // Current volume level (from 0.0f to 1.0f). The volume reflects the last 124 // Current volume level (from 0.0f to 1.0f). The volume reflects the last
125 // value the audio filter was called with SetVolume, so there will be a short 125 // value the audio filter was called with SetVolume, so there will be a short
126 // period of time between the client calling SetVolume on the pipeline and 126 // period of time between the client calling SetVolume on the pipeline and
127 // this value being updated. Set by the PipelineInternal just prior to 127 // this value being updated. Set by the PipelineThread just prior to calling
128 // calling the audio renderer. 128 // the audio renderer.
129 float volume_; 129 float volume_;
130 130
131 // Current playback rate (>= 0.0f). This member reflects the last value 131 // Current playback rate (>= 0.0f). This member reflects the last value
132 // that the filters in the pipeline were called with, so there will be a short 132 // that the filters in the pipeline were called with, so there will be a short
133 // period of time between the client calling SetPlaybackRate and this value 133 // period of time between the client calling SetPlaybackRate and this value
134 // being updated. Set by the PipelineInternal just prior to calling filters. 134 // being updated. Set by the PipelineThread just prior to calling filters.
135 float playback_rate_; 135 float playback_rate_;
136 136
137 // Current playback time. Set by a FilterHostImpl object on behalf of the 137 // Current playback time. Set by a FilterHostImpl object on behalf of the
138 // audio renderer filter. 138 // audio renderer filter.
139 base::TimeDelta time_; 139 base::TimeDelta time_;
140 140
141 // Status of the pipeline. Initialized to PIPELINE_OK which indicates that 141 // Status of the pipeline. Initialized to PIPELINE_OK which indicates that
142 // the pipeline is operating correctly. Any other value indicates that the 142 // the pipeline is operating correctly. Any other value indicates that the
143 // pipeline is stopped or is stopping. Clients can call the Stop method to 143 // pipeline is stopped or is stopping. Clients can call the Stop method to
144 // reset the pipeline state, and restore this to PIPELINE_OK. 144 // reset the pipeline state, and restore this to PIPELINE_OK.
145 PipelineError error_; 145 PipelineError error_;
146 146
147 // Vector of major mime types that have been rendered by this pipeline. 147 // Vector of major mime types that have been rendered by this pipeline.
148 typedef std::set<std::string> RenderedMimeTypesSet; 148 typedef std::set<std::string> RenderedMimeTypesSet;
149 RenderedMimeTypesSet rendered_mime_types_; 149 RenderedMimeTypesSet rendered_mime_types_;
150 150
151 DISALLOW_COPY_AND_ASSIGN(PipelineImpl); 151 DISALLOW_COPY_AND_ASSIGN(PipelineImpl);
152 }; 152 };
153 153
154 154
155 // PipelineInternal contains most of the logic involved with running the 155 // The PipelineThread contains most of the logic involved with running the
156 // media pipeline. Filters are created and called on the message loop injected 156 // media pipeline. Filters are created and called on a dedicated thread owned
157 // into this object. PipelineInternal works like a state machine to perform 157 // by this object. This object works like a state machine to perform
158 // asynchronous initialization. Initialization is done in multiple passes by 158 // asynchronous initialization. Initialization is done in multiple passes in
159 // InitializeTask(). In each pass a different filter is created and chained with 159 // StartTask(). In each pass a different filter is created and chained with a
160 // a previously created filter. 160 // previously created filter.
161 // 161 //
162 // Here's a state diagram that describes the lifetime of this object. 162 // Here's a state diagram that describes the lifetime of this object.
163 // 163 //
164 // [ *Created ] -> [ InitDataSource ] -> [ InitDemuxer ] -> 164 // [ *Created ] -> [ InitDataSource ] -> [ InitDemuxer ] ->
165 // [ InitAudioDecoder ] -> [ InitAudioRenderer ] -> 165 // [ InitAudioDecoder ] -> [ InitAudioRenderer ] ->
166 // [ InitVideoDecoder ] -> [ InitVideoRenderer ] -> [ Started ] 166 // [ InitVideoDecoder ] -> [ InitVideoRenderer ] -> [ Started ]
167 // | | | 167 // | | |
168 // .-> [ Error ] .-> [ Stopped ] <-. 168 // .-> [ Error ] .-> [ Stopped ] <-.
169 // 169 //
170 // Initialization is a series of state transitions from "Created" to 170 // Initialization is a series of state transitions from "Created" to
171 // "Started". If any error happens during initialization, this object will 171 // "Started". If any error happens during initialization, this object will
172 // transition to the "Error" state from any state. If Stop() is called during 172 // transition to the "Error" state from any state. If Stop() is called during
173 // initialization, this object will transition to "Stopped" state. 173 // initialization, this object will transition to "Stopped" state.
174 174
175 class PipelineInternal : public base::RefCountedThreadSafe<PipelineInternal> { 175 class PipelineThread : public base::RefCountedThreadSafe<PipelineThread>,
176 public MessageLoop::DestructionObserver {
176 public: 177 public:
177 // Methods called by PipelineImpl object on the client's thread. These 178 // Methods called by PipelineImpl object on the client's thread. These
178 // methods post a task to call a corresponding xxxTask() method on the 179 // methods post a task to call a corresponding xxxTask() method on the
179 // message loop. For example, Seek posts a task to call SeekTask. 180 // pipeline thread. For example, Seek posts a task to call SeekTask.
180 explicit PipelineInternal(PipelineImpl* pipeline, MessageLoop* message_loop); 181 explicit PipelineThread(PipelineImpl* pipeline);
181 182
182 // After Start() is called, a task of StartTask() is posted on the pipeline 183 // After Start() is called, a task of StartTask() is posted on the pipeline
183 // thread to perform initialization. See StartTask() to learn more about 184 // thread to perform initialization. See StartTask() to learn more about
184 // initialization. 185 // initialization.
185 void Start(FilterFactory* filter_factory, 186 bool Start(FilterFactory* filter_factory,
186 const std::string& url_media_source, 187 const std::string& url_media_source,
187 PipelineCallback* start_callback); 188 PipelineCallback* init_complete_callback);
188 void Stop(PipelineCallback* stop_callback); 189 void Stop();
189 void Seek(base::TimeDelta time, PipelineCallback* seek_callback); 190 void Seek(base::TimeDelta time, PipelineCallback* seek_callback);
190 void SetPlaybackRate(float rate); 191 void SetPlaybackRate(float rate);
191 void SetVolume(float volume); 192 void SetVolume(float volume);
192 193
193 // Methods called by a FilterHostImpl object. These methods may be called 194 // Methods called by a FilterHostImpl object. These methods may be called
194 // on any thread, either the pipeline's thread or any other. 195 // on any thread, either the pipeline's thread or any other.
195 196
196 // When a filter calls it's FilterHost, the filter host calls back to the 197 // When a filter calls it's FilterHost, the filter host calls back to the
197 // pipeline thread. If the pipeline thread is running a nested message loop 198 // pipeline thread. If the pipeline thread is running a nested message loop
198 // then it will be exited. 199 // then it will be exited.
199 void InitializationComplete(FilterHostImpl* host); 200 void InitializationComplete(FilterHostImpl* host);
200 201
201 // Sets the pipeline time and schedules a task to call back to any filters 202 // Sets the pipeline time and schedules a task to call back to any filters
202 // that have registered a time update callback. 203 // that have registered a time update callback.
203 void SetTime(base::TimeDelta time); 204 void SetTime(base::TimeDelta time);
204 205
205 // Called by a FilterHostImpl on behalf of a filter calling FilterHost::Error. 206 // Called by a FilterHostImpl on behalf of a filter calling FilterHost::Error.
206 // If the pipeline is running a nested message loop, it will be exited. 207 // If the pipeline is running a nested message loop, it will be exited.
207 void Error(PipelineError error); 208 void Error(PipelineError error);
208 209
209 // Simple accessor used by the FilterHostImpl class to get access to the 210 // Simple accessor used by the FilterHostImpl class to get access to the
210 // pipeline object. 211 // pipeline object.
211 //
212 // TODO(scherkus): I think FilterHostImpl should not be talking to
213 // PipelineImpl but rather PipelineInternal.
214 PipelineImpl* pipeline() const { return pipeline_; } 212 PipelineImpl* pipeline() const { return pipeline_; }
215 213
216 // Returns true if the pipeline has fully initialized. 214 // Accessor used to post messages to thread's message loop.
217 bool IsInitialized() { return state_ == kStarted; } 215 MessageLoop* message_loop() const { return thread_.message_loop(); }
216
217 // Accessor used by PipelineImpl to check if we're executing on the pipeline
218 // thread.
219 PlatformThreadId thread_id() const { return thread_.thread_id(); }
218 220
219 private: 221 private:
220 // Only allow ourselves to be destroyed via ref-counting. 222 // Only allow ourselves to be destroyed via ref-counting.
221 friend class base::RefCountedThreadSafe<PipelineInternal>; 223 friend class base::RefCountedThreadSafe<PipelineThread>;
222 virtual ~PipelineInternal(); 224 virtual ~PipelineThread();
223 225
224 enum State { 226 enum State {
225 kCreated, 227 kCreated,
226 kInitDataSource, 228 kInitDataSource,
227 kInitDemuxer, 229 kInitDemuxer,
228 kInitAudioDecoder, 230 kInitAudioDecoder,
229 kInitAudioRenderer, 231 kInitAudioRenderer,
230 kInitVideoDecoder, 232 kInitVideoDecoder,
231 kInitVideoRenderer, 233 kInitVideoRenderer,
232 kStarted, 234 kStarted,
233 kStopped, 235 kStopped,
234 kError, 236 kError,
235 }; 237 };
236 238
237 // Simple method used to make sure the pipeline is running normally. 239 // Simple method used to make sure the pipeline is running normally.
238 bool IsPipelineOk() { return PIPELINE_OK == pipeline_->error_; } 240 bool IsPipelineOk() { return PIPELINE_OK == pipeline_->error_; }
239 241
240 // Helper method to tell whether we are in the state of initializing. 242 // Helper method to tell whether we are in the state of initializing.
241 bool IsPipelineInitializing() { 243 bool IsPipelineInitializing() {
242 return state_ == kInitDataSource || 244 return state_ == kInitDataSource ||
243 state_ == kInitDemuxer || 245 state_ == kInitDemuxer ||
244 state_ == kInitAudioDecoder || 246 state_ == kInitAudioDecoder ||
245 state_ == kInitAudioRenderer || 247 state_ == kInitAudioRenderer ||
246 state_ == kInitVideoDecoder || 248 state_ == kInitVideoDecoder ||
247 state_ == kInitVideoRenderer; 249 state_ == kInitVideoRenderer;
248 } 250 }
249 251
252 // Implementation of MessageLoop::DestructionObserver. StartTask registers
253 // this class as a destruction observer on the thread's message loop.
254 // It is used to destroy the list of FilterHosts
255 // (and thus destroy the associated filters) when all tasks have been
256 // processed and the message loop has been quit.
257 virtual void WillDestroyCurrentMessageLoop();
258
250 // The following "task" methods correspond to the public methods, but these 259 // The following "task" methods correspond to the public methods, but these
251 // methods are run as the result of posting a task to the PipelineInternal's 260 // methods are run as the result of posting a task to the PipelineThread's
252 // message loop. 261 // message loop.
253 void StartTask(FilterFactory* filter_factory,
254 const std::string& url,
255 PipelineCallback* start_callback);
256 262
257 // InitializeTask() performs initialization in multiple passes. It is executed 263 // StartTask() is a special task that performs initialization in multiple
258 // as a result of calling Start() or InitializationComplete() that advances 264 // passes. It is executed as a result of calling Start() or
259 // initialization to the next state. It works as a hub of state transition for 265 // InitializationComplete() that advances initialization to the next state. It
260 // initialization. 266 // works as a hub of state transition for initialization.
261 void InitializeTask(); 267 void StartTask();
262 268 void StopTask();
263 // StopTask() and ErrorTask() are similar but serve different purposes:
264 // - Both destroy the filter chain.
265 // - Both will execute |start_callback| if the pipeline was initializing.
266 // - StopTask() resets the pipeline to a fresh state, where as ErrorTask()
267 // leaves the pipeline as is for client inspection.
268 // - StopTask() can be scheduled by the client calling Stop(), where as
269 // ErrorTask() is scheduled as a result of a filter calling Error().
270 void StopTask(PipelineCallback* stop_callback);
271 void ErrorTask(PipelineError error);
272
273 void SetPlaybackRateTask(float rate); 269 void SetPlaybackRateTask(float rate);
274 void SeekTask(base::TimeDelta time, PipelineCallback* seek_callback); 270 void SeekTask(base::TimeDelta time, PipelineCallback* seek_callback);
275 void SetVolumeTask(float volume); 271 void SetVolumeTask(float volume);
276 272
277 // Internal methods used in the implementation of the pipeline thread. All 273 // Internal methods used in the implementation of the pipeline thread. All
278 // of these methods are only called on the pipeline thread. 274 // of these methods are only called on the pipeline thread.
279 275
280 // The following template functions make use of the fact that media filter 276 // The following template functions make use of the fact that media filter
281 // derived interfaces are self-describing in the sense that they all contain 277 // derived interfaces are self-describing in the sense that they all contain
282 // the static method filter_type() which returns a FilterType enum that 278 // the static method filter_type() which returns a FilterType enum that
(...skipping 16 matching lines...) Expand all
299 // Callers can optionally use the returned Filter for further processing, 295 // Callers can optionally use the returned Filter for further processing,
300 // but since the call already placed the filter in the list of filter hosts, 296 // but since the call already placed the filter in the list of filter hosts,
301 // callers can ignore the return value. In any case, if this function can 297 // callers can ignore the return value. In any case, if this function can
302 // not create and initializes the specified Filter, then this method will 298 // not create and initializes the specified Filter, then this method will
303 // return with |pipeline_->error_| != PIPELINE_OK. 299 // return with |pipeline_->error_| != PIPELINE_OK.
304 template <class Filter, class Source> 300 template <class Filter, class Source>
305 void CreateFilter(FilterFactory* filter_factory, 301 void CreateFilter(FilterFactory* filter_factory,
306 Source source, 302 Source source,
307 const MediaFormat& source_media_format); 303 const MediaFormat& source_media_format);
308 304
309 // Creates a Filter and initializes it with the given |source|. If a Filter 305 // Creates a Filter and initilizes it with the given |source|. If a Filter
310 // could not be created or an error occurred, this method returns NULL and the 306 // could not be created or an error occurred, this metod returns NULL and the
311 // pipeline's |error_| member will contain a specific error code. Note that 307 // pipeline's |error_| member will contain a specific error code. Note that
312 // the Source could be a filter or a DemuxerStream, but it must support the 308 // the Source could be a filter or a DemuxerStream, but it must support the
313 // GetMediaFormat() method. 309 // GetMediaFormat() method.
314 template <class Filter, class Source> 310 template <class Filter, class Source>
315 void CreateFilter(FilterFactory* filter_factory, Source* source) { 311 void CreateFilter(FilterFactory* filter_factory, Source* source) {
316 CreateFilter<Filter, Source*>(filter_factory, 312 CreateFilter<Filter, Source*>(filter_factory,
317 source, 313 source,
318 source->media_format()); 314 source->media_format());
319 } 315 }
320 316
(...skipping 15 matching lines...) Expand all
336 // stream does not exist. 332 // stream does not exist.
337 template <class Decoder, class Renderer> 333 template <class Decoder, class Renderer>
338 bool CreateRenderer(); 334 bool CreateRenderer();
339 335
340 // Examine the list of existing filters to find one that supports the 336 // Examine the list of existing filters to find one that supports the
341 // specified Filter interface. If one exists, the |filter_out| will contain 337 // specified Filter interface. If one exists, the |filter_out| will contain
342 // the filter, |*filter_out| will be NULL. 338 // the filter, |*filter_out| will be NULL.
343 template <class Filter> 339 template <class Filter>
344 void GetFilter(scoped_refptr<Filter>* filter_out) const; 340 void GetFilter(scoped_refptr<Filter>* filter_out) const;
345 341
346 // Stops every filters, filter host and filter thread and releases all 342 // Pointer to the pipeline that owns this PipelineThread.
347 // references to them. 343 PipelineImpl* const pipeline_;
348 void DestroyFilters();
349 344
350 // Pointer to the pipeline that owns this PipelineInternal. 345 // The actual thread.
351 PipelineImpl* pipeline_; 346 base::Thread thread_;
352 347
353 // Message loop used to execute pipeline tasks. 348 // Used to avoid scheduling multiple time update tasks. If this member is
354 MessageLoop* message_loop_; 349 // true then a task that will call the SetTimeTask() method is in the message
350 // loop's queue.
351 bool time_update_callback_scheduled_;
355 352
356 // Member that tracks the current state. 353 // Member that tracks the current state.
357 State state_; 354 State state_;
358 355
359 // Filter factory as passed in by Start(). 356 // Filter factory as passed in by Start().
360 scoped_refptr<FilterFactory> filter_factory_; 357 scoped_refptr<FilterFactory> filter_factory_;
361 358
362 // URL for the data source as passed in by Start(). 359 // URL for the data source as passed in by Start().
363 std::string url_; 360 std::string url_;
364 361
365 // Callbacks for various pipeline operations. 362 // Initialization callback as passed in by Start().
366 scoped_ptr<PipelineCallback> start_callback_; 363 scoped_ptr<PipelineCallback> init_callback_;
367 scoped_ptr<PipelineCallback> seek_callback_;
368 scoped_ptr<PipelineCallback> stop_callback_;
369 364
370 // Vector of FilterHostImpl objects that contain the filters for the pipeline. 365 // Vector of FilterHostImpl objects that contian the filters for the pipeline.
371 typedef std::vector<FilterHostImpl*> FilterHostVector; 366 typedef std::vector<FilterHostImpl*> FilterHostVector;
372 FilterHostVector filter_hosts_; 367 FilterHostVector filter_hosts_;
373 368
374 typedef std::vector<base::Thread*> FilterThreadVector; 369 typedef std::vector<base::Thread*> FilterThreadVector;
375 FilterThreadVector filter_threads_; 370 FilterThreadVector filter_threads_;
376 371
377 DISALLOW_COPY_AND_ASSIGN(PipelineInternal); 372 DISALLOW_COPY_AND_ASSIGN(PipelineThread);
378 }; 373 };
379 374
380 } // namespace media 375 } // namespace media
381 376
382 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ 377 #endif // MEDIA_BASE_PIPELINE_IMPL_H_
OLDNEW
« no previous file with comments | « media/base/pipeline.h ('k') | media/base/pipeline_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698