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

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

Issue 2091893003: Make PipelineImpl state change tasks consistent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: restores avtrack currTime logic Created 4 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
« no previous file with comments | « no previous file | media/base/pipeline_impl.cc » ('j') | media/base/pipeline_impl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 private: 108 private:
109 friend class MediaLog; 109 friend class MediaLog;
110 class RendererWrapper; 110 class RendererWrapper;
111 111
112 // Pipeline states, as described above. 112 // Pipeline states, as described above.
113 // TODO(alokp): Move this to RendererWrapper after removing the references 113 // TODO(alokp): Move this to RendererWrapper after removing the references
114 // from MediaLog. 114 // from MediaLog.
115 enum State { 115 enum State {
116 kCreated, 116 kCreated,
117 kInitDemuxer, 117 kStarting,
118 kInitRenderer,
119 kSeeking, 118 kSeeking,
120 kPlaying, 119 kPlaying,
121 kStopping, 120 kStopping,
122 kStopped, 121 kStopped,
123 kSuspending, 122 kSuspending,
124 kSuspended, 123 kSuspended,
125 kResuming, 124 kResuming,
126 }; 125 };
127 static const char* GetStateString(State state); 126 static const char* GetStateString(State state);
128 127
129 // Notifications from RendererWrapper. 128 // Notifications from RendererWrapper.
130 void OnError(PipelineStatus error); 129 void OnError(PipelineStatus error);
131 void OnEnded(); 130 void OnEnded();
132 void OnMetadata(PipelineMetadata metadata); 131 void OnMetadata(PipelineMetadata metadata);
133 void OnBufferingStateChange(BufferingState state); 132 void OnBufferingStateChange(BufferingState state);
134 void OnDurationChange(base::TimeDelta duration); 133 void OnDurationChange(base::TimeDelta duration);
135 void OnAddTextTrack(const TextTrackConfig& config, 134 void OnAddTextTrack(const TextTrackConfig& config,
136 const AddTextTrackDoneCB& done_cb); 135 const AddTextTrackDoneCB& done_cb);
137 void OnWaitingForDecryptionKey(); 136 void OnWaitingForDecryptionKey();
138 void OnVideoNaturalSizeChange(const gfx::Size& size); 137 void OnVideoNaturalSizeChange(const gfx::Size& size);
139 void OnVideoOpacityChange(bool opaque); 138 void OnVideoOpacityChange(bool opaque);
140 139
141 // Task completion callbacks from RendererWrapper. 140 // Task completion callbacks from RendererWrapper.
142 void OnSeekDone(base::TimeDelta start_time); 141 void OnSeekDone();
143 void OnSuspendDone(base::TimeDelta suspend_time); 142 void OnSuspendDone();
144 143
145 // Parameters passed in the constructor. 144 // Parameters passed in the constructor.
146 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; 145 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
147 const scoped_refptr<MediaLog> media_log_; 146 const scoped_refptr<MediaLog> media_log_;
148 147
149 // Pipeline client. Valid only while the pipeline is running. 148 // Pipeline client. Valid only while the pipeline is running.
150 Client* client_; 149 Client* client_;
151 150
152 // RendererWrapper instance that runs on the media thread. 151 // RendererWrapper instance that runs on the media thread.
153 std::unique_ptr<RendererWrapper> renderer_wrapper_; 152 std::unique_ptr<RendererWrapper> renderer_wrapper_;
(...skipping 19 matching lines...) Expand all
173 172
174 base::ThreadChecker thread_checker_; 173 base::ThreadChecker thread_checker_;
175 base::WeakPtrFactory<PipelineImpl> weak_factory_; 174 base::WeakPtrFactory<PipelineImpl> weak_factory_;
176 175
177 DISALLOW_COPY_AND_ASSIGN(PipelineImpl); 176 DISALLOW_COPY_AND_ASSIGN(PipelineImpl);
178 }; 177 };
179 178
180 } // namespace media 179 } // namespace media
181 180
182 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ 181 #endif // MEDIA_BASE_PIPELINE_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/pipeline_impl.cc » ('j') | media/base/pipeline_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698