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 <utility> | 8 #include <utility> |
9 #include <string> | |
9 | 10 |
10 #include "base/callback.h" | 11 #include "base/callback.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
14 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
15 #include "base/time/tick_clock.h" | 16 #include "base/time/tick_clock.h" |
16 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
17 #include "cc/layers/video_frame_provider.h" | 18 #include "cc/layers/video_frame_provider.h" |
18 #include "media/base/video_renderer_sink.h" | 19 #include "media/base/video_renderer_sink.h" |
19 #include "media/blink/media_blink_export.h" | 20 #include "media/blink/media_blink_export.h" |
20 #include "ui/gfx/geometry/size.h" | 21 #include "ui/gfx/geometry/size.h" |
22 #include "base/trace_event/vfc_persistent_async_event.h" | |
21 | 23 |
22 namespace media { | 24 namespace media { |
23 class VideoFrame; | 25 class VideoFrame; |
24 | 26 |
25 // VideoFrameCompositor acts as a bridge between the media and cc layers for | 27 // VideoFrameCompositor acts as a bridge between the media and cc layers for |
26 // rendering video frames. I.e. a media::VideoRenderer will talk to this class | 28 // rendering video frames. I.e. a media::VideoRenderer will talk to this class |
27 // from the media side, while a cc::VideoFrameProvider::Client will talk to it | 29 // from the media side, while a cc::VideoFrameProvider::Client will talk to it |
28 // from the cc side. | 30 // from the cc side. |
29 // | 31 // |
30 // This class is responsible for requesting new frames from a video renderer in | 32 // This class is responsible for requesting new frames from a video renderer in |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 // Updates |is_background_rendering_|, |last_interval_|, and resets | 128 // Updates |is_background_rendering_|, |last_interval_|, and resets |
127 // |background_rendering_timer_|. Returns true if there's a new frame | 129 // |background_rendering_timer_|. Returns true if there's a new frame |
128 // available via GetCurrentFrame(). | 130 // available via GetCurrentFrame(). |
129 bool CallRender(base::TimeTicks deadline_min, | 131 bool CallRender(base::TimeTicks deadline_min, |
130 base::TimeTicks deadline_max, | 132 base::TimeTicks deadline_max, |
131 bool background_rendering); | 133 bool background_rendering); |
132 | 134 |
133 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; | 135 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
134 std::unique_ptr<base::TickClock> tick_clock_; | 136 std::unique_ptr<base::TickClock> tick_clock_; |
135 | 137 |
138 // Persistent async event | |
benjhayden
2016/08/10 18:30:00
You can remove this comment since it adds no infor
| |
139 base::trace_event::VFCPersistentAsyncEvent* persistent_async_ = nullptr; | |
140 std::string video_id_; | |
141 | |
136 // Allows tests to disable the background rendering task. | 142 // Allows tests to disable the background rendering task. |
137 bool background_rendering_enabled_; | 143 bool background_rendering_enabled_; |
138 | 144 |
139 // Manages UpdateCurrentFrame() callbacks if |client_| has stopped sending | 145 // Manages UpdateCurrentFrame() callbacks if |client_| has stopped sending |
140 // them for various reasons. Runs on |compositor_task_runner_| and is reset | 146 // them for various reasons. Runs on |compositor_task_runner_| and is reset |
141 // after each successful UpdateCurrentFrame() call. | 147 // after each successful UpdateCurrentFrame() call. |
142 base::Timer background_rendering_timer_; | 148 base::Timer background_rendering_timer_; |
143 | 149 |
144 // These values are only set and read on the compositor thread. | 150 // These values are only set and read on the compositor thread. |
145 cc::VideoFrameProvider::Client* client_; | 151 cc::VideoFrameProvider::Client* client_; |
(...skipping 11 matching lines...) Expand all Loading... | |
157 // These values are updated and read from the media and compositor threads. | 163 // These values are updated and read from the media and compositor threads. |
158 base::Lock callback_lock_; | 164 base::Lock callback_lock_; |
159 VideoRendererSink::RenderCallback* callback_; | 165 VideoRendererSink::RenderCallback* callback_; |
160 | 166 |
161 DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositor); | 167 DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositor); |
162 }; | 168 }; |
163 | 169 |
164 } // namespace media | 170 } // namespace media |
165 | 171 |
166 #endif // MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_ | 172 #endif // MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_ |
OLD | NEW |