Chromium Code Reviews| Index: media/filters/pipeline_controller.h |
| diff --git a/media/filters/pipeline_controller.h b/media/filters/pipeline_controller.h |
| index 5ce63413ae4296ce3b04ccd4c0673fc3c90ea28e..c7827a6c3319dd2712b0d17b0fc82b006e3bfbf8 100644 |
| --- a/media/filters/pipeline_controller.h |
| +++ b/media/filters/pipeline_controller.h |
| @@ -15,7 +15,6 @@ |
| #include "media/base/renderer.h" |
| namespace media { |
| - |
| class Demuxer; |
| // PipelineController wraps a Pipeline to expose the one-at-a-time operations |
| @@ -23,9 +22,10 @@ class Demuxer; |
| // pending operations and dispatches them when possible. Duplicate requests |
| // (such as seeking twice to the same time) may be elided. |
| // |
| -// TODO(sandersd): |
| -// - Expose an operation that restarts via suspend+resume. |
| +// TODO(sandersd/tguilbert): |
| +// - Expose an operation that cycles via suspend+resume. |
|
sandersd (OOO until July 31)
2017/02/23 23:11:46
Nit: Reword these as:
- Expose an operation that
tguilbert
2017/02/24 02:13:59
Done.
|
| // - Block invalid calls after an error occurs. |
| +// - Support restarting with a new demuxer. |
| class MEDIA_EXPORT PipelineController { |
| public: |
| enum class State { |
| @@ -44,8 +44,8 @@ class MEDIA_EXPORT PipelineController { |
| using BeforeResumeCB = base::Callback<void()>; |
| using ResumedCB = base::Callback<void()>; |
| - // Construct a PipelineController wrapping |pipeline_|. |pipeline_| must |
| - // outlive the resulting PipelineController. The callbacks are: |
| + // Construct a PipelineController wrapping |pipeline_|. |
| + // The callbacks are: |
| // - |renderer_factory_cb| is called by PipelineController to create new |
| // renderers when starting and resuming. |
| // - |seeked_cb| is called upon reaching a stable state if a seek occured. |
| @@ -54,7 +54,7 @@ class MEDIA_EXPORT PipelineController { |
| // - |resumed_cb| is called immediately after resuming. |
| // - |error_cb| is called if any operation on |pipeline_| does not result |
| // in PIPELINE_OK or its error callback is called. |
| - PipelineController(Pipeline* pipeline, |
| + PipelineController(std::unique_ptr<Pipeline> pipeline, |
| const RendererFactoryCB& renderer_factory_cb, |
| const SeekedCB& seeked_cb, |
| const SuspendedCB& suspended_cb, |
| @@ -108,6 +108,24 @@ class MEDIA_EXPORT PipelineController { |
| // Returns true if |pipeline_| is suspended. |
| bool IsPipelineSuspended(); |
| + // Subset of the Pipeline interface directly exposing |pipeline_|. |
| + void Stop(); |
| + bool IsPipelineRunning() const; |
| + double GetPlaybackRate() const; |
| + void SetPlaybackRate(double playback_rate); |
| + float GetVolume() const; |
| + void SetVolume(float volume); |
| + base::TimeDelta GetMediaTime() const; |
| + Ranges<base::TimeDelta> GetBufferedTimeRanges() const; |
| + base::TimeDelta GetMediaDuration() const; |
| + bool DidLoadingProgress(); |
| + PipelineStatistics GetStatistics() const; |
| + void SetCdm(CdmContext* cdm_context, const CdmAttachedCB& cdm_attached_cb); |
| + void OnEnabledAudioTracksChanged( |
| + const std::vector<MediaTrack::Id>& enabledTrackIds); |
| + void OnSelectedVideoTrackChanged( |
| + const std::vector<MediaTrack::Id>& selectedTrackId); |
| + |
| private: |
| // Attempts to make progress from the current state to the target state. |
| void Dispatch(); |
| @@ -116,7 +134,7 @@ class MEDIA_EXPORT PipelineController { |
| void OnPipelineStatus(State state, PipelineStatus pipeline_status); |
| // The Pipeline we are managing state for. |
| - Pipeline* pipeline_ = nullptr; |
| + std::unique_ptr<Pipeline> pipeline_; |
| // Factory for Renderers, used for Start() and Resume(). |
| RendererFactoryCB renderer_factory_cb_; |