OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 // An alternative to VideoRendererBase, VideoThread creates its own thread for | 5 // An alternative to VideoRendererBase, VideoThread creates its own thread for |
6 // the sole purpose of timing frame presentation. It handles reading from the | 6 // the sole purpose of timing frame presentation. It handles reading from the |
7 // decoder and stores the results in a queue of decoded frames, calling | 7 // decoder and stores the results in a queue of decoded frames, calling |
8 // OnFrameAvailable() on subclasses to notify when a frame is ready to display. | 8 // OnFrameAvailable() on subclasses to notify 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 VideoThread is initialized, GetCurrentFrame() is safe to call from | 12 // As long as VideoThread is initialized, GetCurrentFrame() is safe to call from |
13 // any thread, at any time, including inside of OnFrameAvailable(). | 13 // any thread, at any time, including inside of OnFrameAvailable(). |
14 | 14 |
15 #ifndef MEDIA_FILTERS_VIDEO_THREAD_H_ | 15 #ifndef MEDIA_FILTERS_VIDEO_THREAD_H_ |
16 #define MEDIA_FILTERS_VIDEO_THREAD_H_ | 16 #define MEDIA_FILTERS_VIDEO_THREAD_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 "media/base/filters.h" | 22 #include "media/base/filters.h" |
22 | 23 |
23 namespace media { | 24 namespace media { |
24 | 25 |
25 // TODO(scherkus): to avoid subclasses, consider using a peer/delegate interface | 26 // TODO(scherkus): to avoid subclasses, consider using a peer/delegate interface |
26 // and pass in a reference to the constructor. | 27 // and pass in a reference to the constructor. |
27 class VideoThread : public VideoRenderer, | 28 class VideoThread : public VideoRenderer, |
28 public PlatformThread::Delegate { | 29 public PlatformThread::Delegate { |
29 public: | 30 public: |
30 VideoThread(); | 31 VideoThread(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 base::TimeDelta previous_time_; | 109 base::TimeDelta previous_time_; |
109 | 110 |
110 float playback_rate_; | 111 float playback_rate_; |
111 | 112 |
112 DISALLOW_COPY_AND_ASSIGN(VideoThread); | 113 DISALLOW_COPY_AND_ASSIGN(VideoThread); |
113 }; | 114 }; |
114 | 115 |
115 } // namespace media | 116 } // namespace media |
116 | 117 |
117 #endif // MEDIA_FILTERS_VIDEO_THREAD_H_ | 118 #endif // MEDIA_FILTERS_VIDEO_THREAD_H_ |
OLD | NEW |