| 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 <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 return nullptr; | 115 return nullptr; |
| 116 } | 116 } |
| 117 | 117 |
| 118 void VideoFramePump::OnCaptureCompleted(webrtc::DesktopFrame* frame) { | 118 void VideoFramePump::OnCaptureCompleted(webrtc::DesktopFrame* frame) { |
| 119 DCHECK(thread_checker_.CalledOnValidThread()); | 119 DCHECK(thread_checker_.CalledOnValidThread()); |
| 120 | 120 |
| 121 capture_scheduler_.OnCaptureCompleted(); | 121 capture_scheduler_.OnCaptureCompleted(); |
| 122 | 122 |
| 123 captured_frame_timestamps_->capture_ended_time = base::TimeTicks::Now(); | 123 captured_frame_timestamps_->capture_ended_time = base::TimeTicks::Now(); |
| 124 | 124 |
| 125 if (frame && !frame_size_.equals(frame->size())) { | 125 if (frame && (!frame_size_.equals(frame->size()) || |
| 126 !frame_dpi_.equals(frame->dpi()))) { |
| 126 frame_size_ = frame->size(); | 127 frame_size_ = frame->size(); |
| 128 frame_dpi_ = frame->dpi(); |
| 127 if (!size_callback_.is_null()) | 129 if (!size_callback_.is_null()) |
| 128 size_callback_.Run(frame_size_); | 130 size_callback_.Run(frame_size_, frame_dpi_); |
| 129 } | 131 } |
| 130 | 132 |
| 131 // Even when |frame| is nullptr we still need to post it to the encode thread | 133 // Even when |frame| is nullptr we still need to post it to the encode thread |
| 132 // to make sure frames are freed in the same order they are received and | 134 // to make sure frames are freed in the same order they are received and |
| 133 // that we don't start capturing frame n+2 before frame n is freed. | 135 // that we don't start capturing frame n+2 before frame n is freed. |
| 134 base::PostTaskAndReplyWithResult( | 136 base::PostTaskAndReplyWithResult( |
| 135 encode_task_runner_.get(), FROM_HERE, | 137 encode_task_runner_.get(), FROM_HERE, |
| 136 base::Bind(&VideoFramePump::EncodeFrame, encoder_.get(), | 138 base::Bind(&VideoFramePump::EncodeFrame, encoder_.get(), |
| 137 base::Passed(make_scoped_ptr(frame)), | 139 base::Passed(make_scoped_ptr(frame)), |
| 138 base::Passed(&captured_frame_timestamps_)), | 140 base::Passed(&captured_frame_timestamps_)), |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 } | 263 } |
| 262 | 264 |
| 263 void VideoFramePump::OnKeepAlivePacketSent() { | 265 void VideoFramePump::OnKeepAlivePacketSent() { |
| 264 DCHECK(thread_checker_.CalledOnValidThread()); | 266 DCHECK(thread_checker_.CalledOnValidThread()); |
| 265 | 267 |
| 266 keep_alive_timer_.Reset(); | 268 keep_alive_timer_.Reset(); |
| 267 } | 269 } |
| 268 | 270 |
| 269 } // namespace protocol | 271 } // namespace protocol |
| 270 } // namespace remoting | 272 } // namespace remoting |
| OLD | NEW |