OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BASE_H_ | 5 #ifndef MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ |
6 #define MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ | 6 #define MEDIA_FILTERS_VIDEO_RENDERER_BASE_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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 scoped_refptr<VideoFrame> last_available_frame_; | 187 scoped_refptr<VideoFrame> last_available_frame_; |
188 | 188 |
189 // Used to signal |thread_| as frames are added to |frames_|. Rule of thumb: | 189 // Used to signal |thread_| as frames are added to |frames_|. Rule of thumb: |
190 // always check |state_| to see if it was set to STOPPED after waking up! | 190 // always check |state_| to see if it was set to STOPPED after waking up! |
191 base::ConditionVariable frame_available_; | 191 base::ConditionVariable frame_available_; |
192 | 192 |
193 // State transition Diagram of this class: | 193 // State transition Diagram of this class: |
194 // [kUninitialized] -------> [kError] | 194 // [kUninitialized] -------> [kError] |
195 // | | 195 // | |
196 // | Initialize() | 196 // | Initialize() |
| 197 // [kInitializing] |
| 198 // | |
197 // V All frames returned | 199 // V All frames returned |
198 // +------[kFlushed]<-----[kFlushing]<--- OnDecoderResetDone() | 200 // +------[kFlushed]<-----[kFlushing]<--- OnDecoderResetDone() |
199 // | | Preroll() or upon ^ | 201 // | | Preroll() or upon ^ |
200 // | V got first frame [kFlushingDecoder] | 202 // | V got first frame [kFlushingDecoder] |
201 // | [kPrerolling] ^ | 203 // | [kPrerolling] ^ |
202 // | | | Flush() | 204 // | | | Flush() |
203 // | V Got enough frames | | 205 // | V Got enough frames | |
204 // | [kPrerolled]---------------------->[kPaused] | 206 // | [kPrerolled]---------------------->[kPaused] |
205 // | | Pause() ^ | 207 // | | Pause() ^ |
206 // | V Play() | | 208 // | V Play() | |
207 // | [kPlaying]---------------------------| | 209 // | [kPlaying]---------------------------| |
208 // | | Pause() ^ | 210 // | | Pause() ^ |
209 // | V Receive EOF frame. | Pause() | 211 // | V Receive EOF frame. | Pause() |
210 // | [kEnded]-----------------------------+ | 212 // | [kEnded]-----------------------------+ |
211 // | ^ | 213 // | ^ |
212 // | | | 214 // | | |
213 // +-----> [kStopped] [Any state other than] | 215 // +-----> [kStopped] [Any state other than] |
214 // [kUninitialized/kError] | 216 // [kUninitialized/kError] |
215 | 217 |
216 // Simple state tracking variable. | 218 // Simple state tracking variable. |
217 enum State { | 219 enum State { |
218 kUninitialized, | 220 kUninitialized, |
| 221 kInitializing, |
219 kPrerolled, | 222 kPrerolled, |
220 kPaused, | 223 kPaused, |
221 kFlushingDecoder, | 224 kFlushingDecoder, |
222 kFlushing, | 225 kFlushing, |
223 kFlushed, | 226 kFlushed, |
224 kPrerolling, | 227 kPrerolling, |
225 kPlaying, | 228 kPlaying, |
226 kEnded, | 229 kEnded, |
227 kStopped, | 230 kStopped, |
228 kError, | 231 kError, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 281 |
279 // The last natural size |size_changed_cb_| was called with. | 282 // The last natural size |size_changed_cb_| was called with. |
280 gfx::Size last_natural_size_; | 283 gfx::Size last_natural_size_; |
281 | 284 |
282 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); | 285 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); |
283 }; | 286 }; |
284 | 287 |
285 } // namespace media | 288 } // namespace media |
286 | 289 |
287 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ | 290 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ |
OLD | NEW |