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 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "base/time/tick_clock.h" | 15 #include "base/time/tick_clock.h" |
16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
17 #include "base/trace_event/video_playback_pae.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" |
21 | 22 |
22 namespace media { | 23 namespace media { |
23 class VideoFrame; | 24 class VideoFrame; |
24 | 25 |
25 // VideoFrameCompositor acts as a bridge between the media and cc layers for | 26 // 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 | 27 // rendering video frames. I.e. a media::VideoRenderer will talk to this class |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 // Updates |is_background_rendering_|, |last_interval_|, and resets | 129 // Updates |is_background_rendering_|, |last_interval_|, and resets |
129 // |background_rendering_timer_|. Returns true if there's a new frame | 130 // |background_rendering_timer_|. Returns true if there's a new frame |
130 // available via GetCurrentFrame(). | 131 // available via GetCurrentFrame(). |
131 bool CallRender(base::TimeTicks deadline_min, | 132 bool CallRender(base::TimeTicks deadline_min, |
132 base::TimeTicks deadline_max, | 133 base::TimeTicks deadline_max, |
133 bool background_rendering); | 134 bool background_rendering); |
134 | 135 |
135 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; | 136 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
136 std::unique_ptr<base::TickClock> tick_clock_; | 137 std::unique_ptr<base::TickClock> tick_clock_; |
137 | 138 |
139 // Persistent async event | |
140 base::trace_event::VideoPlaybackPersistentAsyncEvent* persistent_async_ = | |
DaleCurtis
2016/08/29 19:08:48
No header initialization since the rest of these a
alexandermont
2016/08/29 21:38:20
Done
| |
141 (nullptr); | |
142 | |
138 // Allows tests to disable the background rendering task. | 143 // Allows tests to disable the background rendering task. |
139 bool background_rendering_enabled_; | 144 bool background_rendering_enabled_; |
140 | 145 |
141 // Manages UpdateCurrentFrame() callbacks if |client_| has stopped sending | 146 // Manages UpdateCurrentFrame() callbacks if |client_| has stopped sending |
142 // them for various reasons. Runs on |compositor_task_runner_| and is reset | 147 // them for various reasons. Runs on |compositor_task_runner_| and is reset |
143 // after each successful UpdateCurrentFrame() call. | 148 // after each successful UpdateCurrentFrame() call. |
144 base::Timer background_rendering_timer_; | 149 base::Timer background_rendering_timer_; |
145 | 150 |
146 // These values are only set and read on the compositor thread. | 151 // These values are only set and read on the compositor thread. |
147 cc::VideoFrameProvider::Client* client_; | 152 cc::VideoFrameProvider::Client* client_; |
(...skipping 11 matching lines...) Expand all Loading... | |
159 // These values are updated and read from the media and compositor threads. | 164 // These values are updated and read from the media and compositor threads. |
160 base::Lock callback_lock_; | 165 base::Lock callback_lock_; |
161 VideoRendererSink::RenderCallback* callback_; | 166 VideoRendererSink::RenderCallback* callback_; |
162 | 167 |
163 DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositor); | 168 DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositor); |
164 }; | 169 }; |
165 | 170 |
166 } // namespace media | 171 } // namespace media |
167 | 172 |
168 #endif // MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_ | 173 #endif // MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_ |
OLD | NEW |