| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_IMPL_H_ | 5 #ifndef MEDIA_BASE_PIPELINE_IMPL_H_ |
| 6 #define MEDIA_BASE_PIPELINE_IMPL_H_ | 6 #define MEDIA_BASE_PIPELINE_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 // Pipeline runs the media pipeline. Filters are created and called on the | 26 // Pipeline runs the media pipeline. Filters are created and called on the |
| 27 // task runner injected into this object. Pipeline works like a state | 27 // task runner injected into this object. Pipeline works like a state |
| 28 // machine to perform asynchronous initialization, pausing, seeking and playing. | 28 // machine to perform asynchronous initialization, pausing, seeking and playing. |
| 29 // | 29 // |
| 30 // Here's a state diagram that describes the lifetime of this object. | 30 // Here's a state diagram that describes the lifetime of this object. |
| 31 // | 31 // |
| 32 // [ *Created ] [ Any State ] | 32 // [ *Created ] [ Any State ] |
| 33 // | Start() | Stop() / SetError() | 33 // | Start() | Stop() / SetError() |
| 34 // V V | 34 // V V |
| 35 // [ InitXXX (for each filter) ] [ Stopping ] | 35 // [ Starting ] [ Stopping ] |
| 36 // | | | 36 // | | |
| 37 // V V | 37 // V V |
| 38 // [ Playing ] <---------. [ Stopped ] | 38 // [ Playing ] <---------. [ Stopped ] |
| 39 // | | Seek() | | 39 // | | Seek() | |
| 40 // | V | | 40 // | V | |
| 41 // | [ Seeking ] ----' | 41 // | [ Seeking ] ----' |
| 42 // | ^ | 42 // | ^ |
| 43 // | Suspend() | | 43 // | Suspend() | |
| 44 // V | | 44 // V | |
| 45 // [ Suspending ] | | 45 // [ Suspending ] | |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 friend class MediaLog; | 100 friend class MediaLog; |
| 101 class RendererWrapper; | 101 class RendererWrapper; |
| 102 | 102 |
| 103 // Pipeline states, as described above. | 103 // Pipeline states, as described above. |
| 104 // TODO(alokp): Move this to RendererWrapper after removing the references | 104 // TODO(alokp): Move this to RendererWrapper after removing the references |
| 105 // from MediaLog. | 105 // from MediaLog. |
| 106 enum State { | 106 enum State { |
| 107 kCreated, | 107 kCreated, |
| 108 kInitDemuxer, | 108 kStarting, |
| 109 kInitRenderer, | |
| 110 kSeeking, | 109 kSeeking, |
| 111 kPlaying, | 110 kPlaying, |
| 112 kStopping, | 111 kStopping, |
| 113 kStopped, | 112 kStopped, |
| 114 kSuspending, | 113 kSuspending, |
| 115 kSuspended, | 114 kSuspended, |
| 116 kResuming, | 115 kResuming, |
| 117 }; | 116 }; |
| 118 static const char* GetStateString(State state); | 117 static const char* GetStateString(State state); |
| 119 | 118 |
| 120 // Notifications from RendererWrapper. | 119 // Notifications from RendererWrapper. |
| 121 void OnError(PipelineStatus error); | 120 void OnError(PipelineStatus error); |
| 122 void OnEnded(); | 121 void OnEnded(); |
| 123 void OnMetadata(PipelineMetadata metadata); | 122 void OnMetadata(PipelineMetadata metadata); |
| 124 void OnBufferingStateChange(BufferingState state); | 123 void OnBufferingStateChange(BufferingState state); |
| 125 void OnDurationChange(base::TimeDelta duration); | 124 void OnDurationChange(base::TimeDelta duration); |
| 126 void OnAddTextTrack(const TextTrackConfig& config, | 125 void OnAddTextTrack(const TextTrackConfig& config, |
| 127 const AddTextTrackDoneCB& done_cb); | 126 const AddTextTrackDoneCB& done_cb); |
| 128 void OnWaitingForDecryptionKey(); | 127 void OnWaitingForDecryptionKey(); |
| 129 void OnVideoNaturalSizeChange(const gfx::Size& size); | 128 void OnVideoNaturalSizeChange(const gfx::Size& size); |
| 130 void OnVideoOpacityChange(bool opaque); | 129 void OnVideoOpacityChange(bool opaque); |
| 131 | 130 |
| 132 // Task completion callbacks from RendererWrapper. | 131 // Task completion callbacks from RendererWrapper. |
| 133 void OnSeekDone(base::TimeDelta start_time); | 132 void OnSeekDone(); |
| 134 void OnSuspendDone(base::TimeDelta suspend_time); | 133 void OnSuspendDone(); |
| 135 | 134 |
| 136 // Parameters passed in the constructor. | 135 // Parameters passed in the constructor. |
| 137 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; | 136 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; |
| 138 const scoped_refptr<MediaLog> media_log_; | 137 const scoped_refptr<MediaLog> media_log_; |
| 139 | 138 |
| 140 // Pipeline client. Valid only while the pipeline is running. | 139 // Pipeline client. Valid only while the pipeline is running. |
| 141 Client* client_; | 140 Client* client_; |
| 142 | 141 |
| 143 // RendererWrapper instance that runs on the media thread. | 142 // RendererWrapper instance that runs on the media thread. |
| 144 std::unique_ptr<RendererWrapper> renderer_wrapper_; | 143 std::unique_ptr<RendererWrapper> renderer_wrapper_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 164 | 163 |
| 165 base::ThreadChecker thread_checker_; | 164 base::ThreadChecker thread_checker_; |
| 166 base::WeakPtrFactory<PipelineImpl> weak_factory_; | 165 base::WeakPtrFactory<PipelineImpl> weak_factory_; |
| 167 | 166 |
| 168 DISALLOW_COPY_AND_ASSIGN(PipelineImpl); | 167 DISALLOW_COPY_AND_ASSIGN(PipelineImpl); |
| 169 }; | 168 }; |
| 170 | 169 |
| 171 } // namespace media | 170 } // namespace media |
| 172 | 171 |
| 173 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ | 172 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ |
| OLD | NEW |