OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // VideoRendererBase creates its own thread for the sole purpose of timing frame | 5 // VideoRendererBase creates its own thread for the sole purpose of timing frame |
6 // presentation. It handles reading from the decoder and stores the results in | 6 // presentation. It handles reading from the decoder and stores the results in |
7 // a queue of decoded frames, calling OnFrameAvailable() on subclasses to notify | 7 // a queue of decoded frames, calling OnFrameAvailable() on subclasses to notify |
8 // when a frame is ready to display. | 8 // when a frame is ready to display. |
9 // | 9 // |
10 // The media filter methods Initialize(), Stop(), SetPlaybackRate() and Seek() | 10 // The media filter methods Initialize(), Stop(), SetPlaybackRate() and Seek() |
11 // should be serialized, which they commonly are the pipeline thread. | 11 // should be serialized, which they commonly are the pipeline thread. |
12 // As long as VideoRendererBase is initialized, GetCurrentFrame() is safe to | 12 // As long as VideoRendererBase is initialized, GetCurrentFrame() is safe to |
13 // call from any thread, at any time, including inside of OnFrameAvailable(). | 13 // call from any thread, at any time, including inside of OnFrameAvailable(). |
14 | 14 |
15 #ifndef MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ | 15 #ifndef MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ |
16 #define MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ | 16 #define MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ |
17 | 17 |
18 #include <deque> | 18 #include <deque> |
19 | 19 |
20 #include "base/condition_variable.h" | 20 #include "base/condition_variable.h" |
21 #include "base/lock.h" | 21 #include "base/lock.h" |
| 22 #include "base/platform_thread.h" |
22 #include "base/scoped_ptr.h" | 23 #include "base/scoped_ptr.h" |
23 #include "media/base/filters.h" | 24 #include "media/base/filters.h" |
24 #include "media/base/video_frame.h" | 25 #include "media/base/video_frame.h" |
25 | 26 |
26 namespace media { | 27 namespace media { |
27 | 28 |
28 // TODO(scherkus): to avoid subclasses, consider using a peer/delegate interface | 29 // TODO(scherkus): to avoid subclasses, consider using a peer/delegate interface |
29 // and pass in a reference to the constructor. | 30 // and pass in a reference to the constructor. |
30 class VideoRendererBase : public VideoRenderer, | 31 class VideoRendererBase : public VideoRenderer, |
31 public PlatformThread::Delegate { | 32 public PlatformThread::Delegate { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 scoped_ptr<FilterCallback> seek_callback_; | 210 scoped_ptr<FilterCallback> seek_callback_; |
210 | 211 |
211 base::TimeDelta seek_timestamp_; | 212 base::TimeDelta seek_timestamp_; |
212 | 213 |
213 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); | 214 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); |
214 }; | 215 }; |
215 | 216 |
216 } // namespace media | 217 } // namespace media |
217 | 218 |
218 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ | 219 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ |
OLD | NEW |