Chromium Code Reviews| 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" |
| 11 #include "base/synchronization/condition_variable.h" | 11 #include "base/synchronization/condition_variable.h" |
| 12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
| 14 #include "media/base/demuxer_stream.h" | 14 #include "media/base/demuxer_stream.h" |
| 15 #include "media/base/pipeline_status.h" | 15 #include "media/base/pipeline_status.h" |
| 16 #include "media/base/video_decoder.h" | 16 #include "media/base/video_decoder.h" |
| 17 #include "media/base/video_frame.h" | 17 #include "media/base/video_frame.h" |
| 18 #include "media/base/video_renderer.h" | 18 #include "media/base/video_renderer.h" |
| 19 | 19 |
| 20 namespace base { | |
| 21 class MessageLoopProxy; | |
| 22 } | |
| 23 | |
| 20 namespace media { | 24 namespace media { |
| 21 | 25 |
| 22 // VideoRendererBase creates its own thread for the sole purpose of timing frame | 26 // VideoRendererBase creates its own thread for the sole purpose of timing frame |
| 23 // presentation. It handles reading from the decoder and stores the results in | 27 // presentation. It handles reading from the decoder and stores the results in |
| 24 // a queue of decoded frames and executing a callback when a frame is ready for | 28 // a queue of decoded frames and executing a callback when a frame is ready for |
| 25 // rendering. | 29 // rendering. |
| 26 class MEDIA_EXPORT VideoRendererBase | 30 class MEDIA_EXPORT VideoRendererBase |
| 27 : public VideoRenderer, | 31 : public VideoRenderer, |
| 28 public base::PlatformThread::Delegate { | 32 public base::PlatformThread::Delegate { |
| 29 public: | 33 public: |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 41 // Implementors should avoid doing any sort of heavy work in this method and | 45 // Implementors should avoid doing any sort of heavy work in this method and |
| 42 // instead post a task to a common/worker thread to handle rendering. Slowing | 46 // instead post a task to a common/worker thread to handle rendering. Slowing |
| 43 // down the video thread may result in losing synchronization with audio. | 47 // down the video thread may result in losing synchronization with audio. |
| 44 // | 48 // |
| 45 // Setting |drop_frames_| to true causes the renderer to drop expired frames. | 49 // Setting |drop_frames_| to true causes the renderer to drop expired frames. |
| 46 // | 50 // |
| 47 // TODO(scherkus): pass the VideoFrame* to this callback and remove | 51 // TODO(scherkus): pass the VideoFrame* to this callback and remove |
| 48 // Get/PutCurrentFrame() http://crbug.com/108435 | 52 // Get/PutCurrentFrame() http://crbug.com/108435 |
| 49 VideoRendererBase(const base::Closure& paint_cb, | 53 VideoRendererBase(const base::Closure& paint_cb, |
| 50 const SetOpaqueCB& set_opaque_cb, | 54 const SetOpaqueCB& set_opaque_cb, |
| 51 bool drop_frames); | 55 bool drop_frames, |
| 56 const scoped_refptr<base::MessageLoopProxy>& message_loop); | |
|
Ami GONE FROM CHROMIUM
2012/11/29 23:34:23
could alternatively let the decoder tell the rende
scherkus (not reviewing)
2012/11/29 23:45:56
I'm mulling over this one
the "caller has to know
| |
| 52 | 57 |
| 53 // VideoRenderer implementation. | 58 // VideoRenderer implementation. |
| 54 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, | 59 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, |
| 55 const VideoDecoderList& decoders, | 60 const VideoDecoderList& decoders, |
| 56 const PipelineStatusCB& init_cb, | 61 const PipelineStatusCB& init_cb, |
| 57 const StatisticsCB& statistics_cb, | 62 const StatisticsCB& statistics_cb, |
| 58 const TimeCB& max_time_cb, | 63 const TimeCB& max_time_cb, |
| 59 const NaturalSizeChangedCB& size_changed_cb, | 64 const NaturalSizeChangedCB& size_changed_cb, |
| 60 const base::Closure& ended_cb, | 65 const base::Closure& ended_cb, |
| 61 const PipelineStatusCB& error_cb, | 66 const PipelineStatusCB& error_cb, |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 // Embedder callback for notifying a new frame is available for painting. | 247 // Embedder callback for notifying a new frame is available for painting. |
| 243 base::Closure paint_cb_; | 248 base::Closure paint_cb_; |
| 244 | 249 |
| 245 // Callback to execute to inform the player if the video decoder's output is | 250 // Callback to execute to inform the player if the video decoder's output is |
| 246 // opaque. | 251 // opaque. |
| 247 SetOpaqueCB set_opaque_cb_; | 252 SetOpaqueCB set_opaque_cb_; |
| 248 | 253 |
| 249 // The last natural size |size_changed_cb_| was called with. | 254 // The last natural size |size_changed_cb_| was called with. |
| 250 gfx::Size last_natural_size_; | 255 gfx::Size last_natural_size_; |
| 251 | 256 |
| 257 scoped_refptr<base::MessageLoopProxy> decoder_message_loop_; | |
| 258 | |
| 252 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); | 259 DISALLOW_COPY_AND_ASSIGN(VideoRendererBase); |
| 253 }; | 260 }; |
| 254 | 261 |
| 255 } // namespace media | 262 } // namespace media |
| 256 | 263 |
| 257 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ | 264 #endif // MEDIA_FILTERS_VIDEO_RENDERER_BASE_H_ |
| OLD | NEW |