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

Side by Side Diff: remoting/protocol/webrtc_video_capturer_adapter.cc

Issue 1844143002: Add VideoLayout message. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 #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/libyuv/include/libyuv/convert.h" 9 #include "third_party/libyuv/include/libyuv/convert.h"
10 #include "third_party/webrtc/media/engine/webrtcvideoframe.h" 10 #include "third_party/webrtc/media/engine/webrtcvideoframe.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // nothing is changing on the screen. This is necessary because the video 162 // nothing is changing on the screen. This is necessary because the video
163 // sender drops frames. Obviously this is a suboptimal. The sending code in 163 // sender drops frames. Obviously this is a suboptimal. The sending code in
164 // WebRTC needs to have some mechanism to notify when the bandwidth is 164 // WebRTC needs to have some mechanism to notify when the bandwidth is
165 // exceeded, so the capturer can adapt frame rate. 165 // exceeded, so the capturer can adapt frame rate.
166 166
167 size_t width = frame->size().width(); 167 size_t width = frame->size().width();
168 size_t height = frame->size().height(); 168 size_t height = frame->size().height();
169 if (!yuv_frame_ || yuv_frame_->GetWidth() != width || 169 if (!yuv_frame_ || yuv_frame_->GetWidth() != width ||
170 yuv_frame_->GetHeight() != height) { 170 yuv_frame_->GetHeight() != height) {
171 if (!size_callback_.is_null()) 171 if (!size_callback_.is_null())
172 size_callback_.Run(frame->size()); 172 size_callback_.Run(frame->size(), frame->dpi());
173 173
174 scoped_ptr<cricket::WebRtcVideoFrame> webrtc_frame( 174 scoped_ptr<cricket::WebRtcVideoFrame> webrtc_frame(
175 new cricket::WebRtcVideoFrame()); 175 new cricket::WebRtcVideoFrame());
176 webrtc_frame->InitToEmptyBuffer(width, height, 0); 176 webrtc_frame->InitToEmptyBuffer(width, height, 0);
177 yuv_frame_ = std::move(webrtc_frame); 177 yuv_frame_ = std::move(webrtc_frame);
178 178
179 // Set updated_region so the whole frame is converted to YUV below. 179 // Set updated_region so the whole frame is converted to YUV below.
180 frame->mutable_updated_region()->SetRect( 180 frame->mutable_updated_region()->SetRect(
181 webrtc::DesktopRect::MakeWH(width, height)); 181 webrtc::DesktopRect::MakeWH(width, height));
182 } 182 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 DCHECK(thread_checker_.CalledOnValidThread()); 222 DCHECK(thread_checker_.CalledOnValidThread());
223 223
224 if (capture_pending_) 224 if (capture_pending_)
225 return; 225 return;
226 capture_pending_ = true; 226 capture_pending_ = true;
227 desktop_capturer_->Capture(webrtc::DesktopRegion()); 227 desktop_capturer_->Capture(webrtc::DesktopRegion());
228 } 228 }
229 229
230 } // namespace protocol 230 } // namespace protocol
231 } // namespace remoting 231 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698