| 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/webrtc_video_capturer_adapter.h" | 5 #include "remoting/protocol/webrtc_video_capturer_adapter.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "third_party/libjingle/source/talk/media/webrtc/webrtcvideoframe.h" | 9 #include "third_party/libjingle/source/talk/media/webrtc/webrtcvideoframe.h" |
| 10 #include "third_party/libyuv/include/libyuv/convert.h" | 10 #include "third_party/libyuv/include/libyuv/convert.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 size_t width = frame->size().width(); | 170 size_t width = frame->size().width(); |
| 171 size_t height = frame->size().height(); | 171 size_t height = frame->size().height(); |
| 172 if (!yuv_frame_ || yuv_frame_->GetWidth() != width || | 172 if (!yuv_frame_ || yuv_frame_->GetWidth() != width || |
| 173 yuv_frame_->GetHeight() != height) { | 173 yuv_frame_->GetHeight() != height) { |
| 174 if (!size_callback_.is_null()) | 174 if (!size_callback_.is_null()) |
| 175 size_callback_.Run(frame->size()); | 175 size_callback_.Run(frame->size()); |
| 176 | 176 |
| 177 scoped_ptr<cricket::WebRtcVideoFrame> webrtc_frame( | 177 scoped_ptr<cricket::WebRtcVideoFrame> webrtc_frame( |
| 178 new cricket::WebRtcVideoFrame()); | 178 new cricket::WebRtcVideoFrame()); |
| 179 webrtc_frame->InitToEmptyBuffer(width, height, 1, 1, 0); | 179 webrtc_frame->InitToEmptyBuffer(width, height, 0); |
| 180 yuv_frame_ = std::move(webrtc_frame); | 180 yuv_frame_ = std::move(webrtc_frame); |
| 181 | 181 |
| 182 // Set updated_region so the whole frame is converted to YUV below. | 182 // Set updated_region so the whole frame is converted to YUV below. |
| 183 frame->mutable_updated_region()->SetRect( | 183 frame->mutable_updated_region()->SetRect( |
| 184 webrtc::DesktopRect::MakeWH(width, height)); | 184 webrtc::DesktopRect::MakeWH(width, height)); |
| 185 } | 185 } |
| 186 | 186 |
| 187 // TODO(sergeyu): This will copy the buffer if it's being used. Optimize it by | 187 // TODO(sergeyu): This will copy the buffer if it's being used. Optimize it by |
| 188 // keeping a queue of frames. | 188 // keeping a queue of frames. |
| 189 CHECK(yuv_frame_->MakeExclusive()); | 189 CHECK(yuv_frame_->MakeExclusive()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 DCHECK(thread_checker_.CalledOnValidThread()); | 225 DCHECK(thread_checker_.CalledOnValidThread()); |
| 226 | 226 |
| 227 if (capture_pending_) | 227 if (capture_pending_) |
| 228 return; | 228 return; |
| 229 capture_pending_ = true; | 229 capture_pending_ = true; |
| 230 desktop_capturer_->Capture(webrtc::DesktopRegion()); | 230 desktop_capturer_->Capture(webrtc::DesktopRegion()); |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace protocol | 233 } // namespace protocol |
| 234 } // namespace remoting | 234 } // namespace remoting |
| OLD | NEW |