Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: remoting/protocol/video_frame_pump.h

Issue 2413553003: Add InputEventTimestampSource interface. (Closed)
Patch Set: msvc compilation Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/protocol/protocol_mock_objects.h ('k') | remoting/protocol/video_frame_pump.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_PROTOCOL_VIDEO_FRAME_PUMP_H_ 5 #ifndef REMOTING_PROTOCOL_VIDEO_FRAME_PUMP_H_
6 #define REMOTING_PROTOCOL_VIDEO_FRAME_PUMP_H_ 6 #define REMOTING_PROTOCOL_VIDEO_FRAME_PUMP_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // Creates a VideoFramePump running capture, encode and network tasks on the 73 // Creates a VideoFramePump running capture, encode and network tasks on the
74 // supplied TaskRunners. Video will be pumped to |video_stub|, which must 74 // supplied TaskRunners. Video will be pumped to |video_stub|, which must
75 // outlive the pump.. 75 // outlive the pump..
76 VideoFramePump(scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner, 76 VideoFramePump(scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
77 std::unique_ptr<webrtc::DesktopCapturer> capturer, 77 std::unique_ptr<webrtc::DesktopCapturer> capturer,
78 std::unique_ptr<VideoEncoder> encoder, 78 std::unique_ptr<VideoEncoder> encoder,
79 protocol::VideoStub* video_stub); 79 protocol::VideoStub* video_stub);
80 ~VideoFramePump() override; 80 ~VideoFramePump() override;
81 81
82 // VideoStream interface. 82 // VideoStream interface.
83 void SetEventTimestampsSource(scoped_refptr<InputEventTimestampsSource>
84 event_timestamps_source) override;
83 void Pause(bool pause) override; 85 void Pause(bool pause) override;
84 void OnInputEventReceived(int64_t event_timestamp) override;
85 void SetLosslessEncode(bool want_lossless) override; 86 void SetLosslessEncode(bool want_lossless) override;
86 void SetLosslessColor(bool want_lossless) override; 87 void SetLosslessColor(bool want_lossless) override;
87 void SetObserver(Observer* observer) override; 88 void SetObserver(Observer* observer) override;
88 89
89 protocol::VideoFeedbackStub* video_feedback_stub() { 90 protocol::VideoFeedbackStub* video_feedback_stub() {
90 return &capture_scheduler_; 91 return &capture_scheduler_;
91 } 92 }
92 93
93 private: 94 private:
94 struct FrameTimestamps { 95 struct FrameTimestamps {
95 FrameTimestamps(); 96 FrameTimestamps();
96 ~FrameTimestamps(); 97 ~FrameTimestamps();
97 98
98 // The following two fields are set only for one frame after each incoming 99 // The following field is not-null for a single frame after each incoming
99 // input event. |input_event_client_timestamp| is event timestamp 100 // input event.
100 // received from the client. |input_event_received_time| is local time when 101 InputEventTimestamps input_event_timestamps;
101 // the event was received.
102 int64_t input_event_client_timestamp = -1;
103 base::TimeTicks input_event_received_time;
104 102
105 base::TimeTicks capture_started_time; 103 base::TimeTicks capture_started_time;
106 base::TimeTicks capture_ended_time; 104 base::TimeTicks capture_ended_time;
107 base::TimeTicks encode_started_time; 105 base::TimeTicks encode_started_time;
108 base::TimeTicks encode_ended_time; 106 base::TimeTicks encode_ended_time;
109 base::TimeTicks can_send_time; 107 base::TimeTicks can_send_time;
110 }; 108 };
111 109
112 struct PacketWithTimestamps { 110 struct PacketWithTimestamps {
113 PacketWithTimestamps(std::unique_ptr<VideoPacket> packet, 111 PacketWithTimestamps(std::unique_ptr<VideoPacket> packet,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 150
153 // Task runner used to run |encoder_|. 151 // Task runner used to run |encoder_|.
154 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; 152 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_;
155 153
156 // Capturer used to capture the screen. 154 // Capturer used to capture the screen.
157 std::unique_ptr<webrtc::DesktopCapturer> capturer_; 155 std::unique_ptr<webrtc::DesktopCapturer> capturer_;
158 156
159 // Used to encode captured frames. Always accessed on the encode thread. 157 // Used to encode captured frames. Always accessed on the encode thread.
160 std::unique_ptr<VideoEncoder> encoder_; 158 std::unique_ptr<VideoEncoder> encoder_;
161 159
160 scoped_refptr<InputEventTimestampsSource> event_timestamps_source_;
161
162 // Interface through which video frames are passed to the client. 162 // Interface through which video frames are passed to the client.
163 protocol::VideoStub* video_stub_; 163 protocol::VideoStub* video_stub_;
164 164
165 Observer* observer_ = nullptr; 165 Observer* observer_ = nullptr;
166 webrtc::DesktopSize frame_size_; 166 webrtc::DesktopSize frame_size_;
167 webrtc::DesktopVector frame_dpi_; 167 webrtc::DesktopVector frame_dpi_;
168 168
169 // Timer used to ensure that we send empty keep-alive frames to the client 169 // Timer used to ensure that we send empty keep-alive frames to the client
170 // even when the video stream is paused or encoder is busy. 170 // even when the video stream is paused or encoder is busy.
171 base::Timer keep_alive_timer_; 171 base::Timer keep_alive_timer_;
172 172
173 // CaptureScheduler calls CaptureNextFrame() whenever a new frame needs to be 173 // CaptureScheduler calls CaptureNextFrame() whenever a new frame needs to be
174 // captured. 174 // captured.
175 CaptureScheduler capture_scheduler_; 175 CaptureScheduler capture_scheduler_;
176 176
177 // Timestamps for the frame to be captured next.
178 std::unique_ptr<FrameTimestamps> next_frame_timestamps_;
179
180 // Timestamps for the frame that's being captured. 177 // Timestamps for the frame that's being captured.
181 std::unique_ptr<FrameTimestamps> captured_frame_timestamps_; 178 std::unique_ptr<FrameTimestamps> captured_frame_timestamps_;
182 179
183 bool send_pending_ = false; 180 bool send_pending_ = false;
184 181
185 ScopedVector<PacketWithTimestamps> pending_packets_; 182 ScopedVector<PacketWithTimestamps> pending_packets_;
186 183
187 base::ThreadChecker thread_checker_; 184 base::ThreadChecker thread_checker_;
188 185
189 base::WeakPtrFactory<VideoFramePump> weak_factory_; 186 base::WeakPtrFactory<VideoFramePump> weak_factory_;
190 187
191 DISALLOW_COPY_AND_ASSIGN(VideoFramePump); 188 DISALLOW_COPY_AND_ASSIGN(VideoFramePump);
192 }; 189 };
193 190
194 } // namespace protocol 191 } // namespace protocol
195 } // namespace remoting 192 } // namespace remoting
196 193
197 #endif // REMOTING_PROTOCOL_VIDEO_FRAME_PUMP_H_ 194 #endif // REMOTING_PROTOCOL_VIDEO_FRAME_PUMP_H_
OLDNEW
« no previous file with comments | « remoting/protocol/protocol_mock_objects.h ('k') | remoting/protocol/video_frame_pump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698