OLD | NEW |
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 #include "remoting/protocol/video_frame_pump.h" | 5 #include "remoting/protocol/video_frame_pump.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // static | 162 // static |
163 std::unique_ptr<VideoFramePump::PacketWithTimestamps> | 163 std::unique_ptr<VideoFramePump::PacketWithTimestamps> |
164 VideoFramePump::EncodeFrame(VideoEncoder* encoder, | 164 VideoFramePump::EncodeFrame(VideoEncoder* encoder, |
165 std::unique_ptr<webrtc::DesktopFrame> frame, | 165 std::unique_ptr<webrtc::DesktopFrame> frame, |
166 std::unique_ptr<FrameTimestamps> timestamps) { | 166 std::unique_ptr<FrameTimestamps> timestamps) { |
167 timestamps->encode_started_time = base::TimeTicks::Now(); | 167 timestamps->encode_started_time = base::TimeTicks::Now(); |
168 | 168 |
169 std::unique_ptr<VideoPacket> packet; | 169 std::unique_ptr<VideoPacket> packet; |
170 // If |frame| is non-NULL then let the encoder process it. | 170 // If |frame| is non-NULL then let the encoder process it. |
171 if (frame) | 171 if (frame) |
172 packet = encoder->Encode(*frame, 0); | 172 packet = encoder->Encode(*frame); |
173 | 173 |
174 // If |frame| is NULL, or the encoder returned nothing, return an empty | 174 // If |frame| is NULL, or the encoder returned nothing, return an empty |
175 // packet. | 175 // packet. |
176 if (!packet) | 176 if (!packet) |
177 packet.reset(new VideoPacket()); | 177 packet.reset(new VideoPacket()); |
178 | 178 |
179 if (frame) | 179 if (frame) |
180 packet->set_capture_time_ms(frame->capture_time_ms()); | 180 packet->set_capture_time_ms(frame->capture_time_ms()); |
181 | 181 |
182 timestamps->encode_ended_time = base::TimeTicks::Now(); | 182 timestamps->encode_ended_time = base::TimeTicks::Now(); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } | 273 } |
274 | 274 |
275 void VideoFramePump::OnKeepAlivePacketSent() { | 275 void VideoFramePump::OnKeepAlivePacketSent() { |
276 DCHECK(thread_checker_.CalledOnValidThread()); | 276 DCHECK(thread_checker_.CalledOnValidThread()); |
277 | 277 |
278 keep_alive_timer_.Reset(); | 278 keep_alive_timer_.Reset(); |
279 } | 279 } |
280 | 280 |
281 } // namespace protocol | 281 } // namespace protocol |
282 } // namespace remoting | 282 } // namespace remoting |
OLD | NEW |