forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdesktop_capturer_checker.cc
51 lines (40 loc) · 1.68 KB
/
desktop_capturer_checker.cc
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
43
44
45
46
47
48
49
50
51
// Copyright 2019 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/desktop_capturer_checker.h"
#include <stddef.h>
#include <utility>
#include "base/bind.h"
#include "base/check.h"
#include "base/location.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "remoting/host/client_session_control.h"
#include "remoting/proto/control.pb.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer_differ_wrapper.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
namespace remoting {
DesktopCapturerChecker::DesktopCapturerChecker() {}
DesktopCapturerChecker::~DesktopCapturerChecker() {}
void DesktopCapturerChecker::TriggerSingleCapture() {
DCHECK(!capturer_);
webrtc::DesktopCaptureOptions options =
webrtc::DesktopCaptureOptions::CreateDefault();
capturer_ = webrtc::DesktopCapturer::CreateScreenCapturer(options);
DCHECK(capturer_)
<< "Failed to initialize screen capturer for DesktopCapturerChecker.";
capturer_->Start(this);
capturer_->CaptureFrame();
}
void DesktopCapturerChecker::OnCaptureResult(
webrtc::DesktopCapturer::Result result,
std::unique_ptr<webrtc::DesktopFrame> frame) {
// Ignore capture result.
}
} // namespace remoting