| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(); |
| 183 packet->set_encode_time_ms( | 183 packet->set_encode_time_ms( |
| 184 (timestamps->encode_ended_time - timestamps->encode_started_time) | 184 (timestamps->encode_ended_time - timestamps->encode_started_time) |
| 185 .InMilliseconds()); | 185 .InMilliseconds()); |
| 186 | 186 |
| 187 return base::WrapUnique( | 187 return base::MakeUnique<PacketWithTimestamps>(std::move(packet), |
| 188 new PacketWithTimestamps(std::move(packet), std::move(timestamps))); | 188 std::move(timestamps)); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void VideoFramePump::OnFrameEncoded( | 191 void VideoFramePump::OnFrameEncoded( |
| 192 std::unique_ptr<PacketWithTimestamps> packet) { | 192 std::unique_ptr<PacketWithTimestamps> packet) { |
| 193 DCHECK(thread_checker_.CalledOnValidThread()); | 193 DCHECK(thread_checker_.CalledOnValidThread()); |
| 194 | 194 |
| 195 capture_scheduler_.OnFrameEncoded(packet->packet.get()); | 195 capture_scheduler_.OnFrameEncoded(packet->packet.get()); |
| 196 | 196 |
| 197 if (send_pending_) { | 197 if (send_pending_) { |
| 198 pending_packets_.push_back(std::move(packet)); | 198 pending_packets_.push_back(std::move(packet)); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 std::unique_ptr<PacketWithTimestamps> next(pending_packets_.front()); | 260 std::unique_ptr<PacketWithTimestamps> next(pending_packets_.front()); |
| 261 pending_packets_.weak_erase(pending_packets_.begin()); | 261 pending_packets_.weak_erase(pending_packets_.begin()); |
| 262 SendPacket(std::move(next)); | 262 SendPacket(std::move(next)); |
| 263 } | 263 } |
| 264 } | 264 } |
| 265 | 265 |
| 266 void VideoFramePump::SendKeepAlivePacket() { | 266 void VideoFramePump::SendKeepAlivePacket() { |
| 267 DCHECK(thread_checker_.CalledOnValidThread()); | 267 DCHECK(thread_checker_.CalledOnValidThread()); |
| 268 | 268 |
| 269 video_stub_->ProcessVideoPacket( | 269 video_stub_->ProcessVideoPacket( |
| 270 base::WrapUnique(new VideoPacket()), | 270 base::MakeUnique<VideoPacket>(), |
| 271 base::Bind(&VideoFramePump::OnKeepAlivePacketSent, | 271 base::Bind(&VideoFramePump::OnKeepAlivePacketSent, |
| 272 weak_factory_.GetWeakPtr())); | 272 weak_factory_.GetWeakPtr())); |
| 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 |