OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_VIDEO_RENDERER_IMPL_H_ | 5 #ifndef MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_ |
6 #define MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_ | 6 #define MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // Keeps track of whether we received the end of stream buffer and finished | 147 // Keeps track of whether we received the end of stream buffer and finished |
148 // rendering. | 148 // rendering. |
149 bool received_end_of_stream_; | 149 bool received_end_of_stream_; |
150 bool rendered_end_of_stream_; | 150 bool rendered_end_of_stream_; |
151 | 151 |
152 // Used to signal |thread_| as frames are added to |frames_|. Rule of thumb: | 152 // Used to signal |thread_| as frames are added to |frames_|. Rule of thumb: |
153 // always check |state_| to see if it was set to STOPPED after waking up! | 153 // always check |state_| to see if it was set to STOPPED after waking up! |
154 base::ConditionVariable frame_available_; | 154 base::ConditionVariable frame_available_; |
155 | 155 |
156 // State transition Diagram of this class: | 156 // State transition Diagram of this class: |
157 // [kUninitialized] -------> [kError] | 157 // [kUninitialized] |
158 // | | 158 // | |
159 // | Initialize() | 159 // | Initialize() |
160 // [kInitializing] | 160 // [kInitializing] |
161 // | | 161 // | |
162 // V | 162 // V |
163 // +------[kFlushed]<---------------OnVideoFrameStreamResetDone() | 163 // +------[kFlushed]<---------------OnVideoFrameStreamResetDone() |
164 // | | Preroll() or upon ^ | 164 // | | Preroll() or upon ^ |
165 // | V got first frame [kFlushing] | 165 // | V got first frame [kFlushing] |
166 // | [kPrerolling] ^ | 166 // | [kPrerolling] ^ |
167 // | | | Flush() | 167 // | | | Flush() |
168 // | V Got enough frames | | 168 // | V Got enough frames | |
169 // | [kPrerolled]---------------------->[kPaused] | 169 // | [kPrerolled]---------------------->[kPaused] |
170 // | | Pause() ^ | 170 // | | Pause() ^ |
171 // | V Play() | | 171 // | V Play() | |
172 // | [kPlaying]---------------------------| | 172 // | [kPlaying]---------------------------| |
173 // | Pause() ^ Pause() | 173 // | Pause() ^ Pause() |
174 // | | | 174 // | | |
175 // +-----> [kStopped] [Any state other than] | 175 // +-----> [kStopped] [Any state other than] |
176 // [kUninitialized/kError] | 176 // [ kUninitialized ] |
177 | 177 |
178 // Simple state tracking variable. | 178 // Simple state tracking variable. |
179 enum State { | 179 enum State { |
180 kUninitialized, | 180 kUninitialized, |
181 kInitializing, | 181 kInitializing, |
182 kPrerolled, | 182 kPrerolled, |
183 kPaused, | 183 kPaused, |
184 kFlushing, | 184 kFlushing, |
185 kFlushed, | 185 kFlushed, |
186 kPrerolling, | 186 kPrerolling, |
187 kPlaying, | 187 kPlaying, |
188 kStopped, | 188 kStopped, |
189 kError, | |
190 }; | 189 }; |
191 State state_; | 190 State state_; |
192 | 191 |
193 // Video thread handle. | 192 // Video thread handle. |
194 base::PlatformThreadHandle thread_; | 193 base::PlatformThreadHandle thread_; |
195 | 194 |
196 // Keep track of the outstanding read on the VideoFrameStream. Flushing can | 195 // Keep track of the outstanding read on the VideoFrameStream. Flushing can |
197 // only complete once the read has completed. | 196 // only complete once the read has completed. |
198 bool pending_read_; | 197 bool pending_read_; |
199 | 198 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 230 |
232 // NOTE: Weak pointers must be invalidated before all other member variables. | 231 // NOTE: Weak pointers must be invalidated before all other member variables. |
233 base::WeakPtrFactory<VideoRendererImpl> weak_factory_; | 232 base::WeakPtrFactory<VideoRendererImpl> weak_factory_; |
234 | 233 |
235 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl); | 234 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl); |
236 }; | 235 }; |
237 | 236 |
238 } // namespace media | 237 } // namespace media |
239 | 238 |
240 #endif // MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_ | 239 #endif // MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_ |
OLD | NEW |