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

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

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU 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 "remoting/base/constants.h" 9 #include "remoting/base/constants.h"
10 #include "third_party/libyuv/include/libyuv/convert.h" 10 #include "third_party/libyuv/include/libyuv/convert.h"
11 #include "third_party/webrtc/media/engine/webrtcvideoframe.h" 11 #include "third_party/webrtc/media/engine/webrtcvideoframe.h"
12 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" 12 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
13 13
14 namespace remoting { 14 namespace remoting {
15 namespace protocol { 15 namespace protocol {
16 16
17 // Number of frames to be captured per second. 17 // Number of frames to be captured per second.
18 const int kFramesPerSec = 30; 18 const int kFramesPerSec = 30;
19 19
20 WebrtcVideoCapturerAdapter::WebrtcVideoCapturerAdapter( 20 WebrtcVideoCapturerAdapter::WebrtcVideoCapturerAdapter(
21 scoped_ptr<webrtc::DesktopCapturer> capturer) 21 std::unique_ptr<webrtc::DesktopCapturer> capturer)
22 : desktop_capturer_(std::move(capturer)), weak_factory_(this) { 22 : desktop_capturer_(std::move(capturer)), weak_factory_(this) {
23 DCHECK(desktop_capturer_); 23 DCHECK(desktop_capturer_);
24 24
25 // Disable video adaptation since we don't intend to use it. 25 // Disable video adaptation since we don't intend to use it.
26 set_enable_video_adapter(false); 26 set_enable_video_adapter(false);
27 } 27 }
28 28
29 WebrtcVideoCapturerAdapter::~WebrtcVideoCapturerAdapter() { 29 WebrtcVideoCapturerAdapter::~WebrtcVideoCapturerAdapter() {
30 DCHECK(!capture_timer_); 30 DCHECK(!capture_timer_);
31 } 31 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 void WebrtcVideoCapturerAdapter::OnCaptureCompleted( 150 void WebrtcVideoCapturerAdapter::OnCaptureCompleted(
151 webrtc::DesktopFrame* frame) { 151 webrtc::DesktopFrame* frame) {
152 DCHECK(thread_checker_.CalledOnValidThread()); 152 DCHECK(thread_checker_.CalledOnValidThread());
153 153
154 DCHECK(capture_pending_); 154 DCHECK(capture_pending_);
155 capture_pending_ = false; 155 capture_pending_ = false;
156 156
157 if (!frame) 157 if (!frame)
158 return; 158 return;
159 159
160 scoped_ptr<webrtc::DesktopFrame> owned_frame(frame); 160 std::unique_ptr<webrtc::DesktopFrame> owned_frame(frame);
161 161
162 // TODO(sergeyu): Currently the adapter keeps generating frames even when 162 // TODO(sergeyu): Currently the adapter keeps generating frames even when
163 // nothing is changing on the screen. This is necessary because the video 163 // nothing is changing on the screen. This is necessary because the video
164 // sender drops frames. Obviously this is a suboptimal. The sending code in 164 // sender drops frames. Obviously this is a suboptimal. The sending code in
165 // WebRTC needs to have some mechanism to notify when the bandwidth is 165 // WebRTC needs to have some mechanism to notify when the bandwidth is
166 // exceeded, so the capturer can adapt frame rate. 166 // exceeded, so the capturer can adapt frame rate.
167 167
168 webrtc::DesktopVector dpi = 168 webrtc::DesktopVector dpi =
169 frame->dpi().is_zero() ? webrtc::DesktopVector(kDefaultDpi, kDefaultDpi) 169 frame->dpi().is_zero() ? webrtc::DesktopVector(kDefaultDpi, kDefaultDpi)
170 : frame->dpi(); 170 : frame->dpi();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 DCHECK(thread_checker_.CalledOnValidThread()); 236 DCHECK(thread_checker_.CalledOnValidThread());
237 237
238 if (capture_pending_) 238 if (capture_pending_)
239 return; 239 return;
240 capture_pending_ = true; 240 capture_pending_ = true;
241 desktop_capturer_->Capture(webrtc::DesktopRegion()); 241 desktop_capturer_->Capture(webrtc::DesktopRegion());
242 } 242 }
243 243
244 } // namespace protocol 244 } // namespace protocol
245 } // namespace remoting 245 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/webrtc_video_capturer_adapter.h ('k') | remoting/protocol/webrtc_video_renderer_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698