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