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 REMOTING_HOST_VIDEO_SCHEDULER_H_ | 5 #ifndef REMOTING_HOST_VIDEO_SCHEDULER_H_ |
6 #define REMOTING_HOST_VIDEO_SCHEDULER_H_ | 6 #define REMOTING_HOST_VIDEO_SCHEDULER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 void Start(); | 107 void Start(); |
108 | 108 |
109 // Stop scheduling frame captures. This object cannot be re-used once | 109 // Stop scheduling frame captures. This object cannot be re-used once |
110 // it has been stopped. | 110 // it has been stopped. |
111 void Stop(); | 111 void Stop(); |
112 | 112 |
113 // Pauses or resumes scheduling of frame captures. Pausing/resuming captures | 113 // Pauses or resumes scheduling of frame captures. Pausing/resuming captures |
114 // only affects capture scheduling and does not stop/start the capturer. | 114 // only affects capture scheduling and does not stop/start the capturer. |
115 void Pause(bool pause); | 115 void Pause(bool pause); |
116 | 116 |
117 // Updates the sequence number embedded in VideoPackets. | 117 // Updates event timestamp from the last event received from the client. This |
118 // Sequence numbers are used for performance measurements. | 118 // value is sent back to the client for roundtrip latency estimates. |
119 void UpdateSequenceNumber(int64 sequence_number); | 119 void SetLastEventTimestamp(int64 last_event_timestamp); |
Wez
2015/01/07 23:56:19
s/Last/Latest
Or rename this to OnEventTimestamp(
Sergey Ulanov
2015/01/08 17:40:26
Done.
| |
120 | 120 |
121 // Sets whether the video encoder should be requested to encode losslessly, | 121 // Sets whether the video encoder should be requested to encode losslessly, |
122 // or to use a lossless color space (typically requiring higher bandwidth). | 122 // or to use a lossless color space (typically requiring higher bandwidth). |
123 void SetLosslessEncode(bool want_lossless); | 123 void SetLosslessEncode(bool want_lossless); |
124 void SetLosslessColor(bool want_lossless); | 124 void SetLosslessColor(bool want_lossless); |
125 | 125 |
126 private: | 126 private: |
127 friend class base::RefCountedThreadSafe<VideoScheduler>; | 127 friend class base::RefCountedThreadSafe<VideoScheduler>; |
128 ~VideoScheduler() override; | 128 ~VideoScheduler() override; |
129 | 129 |
(...skipping 29 matching lines...) Expand all Loading... | |
159 // Callback for |video_stub_| called after a keep-alive packet is sent. | 159 // Callback for |video_stub_| called after a keep-alive packet is sent. |
160 void OnKeepAlivePacketSent(); | 160 void OnKeepAlivePacketSent(); |
161 | 161 |
162 // Send updated cursor shape to client. | 162 // Send updated cursor shape to client. |
163 void SendCursorShape(scoped_ptr<protocol::CursorShapeInfo> cursor_shape); | 163 void SendCursorShape(scoped_ptr<protocol::CursorShapeInfo> cursor_shape); |
164 | 164 |
165 // Encoder thread ----------------------------------------------------------- | 165 // Encoder thread ----------------------------------------------------------- |
166 | 166 |
167 // Encode a frame, passing generated VideoPackets to SendVideoPacket(). | 167 // Encode a frame, passing generated VideoPackets to SendVideoPacket(). |
168 void EncodeFrame(scoped_ptr<webrtc::DesktopFrame> frame, | 168 void EncodeFrame(scoped_ptr<webrtc::DesktopFrame> frame, |
169 int64 sequence_number, | 169 int64 last_event_timestamp, |
170 base::TimeTicks timestamp); | 170 base::TimeTicks timestamp); |
171 | 171 |
172 void EncodedDataAvailableCallback(int64 sequence_number, | 172 void EncodedDataAvailableCallback(int64 last_event_timestamp, |
173 scoped_ptr<VideoPacket> packet); | 173 scoped_ptr<VideoPacket> packet); |
174 | 174 |
175 // Task runners used by this class. | 175 // Task runners used by this class. |
176 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_; | 176 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_; |
177 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; | 177 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; |
178 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 178 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
179 | 179 |
180 // Used to capture frames. Always accessed on the capture thread. | 180 // Used to capture frames. Always accessed on the capture thread. |
181 scoped_ptr<webrtc::DesktopCapturer> capturer_; | 181 scoped_ptr<webrtc::DesktopCapturer> capturer_; |
182 | 182 |
(...skipping 23 matching lines...) Expand all Loading... | |
206 // Set when the capturer is capturing a frame. | 206 // Set when the capturer is capturing a frame. |
207 bool capture_pending_; | 207 bool capture_pending_; |
208 | 208 |
209 // True if the previous scheduled capture was skipped. | 209 // True if the previous scheduled capture was skipped. |
210 bool did_skip_frame_; | 210 bool did_skip_frame_; |
211 | 211 |
212 // True if capture of video frames is paused. | 212 // True if capture of video frames is paused. |
213 bool is_paused_; | 213 bool is_paused_; |
214 | 214 |
215 // Number updated by the caller to trace performance. | 215 // Number updated by the caller to trace performance. |
216 int64 sequence_number_; | 216 int64 last_event_timestamp_; |
217 | 217 |
218 // An object to schedule capturing. | 218 // An object to schedule capturing. |
219 CaptureScheduler scheduler_; | 219 CaptureScheduler scheduler_; |
220 | 220 |
221 DISALLOW_COPY_AND_ASSIGN(VideoScheduler); | 221 DISALLOW_COPY_AND_ASSIGN(VideoScheduler); |
222 }; | 222 }; |
223 | 223 |
224 } // namespace remoting | 224 } // namespace remoting |
225 | 225 |
226 #endif // REMOTING_HOST_VIDEO_SCHEDULER_H_ | 226 #endif // REMOTING_HOST_VIDEO_SCHEDULER_H_ |
OLD | NEW |