| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BLINK_VIDEO_FRAME_COMPOSITOR_H_ | 5 #ifndef MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_ |
| 6 #define MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_ | 6 #define MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
| 12 #include "base/time/tick_clock.h" | 12 #include "base/time/tick_clock.h" |
| 13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 14 #include "cc/layers/video_frame_provider.h" | 14 #include "cc/layers/video_frame_provider.h" |
| 15 #include "media/base/media_export.h" | |
| 16 #include "media/base/video_renderer_sink.h" | 15 #include "media/base/video_renderer_sink.h" |
| 16 #include "media/blink/media_blink_export.h" |
| 17 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
| 18 | 18 |
| 19 namespace media { | 19 namespace media { |
| 20 class VideoFrame; | 20 class VideoFrame; |
| 21 | 21 |
| 22 // VideoFrameCompositor acts as a bridge between the media and cc layers for | 22 // VideoFrameCompositor acts as a bridge between the media and cc layers for |
| 23 // rendering video frames. I.e. a media::VideoRenderer will talk to this class | 23 // rendering video frames. I.e. a media::VideoRenderer will talk to this class |
| 24 // from the media side, while a cc::VideoFrameProvider::Client will talk to it | 24 // from the media side, while a cc::VideoFrameProvider::Client will talk to it |
| 25 // from the cc side. | 25 // from the cc side. |
| 26 // | 26 // |
| (...skipping 10 matching lines...) Expand all Loading... |
| 37 // | 37 // |
| 38 // VideoRenderSink::RenderCallback implementations must call Start() and Stop() | 38 // VideoRenderSink::RenderCallback implementations must call Start() and Stop() |
| 39 // once new frames are expected or are no longer expected to be ready; this data | 39 // once new frames are expected or are no longer expected to be ready; this data |
| 40 // is relayed to the compositor to avoid extraneous callbacks. | 40 // is relayed to the compositor to avoid extraneous callbacks. |
| 41 // | 41 // |
| 42 // VideoFrameCompositor is also responsible for pumping UpdateCurrentFrame() | 42 // VideoFrameCompositor is also responsible for pumping UpdateCurrentFrame() |
| 43 // callbacks in the background when |client_| has decided to suspend them. | 43 // callbacks in the background when |client_| has decided to suspend them. |
| 44 // | 44 // |
| 45 // VideoFrameCompositor must live on the same thread as the compositor, though | 45 // VideoFrameCompositor must live on the same thread as the compositor, though |
| 46 // it may be constructed on any thread. | 46 // it may be constructed on any thread. |
| 47 class MEDIA_EXPORT VideoFrameCompositor | 47 class MEDIA_BLINK_EXPORT VideoFrameCompositor |
| 48 : public VideoRendererSink, | 48 : public VideoRendererSink, |
| 49 NON_EXPORTED_BASE(public cc::VideoFrameProvider) { | 49 NON_EXPORTED_BASE(public cc::VideoFrameProvider) { |
| 50 public: | 50 public: |
| 51 // |compositor_task_runner| is the task runner on which this class will live, | 51 // |compositor_task_runner| is the task runner on which this class will live, |
| 52 // though it may be constructed on any thread. | 52 // though it may be constructed on any thread. |
| 53 // | 53 // |
| 54 // |natural_size_changed_cb| is run with the new natural size of the video | 54 // |natural_size_changed_cb| is run with the new natural size of the video |
| 55 // frame whenever a change in natural size is detected. It is not called the | 55 // frame whenever a change in natural size is detected. It is not called the |
| 56 // first time UpdateCurrentFrame() is called. Run on the same thread as the | 56 // first time UpdateCurrentFrame() is called. Run on the same thread as the |
| 57 // caller of UpdateCurrentFrame(). | 57 // caller of UpdateCurrentFrame(). |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // These values are updated and read from the media and compositor threads. | 166 // These values are updated and read from the media and compositor threads. |
| 167 base::Lock lock_; | 167 base::Lock lock_; |
| 168 VideoRendererSink::RenderCallback* callback_; | 168 VideoRendererSink::RenderCallback* callback_; |
| 169 | 169 |
| 170 DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositor); | 170 DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositor); |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 } // namespace media | 173 } // namespace media |
| 174 | 174 |
| 175 #endif // MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_ | 175 #endif // MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_ |
| OLD | NEW |