Chromium Code Reviews| 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" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 // does not receive a |client_|. In this case, frame acquisition is driven by | 96 // does not receive a |client_|. In this case, frame acquisition is driven by |
| 97 // the frequency of canvas or WebGL paints requested via JavaScript. | 97 // the frequency of canvas or WebGL paints requested via JavaScript. |
| 98 scoped_refptr<VideoFrame> GetCurrentFrameAndUpdateIfStale(); | 98 scoped_refptr<VideoFrame> GetCurrentFrameAndUpdateIfStale(); |
| 99 | 99 |
| 100 // Returns the timestamp of the current (possibly stale) frame, or | 100 // Returns the timestamp of the current (possibly stale) frame, or |
| 101 // base::TimeDelta() if there is no current frame. This method may be called | 101 // base::TimeDelta() if there is no current frame. This method may be called |
| 102 // from the media thread as long as the VFC is stopped. (Assuming that | 102 // from the media thread as long as the VFC is stopped. (Assuming that |
| 103 // PaintSingleFrame() is not also called while stopped.) | 103 // PaintSingleFrame() is not also called while stopped.) |
| 104 base::TimeDelta GetCurrentFrameTimestamp() const; | 104 base::TimeDelta GetCurrentFrameTimestamp() const; |
| 105 | 105 |
| 106 // Called when the video becomes visible with the timestamp. | |
|
DaleCurtis
2017/01/05 22:38:43
visible is a bit confusing in this context; instea
whywhat
2017/01/05 23:15:44
s/Timestamp/Time sgtm
Re: s/shown/foreground:
1)
DaleCurtis
2017/01/05 23:21:46
Background rendering and SetForegroundTime() would
| |
| 107 // Used to record the time it takes to process the first frame after that. | |
| 108 // Must be called on the compositor thread. | |
| 109 void SetShownTimestamp(base::TimeTicks when); | |
| 110 | |
| 106 void set_tick_clock_for_testing(std::unique_ptr<base::TickClock> tick_clock) { | 111 void set_tick_clock_for_testing(std::unique_ptr<base::TickClock> tick_clock) { |
| 107 tick_clock_ = std::move(tick_clock); | 112 tick_clock_ = std::move(tick_clock); |
| 108 } | 113 } |
| 109 | 114 |
| 110 void clear_current_frame_for_testing() { current_frame_ = nullptr; } | 115 void clear_current_frame_for_testing() { current_frame_ = nullptr; } |
| 111 | 116 |
| 112 // Enables or disables background rendering. If |enabled|, |timeout| is the | 117 // Enables or disables background rendering. If |enabled|, |timeout| is the |
| 113 // amount of time to wait after the last Render() call before starting the | 118 // amount of time to wait after the last Render() call before starting the |
| 114 // background rendering mode. Note, this can not disable the background | 119 // background rendering mode. Note, this can not disable the background |
| 115 // rendering call issues when a sink is started. | 120 // rendering call issues when a sink is started. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 base::Timer background_rendering_timer_; | 155 base::Timer background_rendering_timer_; |
| 151 | 156 |
| 152 // These values are only set and read on the compositor thread. | 157 // These values are only set and read on the compositor thread. |
| 153 cc::VideoFrameProvider::Client* client_; | 158 cc::VideoFrameProvider::Client* client_; |
| 154 bool rendering_; | 159 bool rendering_; |
| 155 bool rendered_last_frame_; | 160 bool rendered_last_frame_; |
| 156 bool is_background_rendering_; | 161 bool is_background_rendering_; |
| 157 bool new_background_frame_; | 162 bool new_background_frame_; |
| 158 base::TimeDelta last_interval_; | 163 base::TimeDelta last_interval_; |
| 159 base::TimeTicks last_background_render_; | 164 base::TimeTicks last_background_render_; |
| 165 base::TimeTicks last_shown_; | |
| 160 | 166 |
| 161 // These values are set on the compositor thread, but also read on the media | 167 // These values are set on the compositor thread, but also read on the media |
| 162 // thread when the VFC is stopped. | 168 // thread when the VFC is stopped. |
| 163 scoped_refptr<VideoFrame> current_frame_; | 169 scoped_refptr<VideoFrame> current_frame_; |
| 164 | 170 |
| 165 // These values are updated and read from the media and compositor threads. | 171 // These values are updated and read from the media and compositor threads. |
| 166 base::Lock callback_lock_; | 172 base::Lock callback_lock_; |
| 167 VideoRendererSink::RenderCallback* callback_; | 173 VideoRendererSink::RenderCallback* callback_; |
| 168 | 174 |
| 169 // AutoOpenCloseEvent for begin/end events. | 175 // AutoOpenCloseEvent for begin/end events. |
| 170 std::unique_ptr<base::trace_event::AutoOpenCloseEvent> auto_open_close_; | 176 std::unique_ptr<base::trace_event::AutoOpenCloseEvent> auto_open_close_; |
| 171 | 177 |
| 172 DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositor); | 178 DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositor); |
| 173 }; | 179 }; |
| 174 | 180 |
| 175 } // namespace media | 181 } // namespace media |
| 176 | 182 |
| 177 #endif // MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_ | 183 #endif // MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_ |
| OLD | NEW |