OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "remoting/host/shaped_desktop_capturer.h" | |
6 | |
7 #include <utility> | |
8 | |
9 #include "base/logging.h" | |
10 #include "remoting/host/desktop_shape_tracker.h" | |
11 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | |
12 | |
13 namespace remoting { | |
14 | |
15 ShapedDesktopCapturer::ShapedDesktopCapturer( | |
16 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer, | |
17 scoped_ptr<DesktopShapeTracker> shape_tracker) | |
18 : desktop_capturer_(std::move(desktop_capturer)), | |
19 shape_tracker_(std::move(shape_tracker)), | |
20 callback_(nullptr) {} | |
21 | |
22 ShapedDesktopCapturer::~ShapedDesktopCapturer() {} | |
23 | |
24 void ShapedDesktopCapturer::Start(webrtc::DesktopCapturer::Callback* callback) { | |
25 callback_ = callback; | |
26 desktop_capturer_->Start(this); | |
27 } | |
28 | |
29 void ShapedDesktopCapturer::Capture(const webrtc::DesktopRegion& region) { | |
30 desktop_capturer_->Capture(region); | |
31 } | |
32 | |
33 void ShapedDesktopCapturer::SetSharedMemoryFactory( | |
34 rtc::scoped_ptr<webrtc::SharedMemoryFactory> shared_memory_factory) { | |
35 desktop_capturer_->SetSharedMemoryFactory(std::move(shared_memory_factory)); | |
36 } | |
37 | |
38 void ShapedDesktopCapturer::OnCaptureCompleted(webrtc::DesktopFrame* frame) { | |
39 shape_tracker_->RefreshDesktopShape(); | |
40 frame->set_shape(new webrtc::DesktopRegion(shape_tracker_->desktop_shape())); | |
41 callback_->OnCaptureCompleted(frame); | |
42 } | |
43 | |
44 } // namespace remoting | |
OLD | NEW |