| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 VideoFrameQueue ready_frames_; | 174 VideoFrameQueue ready_frames_; |
| 175 | 175 |
| 176 // Used to signal |thread_| as frames are added to |frames_|. Rule of thumb: | 176 // Used to signal |thread_| as frames are added to |frames_|. Rule of thumb: |
| 177 // always check |state_| to see if it was set to STOPPED after waking up! | 177 // always check |state_| to see if it was set to STOPPED after waking up! |
| 178 base::ConditionVariable frame_available_; | 178 base::ConditionVariable frame_available_; |
| 179 | 179 |
| 180 // State transition Diagram of this class: | 180 // State transition Diagram of this class: |
| 181 // [kUninitialized] -------> [kError] | 181 // [kUninitialized] -------> [kError] |
| 182 // | | 182 // | |
| 183 // | Initialize() | 183 // | Initialize() |
| 184 // [kInitializing] |
| 185 // | |
| 184 // V All frames returned | 186 // V All frames returned |
| 185 // +------[kFlushed]<-----[kFlushing]<--- OnDecoderResetDone() | 187 // +------[kFlushed]<-----[kFlushing]<--- OnDecoderResetDone() |
| 186 // | | Preroll() or upon ^ | 188 // | | Preroll() or upon ^ |
| 187 // | V got first frame [kFlushingDecoder] | 189 // | V got first frame [kFlushingDecoder] |
| 188 // | [kPrerolling] ^ | 190 // | [kPrerolling] ^ |
| 189 // | | | Flush() | 191 // | | | Flush() |
| 190 // | V Got enough frames | | 192 // | V Got enough frames | |
| 191 // | [kPrerolled]---------------------->[kPaused] | 193 // | [kPrerolled]---------------------->[kPaused] |
| 192 // | | Pause() ^ | 194 // | | Pause() ^ |
| 193 // | V Play() | | 195 // | V Play() | |
| 194 // | [kPlaying]---------------------------| | 196 // | [kPlaying]---------------------------| |
| 195 // | | Pause() ^ | 197 // | | Pause() ^ |
| 196 // | V Receive EOF frame. | Pause() | 198 // | V Receive EOF frame. | Pause() |
| 197 // | [kEnded]-----------------------------+ | 199 // | [kEnded]-----------------------------+ |
| 198 // | ^ | 200 // | ^ |
| 199 // | | | 201 // | | |
| 200 // +-----> [kStopped] [Any state other than] | 202 // +-----> [kStopped] [Any state other than] |
| 201 // [kUninitialized/kError] | 203 // [kUninitialized/kError] |
| 202 | 204 |
| 203 // Simple state tracking variable. | 205 // Simple state tracking variable. |
| 204 enum State { | 206 enum State { |
| 205 kUninitialized, | 207 kUninitialized, |
| 208 kInitializing, |
| 206 kPrerolled, | 209 kPrerolled, |
| 207 kPaused, | 210 kPaused, |
| 208 kFlushingDecoder, | 211 kFlushingDecoder, |
| 209 kFlushing, | 212 kFlushing, |
| 210 kFlushed, | 213 kFlushed, |
| 211 kPrerolling, | 214 kPrerolling, |
| 212 kPlaying, | 215 kPlaying, |
| 213 kEnded, | 216 kEnded, |
| 214 kStopped, | 217 kStopped, |
| 215 kError, | 218 kError, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // either for calling |paint_cb_| or for dropping. Set to kNoTimestamp() | 268 // either for calling |paint_cb_| or for dropping. Set to kNoTimestamp() |
| 266 // during flushing. | 269 // during flushing. |
| 267 base::TimeDelta last_timestamp_; | 270 base::TimeDelta last_timestamp_; |
| 268 | 271 |
| 269 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); | 272 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); |
| 270 }; | 273 }; |
| 271 | 274 |
| 272 } // namespace media | 275 } // namespace media |
| 273 | 276 |
| 274 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ | 277 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ |
| OLD | NEW |