| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 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_FILTERS_PIPELINE_CONTROLLER_H_ | 5 #ifndef MEDIA_FILTERS_PIPELINE_CONTROLLER_H_ |
| 6 #define MEDIA_FILTERS_PIPELINE_CONTROLLER_H_ | 6 #define MEDIA_FILTERS_PIPELINE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
| 14 #include "media/base/pipeline.h" | 14 #include "media/base/pipeline.h" |
| 15 #include "media/base/renderer.h" | 15 #include "media/base/renderer.h" |
| 16 #include "media/base/renderer.h" |
| 17 #include "media/base/stream_position.h" |
| 16 | 18 |
| 17 namespace media { | 19 namespace media { |
| 18 | 20 |
| 19 class Demuxer; | 21 class Demuxer; |
| 20 | 22 |
| 21 // PipelineController wraps a Pipeline to expose the one-at-a-time operations | 23 // PipelineController wraps a Pipeline to expose the one-at-a-time operations |
| 22 // (Seek(), Suspend(), and Resume()) with a simpler API. Internally it tracks | 24 // (Seek(), Suspend(), and Resume()) with a simpler API. Internally it tracks |
| 23 // pending operations and dispatches them when possible. Duplicate requests | 25 // pending operations and dispatches them when possible. Duplicate requests |
| 24 // (such as seeking twice to the same time) may be elided. | 26 // (such as seeking twice to the same time) may be elided. |
| 25 // | 27 // |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // The remaining parameters are just passed directly to pipeline_.Start(). | 72 // The remaining parameters are just passed directly to pipeline_.Start(). |
| 71 void Start(Demuxer* demuxer, | 73 void Start(Demuxer* demuxer, |
| 72 Pipeline::Client* client, | 74 Pipeline::Client* client, |
| 73 bool is_streaming, | 75 bool is_streaming, |
| 74 bool is_static); | 76 bool is_static); |
| 75 | 77 |
| 76 // Request a seek to |time|. If |time_updated| is true, then the eventual | 78 // Request a seek to |time|. If |time_updated| is true, then the eventual |
| 77 // |seeked_cb| callback will also have |time_updated| set to true; it | 79 // |seeked_cb| callback will also have |time_updated| set to true; it |
| 78 // indicates that the seek was requested by Blink and a time update is | 80 // indicates that the seek was requested by Blink and a time update is |
| 79 // expected so that Blink can fire the seeked event. | 81 // expected so that Blink can fire the seeked event. |
| 80 void Seek(base::TimeDelta time, bool time_updated); | 82 void Seek(StreamPosition position, bool time_updated); |
| 81 | 83 |
| 82 // Request that |pipeline_| be suspended. This is a no-op if |pipeline_| has | 84 // Request that |pipeline_| be suspended. This is a no-op if |pipeline_| has |
| 83 // been suspended. | 85 // been suspended. |
| 84 void Suspend(); | 86 void Suspend(); |
| 85 | 87 |
| 86 // Request that |pipeline_| be resumed. This is a no-op if |pipeline_| has not | 88 // Request that |pipeline_| be resumed. This is a no-op if |pipeline_| has not |
| 87 // been suspended. | 89 // been suspended. |
| 88 void Resume(); | 90 void Resume(); |
| 89 | 91 |
| 90 // Returns true if the current state is stable. This means that |state_| is | 92 // Returns true if the current state is stable. This means that |state_| is |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 144 |
| 143 // Indicates that a seek has occurred. When set, a seeked callback will be | 145 // Indicates that a seek has occurred. When set, a seeked callback will be |
| 144 // issued at the next stable state. | 146 // issued at the next stable state. |
| 145 bool pending_seeked_cb_ = false; | 147 bool pending_seeked_cb_ = false; |
| 146 | 148 |
| 147 // Indicates that time has been changed by a seek, which will be reported at | 149 // Indicates that time has been changed by a seek, which will be reported at |
| 148 // the next seeked callback. | 150 // the next seeked callback. |
| 149 bool pending_time_updated_ = false; | 151 bool pending_time_updated_ = false; |
| 150 | 152 |
| 151 // The target time of the active seek; valid while SEEKING or RESUMING. | 153 // The target time of the active seek; valid while SEEKING or RESUMING. |
| 152 base::TimeDelta seek_time_; | 154 StreamPosition seek_position_; |
| 153 | 155 |
| 154 // Target state which we will work to achieve. |pending_seek_time_| is only | 156 // Target state which we will work to achieve. |pending_seek_time_| is only |
| 155 // valid when |pending_seek_| is true. | 157 // valid when |pending_seek_| is true. |
| 156 bool pending_seek_ = false; | 158 bool pending_seek_ = false; |
| 157 base::TimeDelta pending_seek_time_; | 159 StreamPosition pending_seek_position_; |
| 158 bool pending_suspend_ = false; | 160 bool pending_suspend_ = false; |
| 159 bool pending_resume_ = false; | 161 bool pending_resume_ = false; |
| 160 | 162 |
| 161 base::ThreadChecker thread_checker_; | 163 base::ThreadChecker thread_checker_; |
| 162 base::WeakPtrFactory<PipelineController> weak_factory_; | 164 base::WeakPtrFactory<PipelineController> weak_factory_; |
| 163 | 165 |
| 164 DISALLOW_COPY_AND_ASSIGN(PipelineController); | 166 DISALLOW_COPY_AND_ASSIGN(PipelineController); |
| 165 }; | 167 }; |
| 166 | 168 |
| 167 } // namespace media | 169 } // namespace media |
| 168 | 170 |
| 169 #endif // MEDIA_FILTERS_PIPELINE_CONTROLLER_H_ | 171 #endif // MEDIA_FILTERS_PIPELINE_CONTROLLER_H_ |
| OLD | NEW |