Chromium Code Reviews| Index: media/base/pipeline.h |
| diff --git a/media/base/pipeline.h b/media/base/pipeline.h |
| index ecad11c7ddd07831d9f859a8944bf64e5472715d..5d4905425f1e1ab6625cdd996b4dae6da73d2cb4 100644 |
| --- a/media/base/pipeline.h |
| +++ b/media/base/pipeline.h |
| @@ -97,24 +97,40 @@ class MEDIA_EXPORT Pipeline |
| : public base::RefCountedThreadSafe<Pipeline>, |
| public DemuxerHost { |
| public: |
| + // Ready states indicating pipeline progress. |
| + // kHaveMetadata : Indicates that the following things are known: |
|
scherkus (not reviewing)
2012/08/16 01:36:02
OCD nits: no space before :, and don't worry about
acolwell GONE FROM CHROMIUM
2012/08/16 16:36:03
Fixed space before:
Changed to a 2 space indent fo
|
| + // content duration, natural size, start time, and |
| + // whether the content has audio and/or video in supported |
| + // formats. |
| + // kHavePrerolled : All renderers have successfully prerolled are are ready to |
| + // start playback. |
| + enum ReadyState { |
| + kHaveMetadata, |
| + kHavePrerolled, |
|
Ami GONE FROM CHROMIUM
2012/08/16 03:31:56
Unfortunate that both of these use "Have" but in d
acolwell GONE FROM CHROMIUM
2012/08/16 16:36:03
Agreed.. Changed it to kPrerollCompleted
|
| + }; |
| + |
| + typedef base::Callback<void(ReadyState)> ReadyStateCB; |
| + |
| // Constructs a media pipeline that will execute on |message_loop|. |
| Pipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop, |
| MediaLog* media_log); |
| // Build a pipeline to using the given filter collection to construct a filter |
| - // chain, executing |start_cb| when initialization has completed. |
| + // chain, executing |seek_cb| when the initial seek/preroll has completed. |
| // |
| // The following permanent callbacks will be executed as follows up until |
| // Stop() has completed: |
| // |ended_cb| will be executed whenever the media reaches the end. |
| // |error_cb| will be executed whenever an error occurs but hasn't |
| // been reported already through another callback. |
| - // |
| + // |ready_state_cb| Optional callback that will be executed whenever the |
| + // pipeline's ready state changes. |
| // It is an error to call this method after the pipeline has already started. |
| void Start(scoped_ptr<FilterCollection> filter_collection, |
| const PipelineStatusCB& ended_cb, |
| const PipelineStatusCB& error_cb, |
| - const PipelineStatusCB& start_cb); |
| + const PipelineStatusCB& seek_cb, |
| + const ReadyStateCB& ready_state_cb); |
| // Asynchronously stops the pipeline, executing |stop_cb| when the pipeline |
| // teardown has completed. |
| @@ -233,11 +249,9 @@ class MEDIA_EXPORT Pipeline |
| // Helper method to tell whether we are in transition to seek state. |
| bool IsPipelineSeeking(); |
| - // Helper method to execute callback from Start() and reset |
| - // |filter_collection_|. Called when initialization completes |
| - // normally or when pipeline is stopped or error occurs during |
| - // initialization. |
| - void FinishInitialization(); |
| + // Helper method that runs & resets |seek_cb_| and resets |seek_timestamp_| |
| + // and |seek_pending_|. |
| + void FinishSeek(); |
| // Returns true if the given state is one that transitions to a new state |
| // after iterating through each filter. |
| @@ -296,7 +310,8 @@ class MEDIA_EXPORT Pipeline |
| void StartTask(scoped_ptr<FilterCollection> filter_collection, |
| const PipelineStatusCB& ended_cb, |
| const PipelineStatusCB& error_cb, |
| - const PipelineStatusCB& start_cb); |
| + const PipelineStatusCB& seek_cb, |
| + const ReadyStateCB& ready_state_cb); |
| // InitializeTask() performs initialization in multiple passes. It is executed |
| // as a result of calling Start() or InitializationComplete() that advances |
| @@ -494,6 +509,7 @@ class MEDIA_EXPORT Pipeline |
| base::Closure stop_cb_; |
| PipelineStatusCB ended_cb_; |
| PipelineStatusCB error_cb_; |
| + ReadyStateCB ready_state_cb_; |
| // Audio renderer reference used for setting the volume and determining |
| // when playback has finished. |