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

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

Issue 10828045: Rewrite media::Pipeline state transition machinery. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: stuff Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BASE_PIPELINE_H_ 5 #ifndef MEDIA_BASE_PIPELINE_H_
6 #define MEDIA_BASE_PIPELINE_H_ 6 #define MEDIA_BASE_PIPELINE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 void Notify(media::PipelineStatus status); 53 void Notify(media::PipelineStatus status);
54 54
55 base::Lock lock_; 55 base::Lock lock_;
56 base::ConditionVariable cv_; 56 base::ConditionVariable cv_;
57 media::PipelineStatus status_; 57 media::PipelineStatus status_;
58 bool notified_; 58 bool notified_;
59 59
60 DISALLOW_COPY_AND_ASSIGN(PipelineStatusNotification); 60 DISALLOW_COPY_AND_ASSIGN(PipelineStatusNotification);
61 }; 61 };
62 62
63 // Pipeline runs the media pipeline. Filters are created and called on the 63 // Pipeline runs the media pipeline. Filters are created and called on the
Ami GONE FROM CHROMIUM 2012/07/30 04:06:21 The sentence starting with "Filters" is a lie. IWB
64 // message loop injected into this object. Pipeline works like a state 64 // message loop injected into this object. Pipeline works like a state
65 // machine to perform asynchronous initialization, pausing, seeking and playing. 65 // machine to perform asynchronous initialization, pausing, seeking and playing.
66 // 66 //
67 // Here's a state diagram that describes the lifetime of this object. 67 // kCreated (from any state)
68 // 68 // | Start() | Stop()/SetError()
69 // [ *Created ] [ Stopped ] 69 // V V
70 // | Start() ^ 70 // kInitXXX (for each component) kStopping
71 // V SetError() | 71 // | |
72 // [ InitXXX (for each filter) ] -------->[ Stopping (for each filter) ] 72 // V V
73 // | ^ 73 // kSeeking <-------------. kStopped
74 // V | if Stop 74 // | |
75 // [ Seeking (for each filter) ] <--------[ Flushing (for each filter) ] 75 // V |
76 // | if Seek ^ 76 // kStarting kFlushing
77 // V | 77 // | ^
78 // [ Starting (for each filter) ] | 78 // V Seek() |
79 // | | 79 // kStarted ---------> kPausing
Ami GONE FROM CHROMIUM 2012/07/30 04:06:21 The fact that most states have a single ingress ed
80 // V Seek()/Stop() |
81 // [ Started ] -------------------------> [ Pausing (for each filter) ]
82 // | ^
83 // | OnRendererEnded() Seek()/Stop() |
84 // `-------------> [ Ended ] ---------------------'
85 // ^ SetError()
86 // |
87 // [ Any State Other Than InitXXX ]
88
89 // 80 //
90 // Initialization is a series of state transitions from "Created" through each 81 // Initialization is a series of state transitions from "Created" through each
91 // filter initialization state. When all filter initialization states have 82 // filter initialization state. When all filter initialization states have
92 // completed, we are implicitly in a "Paused" state. At that point we simulate 83 // completed, we are implicitly in a "Paused" state. At that point we simulate
93 // a Seek() to the beginning of the media to give filters a chance to preroll. 84 // a Seek() to the beginning of the media to give filters a chance to preroll.
94 // From then on the normal Seek() transitions are carried out and we start 85 // From then on the normal Seek() transitions are carried out and we start
95 // playing the media. 86 // playing the media.
96 // 87 //
97 // If any error ever happens, this object will transition to the "Error" state 88 // If Stop() is invoked or an error occurs during any point in time, the
98 // from any state. If Stop() is ever called, this object will transition to 89 // pipeline will transition to a stopped state.
Ami GONE FROM CHROMIUM 2012/07/30 04:06:21 s/stopped/(terminal) stopped/
99 // "Stopped" state.
100 class MEDIA_EXPORT Pipeline 90 class MEDIA_EXPORT Pipeline
101 : public base::RefCountedThreadSafe<Pipeline>, 91 : public base::RefCountedThreadSafe<Pipeline>,
102 public DemuxerHost { 92 public DemuxerHost {
103 public: 93 public:
104 // Constructs a media pipeline that will execute on |message_loop|. 94 // Constructs a media pipeline that will execute on |message_loop|.
105 Pipeline(MessageLoop* message_loop, MediaLog* media_log); 95 Pipeline(MessageLoop* message_loop, MediaLog* media_log);
106 96
107 // Build a pipeline to using the given filter collection to construct a filter 97 // Build a pipeline to using the given filter collection to construct a filter
108 // chain. 98 // chain.
109 // 99 //
110 // Pipeline initialization is an inherently asynchronous process. Clients can
111 // either poll the IsInitialized() method (discouraged) or optionally pass in
112 // |start_cb|, which will be executed when initialization completes.
113 //
114 // The following permanent callbacks will be executed as follows: 100 // The following permanent callbacks will be executed as follows:
115 // |start_cb_| will be executed when Start is done (successfully or not). 101 // |start_cb_| will be executed when Start is done (successfully or not).
116 // |ended_cb| will be executed whenever the media reaches the end. 102 // |ended_cb| will be executed whenever the media reaches the end.
117 // |error_cb_| will be executed whenever an error occurs but hasn't 103 // |error_cb_| will be executed whenever an error occurs but hasn't
118 // been reported already through another callback. 104 // been reported already through another callback.
119 // 105 //
120 // These callbacks are only executed after Start() has been called and until 106 // These callbacks are only executed after Start() has been called and until
121 // Stop() has completed. 107 // Stop() has completed.
122 // 108 //
123 // It is an error to call this method after the pipeline has already started. 109 // It is an error to call this method after the pipeline has already started.
124 //
125 // TODO(scherkus): remove IsInitialized() and force clients to use callbacks.
126 void Start(scoped_ptr<FilterCollection> filter_collection, 110 void Start(scoped_ptr<FilterCollection> filter_collection,
127 const PipelineStatusCB& ended_cb, 111 const PipelineStatusCB& ended_cb,
128 const PipelineStatusCB& error_cb, 112 const PipelineStatusCB& error_cb,
129 const PipelineStatusCB& start_cb); 113 const PipelineStatusCB& start_cb);
130 114
131 // Asynchronously stops the pipeline and resets it to an uninitialized state. 115 // Asynchronously stops the pipeline and resets it to an uninitialized state.
132 // 116 //
133 // If provided, |stop_cb| will be executed when the pipeline has been 117 // If provided, |stop_cb| will be executed when the pipeline has been
134 // completely torn down and reset to an uninitialized state. It is acceptable 118 // completely torn down and reset to an uninitialized state. It is acceptable
135 // to call Start() again once the callback has finished executing. 119 // to call Start() again once the callback has finished executing.
(...skipping 14 matching lines...) Expand all
150 // succeeded. 134 // succeeded.
151 // 135 //
152 // It is an error to call this method if the pipeline has not started. 136 // It is an error to call this method if the pipeline has not started.
153 void Seek(base::TimeDelta time, const PipelineStatusCB& seek_cb); 137 void Seek(base::TimeDelta time, const PipelineStatusCB& seek_cb);
154 138
155 // Returns true if the pipeline has been started via Start(). If IsRunning() 139 // Returns true if the pipeline has been started via Start(). If IsRunning()
156 // returns true, it is expected that Stop() will be called before destroying 140 // returns true, it is expected that Stop() will be called before destroying
157 // the pipeline. 141 // the pipeline.
158 bool IsRunning() const; 142 bool IsRunning() const;
159 143
160 // Returns true if the pipeline has been started and fully initialized to a
Ami GONE FROM CHROMIUM 2012/07/30 04:06:21 hawt!
161 // point where playback controls will be respected. Note that it is possible
162 // for a pipeline to be started but not initialized (i.e., an error occurred).
163 bool IsInitialized() const;
164
165 // Returns true if the media has audio. 144 // Returns true if the media has audio.
166 bool HasAudio() const; 145 bool HasAudio() const;
167 146
168 // Returns true if the media has video. 147 // Returns true if the media has video.
169 bool HasVideo() const; 148 bool HasVideo() const;
170 149
171 // Gets the current playback rate of the pipeline. When the pipeline is 150 // Gets the current playback rate of the pipeline. When the pipeline is
172 // started, the playback rate will be 0.0f. A rate of 1.0f indicates 151 // started, the playback rate will be 0.0f. A rate of 1.0f indicates
173 // that the pipeline is rendering the media at the standard rate. Valid 152 // that the pipeline is rendering the media at the standard rate. Valid
174 // values for playback rate are >= 0.0f. 153 // values for playback rate are >= 0.0f.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 void GetNaturalVideoSize(gfx::Size* out_size) const; 191 void GetNaturalVideoSize(gfx::Size* out_size) const;
213 192
214 // Return true if loading progress has been made since the last time this 193 // Return true if loading progress has been made since the last time this
215 // method was called. 194 // method was called.
216 bool DidLoadingProgress() const; 195 bool DidLoadingProgress() const;
217 196
218 // Gets the current pipeline statistics. 197 // Gets the current pipeline statistics.
219 PipelineStatistics GetStatistics() const; 198 PipelineStatistics GetStatistics() const;
220 199
221 void SetClockForTesting(Clock* clock); 200 void SetClockForTesting(Clock* clock);
201 void SetErrorForTesting(PipelineStatus status);
222 202
223 private: 203 private:
224 FRIEND_TEST_ALL_PREFIXES(PipelineTest, GetBufferedTimeRanges); 204 FRIEND_TEST_ALL_PREFIXES(PipelineTest, GetBufferedTimeRanges);
225 FRIEND_TEST_ALL_PREFIXES(PipelineTest, DisableAudioRenderer); 205 FRIEND_TEST_ALL_PREFIXES(PipelineTest, DisableAudioRenderer);
226 FRIEND_TEST_ALL_PREFIXES(PipelineTest, DisableAudioRendererDuringInit); 206 FRIEND_TEST_ALL_PREFIXES(PipelineTest, DisableAudioRendererDuringInit);
227 FRIEND_TEST_ALL_PREFIXES(PipelineTest, EndedCallback); 207 FRIEND_TEST_ALL_PREFIXES(PipelineTest, EndedCallback);
228 FRIEND_TEST_ALL_PREFIXES(PipelineTest, AudioStreamShorterThanVideo); 208 FRIEND_TEST_ALL_PREFIXES(PipelineTest, AudioStreamShorterThanVideo);
229 friend class MediaLog; 209 friend class MediaLog;
230 210
231 // Only allow ourselves to be deleted by reference counting. 211 // Only allow ourselves to be deleted by reference counting.
232 friend class base::RefCountedThreadSafe<Pipeline>; 212 friend class base::RefCountedThreadSafe<Pipeline>;
233 virtual ~Pipeline(); 213 virtual ~Pipeline();
234 214
235 // Pipeline states, as described above. 215 // Pipeline states, as described above.
236 enum State { 216 enum State {
237 kCreated, 217 kCreated,
238 kInitDemuxer, 218 kInitDemuxer,
239 kInitAudioDecoder, 219 kInitAudioDecoder,
240 kInitAudioRenderer, 220 kInitAudioRenderer,
241 kInitVideoDecoder, 221 kInitVideoDecoder,
242 kInitVideoRenderer, 222 kInitVideoRenderer,
243 kPausing, 223 kPausing,
224 kFlushing,
244 kSeeking, 225 kSeeking,
245 kFlushing,
246 kStarting, 226 kStarting,
247 kStarted, 227 kStarted,
248 kEnded,
scherkus (not reviewing) 2012/07/28 02:26:07 kEnded wasn't actually used so it's been folded in
249 kStopping, 228 kStopping,
250 kStopped, 229 kStopped,
251 kError,
scherkus (not reviewing) 2012/07/28 02:26:07 kError has been replaced by kStopped && status_ !=
252 }; 230 };
253 231
254 // Reset the state of the pipeline object to the initial state. This method
255 // is used by the constructor, and the Stop() method.
256 void ResetState();
scherkus (not reviewing) 2012/07/28 02:26:07 This was only called via Stop() path but not SetEr
257
258 // Updates |state_|. All state transitions should use this call. 232 // Updates |state_|. All state transitions should use this call.
259 void SetState(State next_state); 233 void SetState(State next_state);
260 234
261 // Simple method used to make sure the pipeline is running normally. 235 // Simple method used to make sure the pipeline is running normally.
262 bool IsPipelineOk(); 236 bool IsPipelineOk();
263 237
264 // Helper method to tell whether we are stopped or in error. 238 // Returns true if an asynchronous operation is under way that will result in
265 bool IsPipelineStopped(); 239 // calling DoStateTransition().
240 bool IsTransitioning();
266 241
267 // Helper method to tell whether we are in transition to stop state. 242 // Completes the state transition for the current state, taking into account
268 bool IsPipelineTearingDown(); 243 // any errors that may have occured.
269 244 void OnStateTransition(PipelineStatus status);
270 // We could also be delayed by a transition during seek is performed. 245 void DoStateTransition(PipelineStatus status);
Ami GONE FROM CHROMIUM 2012/07/30 04:06:21 These names are not sufficiently self-explanatory
271 bool IsPipelineStopPending();
272
273 // Helper method to tell whether we are in transition to seek state.
274 bool IsPipelineSeeking();
275
276 // Helper method to execute callback from Start() and reset
277 // |filter_collection_|. Called when initialization completes
278 // normally or when pipeline is stopped or error occurs during
279 // initialization.
280 void FinishInitialization();
281
282 // Returns true if the given state is one that transitions to a new state
283 // after iterating through each filter.
284 static bool TransientState(State state);
285
286 // Given the current state, returns the next state.
287 State FindNextState(State current);
288 246
289 // DataSourceHost (by way of DemuxerHost) implementation. 247 // DataSourceHost (by way of DemuxerHost) implementation.
290 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE; 248 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE;
291 virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE; 249 virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE;
292 virtual void AddBufferedTimeRange(base::TimeDelta start, 250 virtual void AddBufferedTimeRange(base::TimeDelta start,
293 base::TimeDelta end) OVERRIDE; 251 base::TimeDelta end) OVERRIDE;
294 252
295 // DemuxerHost implementaion. 253 // DemuxerHost implementaion.
296 virtual void SetDuration(base::TimeDelta duration) OVERRIDE; 254 virtual void SetDuration(base::TimeDelta duration) OVERRIDE;
297 virtual void OnDemuxerError(PipelineStatus error) OVERRIDE; 255 virtual void OnDemuxerError(PipelineStatus error) OVERRIDE;
298 256
299 // Initiates teardown sequence in response to a runtime error. 257 // Initiates teardown sequence in response to a runtime error.
300 // 258 //
301 // Safe to call from any thread. 259 // Safe to call from any thread.
302 void SetError(PipelineStatus error); 260 void SetError(PipelineStatus error);
303 261
304 // Callback executed when the natural size of the video has changed. 262 // Callback executed when the natural size of the video has changed.
305 void OnNaturalVideoSizeChanged(const gfx::Size& size); 263 void OnNaturalVideoSizeChanged(const gfx::Size& size);
306 264
307 // Callback executed when either of the renderers have ended. 265 // Callback executed when either of the renderers have ended.
308 void OnRendererEnded(); 266 void OnRendererEnded();
309 267
310 // Callbacks executed by filters upon completing initialization.
311 void OnFilterInitialize(PipelineStatus status);
312
313 // Callback executed by filters upon completing Play(), Pause(), or Stop().
314 void OnFilterStateTransition();
315
316 // Callback executed by filters upon completing Seek().
317 void OnFilterStateTransitionWithStatus(PipelineStatus status);
318
319 // Callback executed by filters when completing teardown operations.
320 void OnTeardownStateTransition();
321
322 // Callback executed by filters to update statistics. 268 // Callback executed by filters to update statistics.
323 void OnUpdateStatistics(const PipelineStatistics& stats); 269 void OnUpdateStatistics(const PipelineStatistics& stats);
324 270
325 // Callback executed by audio renderer when it has been disabled. 271 // Callback executed by audio renderer when it has been disabled.
326 void OnAudioDisabled(); 272 void OnAudioDisabled();
327 273
328 // Callback executed by audio renderer to update clock time. 274 // Callback executed by audio renderer to update clock time.
329 void OnAudioTimeUpdate(base::TimeDelta time, base::TimeDelta max_time); 275 void OnAudioTimeUpdate(base::TimeDelta time, base::TimeDelta max_time);
330 276
331 // Callback executed by video renderer to update clock time. 277 // Callback executed by video renderer to update clock time.
(...skipping 29 matching lines...) Expand all
361 307
362 // Carries out notifying filters that we are seeking to a new timestamp. 308 // Carries out notifying filters that we are seeking to a new timestamp.
363 void SeekTask(base::TimeDelta time, const PipelineStatusCB& seek_cb); 309 void SeekTask(base::TimeDelta time, const PipelineStatusCB& seek_cb);
364 310
365 // Carries out handling a notification from a renderer that it has ended. 311 // Carries out handling a notification from a renderer that it has ended.
366 void OnRendererEndedTask(); 312 void OnRendererEndedTask();
367 313
368 // Carries out disabling the audio renderer. 314 // Carries out disabling the audio renderer.
369 void AudioDisabledTask(); 315 void AudioDisabledTask();
370 316
371 // Carries out advancing to the next filter during Play()/Pause()/Seek(). 317 // Initiates asynchronous initialization for each media object, executing
372 void FilterStateTransitionTask(); 318 // |done_cb| when completed.
373 319 void DoInitDemuxer(const PipelineStatusCB& done_cb);
374 // Carries out advancing to the next teardown operation. 320 void DoInitAudioDecoder(const PipelineStatusCB& done_cb);
375 void TeardownStateTransitionTask(); 321 void DoInitAudioRenderer(const PipelineStatusCB& done_cb);
376 322 void DoInitVideoDecoder(const PipelineStatusCB& done_cb);
377 // Carries out stopping filter threads, deleting filters, running 323 void DoInitVideoRenderer(const PipelineStatusCB& done_cb);
378 // appropriate callbacks, and setting the appropriate pipeline state
379 // depending on whether we performing Stop() or SetError().
380 // Called after all filters have been stopped.
381 void FinishDestroyingFiltersTask();
382
383 // Internal methods used in the implementation of the pipeline thread. All
384 // of these methods are only called on the pipeline thread.
385
386 // The following initialize methods are used to select a specific type of
387 // object from FilterCollection and initialize it asynchronously.
388 void InitializeDemuxer();
389 void OnDemuxerInitialized(PipelineStatus status);
390
391 // Returns true if the asynchronous action of creating decoder has started.
392 // Returns false if this method did nothing because the corresponding
393 // audio/video stream does not exist.
394 bool InitializeAudioDecoder(const scoped_refptr<Demuxer>& demuxer);
395 bool InitializeVideoDecoder(const scoped_refptr<Demuxer>& demuxer);
396
397 // Initializes a renderer and connects it with decoder. Returns true if the
398 // asynchronous action of creating renderer has started. Returns
399 // false if this method did nothing because the corresponding audio/video
400 // stream does not exist.
401 bool InitializeAudioRenderer(const scoped_refptr<AudioDecoder>& decoder);
402 bool InitializeVideoRenderer(const scoped_refptr<VideoDecoder>& decoder);
403
404 // Kicks off destroying filters. Called by StopTask() and ErrorChangedTask().
405 // When we start to tear down the pipeline, we will consider two cases:
406 // 1. when pipeline has not been initialized, we will transit to stopping
407 // state first.
408 // 2. when pipeline has been initialized, we will first transit to pausing
409 // => flushing => stopping => stopped state.
410 // This will remove the race condition during stop between filters.
411 void TearDownPipeline();
412 324
413 // Compute the time corresponding to a byte offset. 325 // Compute the time corresponding to a byte offset.
414 base::TimeDelta TimeForByteOffset_Locked(int64 byte_offset) const; 326 base::TimeDelta TimeForByteOffset_Locked(int64 byte_offset) const;
415 327
416 // Initiates an asynchronous Pause/Seek/Play/Stop() call sequence executing 328 // Initiates an asynchronous Pause/Seek/Play/Stop() call sequence executing
417 // |done_cb| when completed. 329 // |done_cb| when completed.
418 void DoPause(const base::Closure& done_cb); 330 void DoPause(const base::Closure& done_cb);
419 void DoFlush(const base::Closure& done_cb); 331 void DoFlush(const base::Closure& done_cb);
420 void DoPlay(const base::Closure& done_cb); 332 void DoPlay(const base::Closure& done_cb);
421 void DoStop(const base::Closure& done_cb); 333 void DoStop(const base::Closure& done_cb);
422 334
423 // Initiates an asynchronous Seek() and preroll call sequence executing 335 // Initiates an asynchronous Seek() and preroll call sequence executing
424 // |done_cb| with the final status when completed. If |skip_demuxer_seek| is 336 // |done_cb| with the final status when completed. If |skip_demuxer_seek| is
425 // true then only renderers will attempt to preroll. 337 // true then only renderers will attempt to preroll.
426 // 338 //
339 // |seek_timestamp_| must be set prior to calling DoSeek().
340 //
427 // TODO(scherkus): Prerolling should be separate from seeking so we can report 341 // TODO(scherkus): Prerolling should be separate from seeking so we can report
428 // finer grained ready states (HAVE_CURRENT_DATA vs. HAVE_FUTURE_DATA) 342 // finer grained ready states (HAVE_CURRENT_DATA vs. HAVE_FUTURE_DATA)
429 // indepentent from seeking. 343 // indepentent from seeking.
430 void DoSeek(base::TimeDelta seek_timestamp, bool skip_demuxer_seek, 344 void DoSeek(bool skip_demuxer_seek, const PipelineStatusCB& done_cb);
431 const PipelineStatusCB& done_cb);
432 345
433 void OnAudioUnderflow(); 346 void OnAudioUnderflow();
434 347
435 void StartClockIfWaitingForTimeUpdate_Locked(); 348 void StartClockIfWaitingForTimeUpdate_Locked();
436 349
437 // Report pipeline |status| through |cb| avoiding duplicate error reporting. 350 // Report pipeline |status| through |cb| avoiding duplicate error reporting.
438 void ReportStatus(const PipelineStatusCB& cb, PipelineStatus status); 351 void ReportStatus(const PipelineStatusCB& cb, PipelineStatus status);
439 352
440 // Message loop used to execute pipeline tasks. 353 // Message loop used to execute pipeline tasks.
441 scoped_refptr<base::MessageLoopProxy> message_loop_; 354 scoped_refptr<base::MessageLoopProxy> message_loop_;
442 355
443 // MediaLog to which to log events. 356 // MediaLog to which to log events.
444 scoped_refptr<MediaLog> media_log_; 357 scoped_refptr<MediaLog> media_log_;
445 358
446 // Lock used to serialize access for the following data members. 359 // Lock used to serialize access for the following data members.
447 mutable base::Lock lock_; 360 mutable base::Lock lock_;
448 361
449 // Whether or not the pipeline is running. 362 // Whether or not the pipeline is running.
450 bool running_; 363 bool running_;
451 364
452 // Whether or not the pipeline is in transition for a seek operation.
453 bool seek_pending_;
454
455 // Whether or not the pipeline is pending a stop operation.
456 bool stop_pending_;
457
458 // Whether or not the pipeline is perform a stop operation.
459 bool tearing_down_;
460
461 // Whether or not an error triggered the teardown.
462 bool error_caused_teardown_;
463
464 // Whether or not a playback rate change should be done once seeking is done.
465 bool playback_rate_change_pending_;
scherkus (not reviewing) 2012/07/28 02:26:07 I replaced this + set volume pending-ness with a s
466
467 // Amount of available buffered data. Set by filters. 365 // Amount of available buffered data. Set by filters.
468 Ranges<int64> buffered_byte_ranges_; 366 Ranges<int64> buffered_byte_ranges_;
469 Ranges<base::TimeDelta> buffered_time_ranges_; 367 Ranges<base::TimeDelta> buffered_time_ranges_;
470 368
471 // True when AddBufferedByteRange() has been called more recently than 369 // True when AddBufferedByteRange() has been called more recently than
472 // DidLoadingProgress(). 370 // DidLoadingProgress().
473 mutable bool did_loading_progress_; 371 mutable bool did_loading_progress_;
474 372
475 // Total size of the media. Set by filters. 373 // Total size of the media. Set by filters.
476 int64 total_bytes_; 374 int64 total_bytes_;
477 375
478 // Video's natural width and height. Set by filters. 376 // Video's natural width and height. Set by filters.
479 gfx::Size natural_size_; 377 gfx::Size natural_size_;
480 378
481 // Current volume level (from 0.0f to 1.0f). This value is set immediately 379 // Current volume level (from 0.0f to 1.0f). This value is set immediately
482 // via SetVolume() and a task is dispatched on the message loop to notify the 380 // via SetVolume() and a task is dispatched on the message loop to notify the
483 // filters. 381 // filters.
484 float volume_; 382 float volume_;
485 383
486 // Current playback rate (>= 0.0f). This value is set immediately via 384 // Current playback rate (>= 0.0f). This value is set immediately via
487 // SetPlaybackRate() and a task is dispatched on the message loop to notify 385 // SetPlaybackRate() and a task is dispatched on the message loop to notify
488 // the filters. 386 // the filters.
489 float playback_rate_; 387 float playback_rate_;
490 388
491 // Playback rate to set when the current seek has finished.
492 float pending_playback_rate_;
493
494 // Reference clock. Keeps track of current playback time. Uses system 389 // Reference clock. Keeps track of current playback time. Uses system
495 // clock and linear interpolation, but can have its time manually set 390 // clock and linear interpolation, but can have its time manually set
496 // by filters. 391 // by filters.
497 scoped_ptr<Clock> clock_; 392 scoped_ptr<Clock> clock_;
498 393
499 // If this value is set to true, then |clock_| is paused and we are waiting 394 // If this value is set to true, then |clock_| is paused and we are waiting
500 // for an update of the clock greater than or equal to the elapsed time to 395 // for an update of the clock greater than or equal to the elapsed time to
501 // start the clock. 396 // start the clock.
502 bool waiting_for_clock_update_; 397 bool waiting_for_clock_update_;
503 398
(...skipping 20 matching lines...) Expand all
524 // replies. 419 // replies.
525 base::TimeDelta seek_timestamp_; 420 base::TimeDelta seek_timestamp_;
526 421
527 // Set to true in DisableAudioRendererTask(). 422 // Set to true in DisableAudioRendererTask().
528 bool audio_disabled_; 423 bool audio_disabled_;
529 424
530 // Filter collection as passed in by Start(). 425 // Filter collection as passed in by Start().
531 scoped_ptr<FilterCollection> filter_collection_; 426 scoped_ptr<FilterCollection> filter_collection_;
532 427
533 // Callbacks for various pipeline operations. 428 // Callbacks for various pipeline operations.
429 PipelineStatusCB start_cb_;
534 PipelineStatusCB seek_cb_; 430 PipelineStatusCB seek_cb_;
535 base::Closure stop_cb_; 431 base::Closure stop_cb_;
536 PipelineStatusCB ended_cb_; 432 PipelineStatusCB ended_cb_;
537 PipelineStatusCB error_cb_; 433 PipelineStatusCB error_cb_;
538 434
539 // Decoder reference used for signalling imminent shutdown. 435 // Decoder reference used for signalling imminent shutdown.
540 // This is a HACK necessary because WebMediaPlayerImpl::Destroy() holds the 436 // This is a HACK necessary because WebMediaPlayerImpl::Destroy() holds the
541 // renderer thread loop hostage for until PipelineImpl::Stop() calls its 437 // renderer thread loop hostage for until PipelineImpl::Stop() calls its
542 // callback. 438 // callback.
543 // This reference should only be used for this hack and no other purposes. 439 // This reference should only be used for this hack and no other purposes.
(...skipping 18 matching lines...) Expand all
562 // Time of pipeline creation; is non-zero only until the pipeline first 458 // Time of pipeline creation; is non-zero only until the pipeline first
563 // reaches "kStarted", at which point it is used & zeroed out. 459 // reaches "kStarted", at which point it is used & zeroed out.
564 base::Time creation_time_; 460 base::Time creation_time_;
565 461
566 DISALLOW_COPY_AND_ASSIGN(Pipeline); 462 DISALLOW_COPY_AND_ASSIGN(Pipeline);
567 }; 463 };
568 464
569 } // namespace media 465 } // namespace media
570 466
571 #endif // MEDIA_BASE_PIPELINE_H_ 467 #endif // MEDIA_BASE_PIPELINE_H_
OLDNEW
« no previous file with comments | « media/base/mock_filters.h ('k') | media/base/pipeline.cc » ('j') | media/base/pipeline.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698