tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

screen_capturer_darwin.mm (1721B)


      1 /*
      2 *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 
     11 #include <memory>
     12 
     13 #include "modules/desktop_capture/mac/screen_capturer_mac.h"
     14 #include "modules/desktop_capture/mac/screen_capturer_sck.h"
     15 #include "rtc_base/logging.h"
     16 
     17 namespace webrtc {
     18 
     19 // static
     20 std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
     21    const DesktopCaptureOptions& options) {
     22  if (!options.configuration_monitor()) {
     23    return nullptr;
     24  }
     25 
     26  if (options.allow_sck_capturer()) {
     27    // This will return nullptr on systems that don't support ScreenCaptureKit.
     28    std::unique_ptr<DesktopCapturer> sck_capturer =
     29        CreateScreenCapturerSck(options);
     30    if (sck_capturer) {
     31      RTC_LOG(LS_INFO)
     32          << "video capture: DesktopCapturer::CreateRawScreenCapturer creates "
     33             "DesktopCapturer of type ScreenCapturerSck";
     34      return sck_capturer;
     35    }
     36  }
     37 
     38  RTC_LOG(LS_INFO)
     39      << "video capture: DesktopCapturer::CreateRawScreenCapturer creates "
     40         "DesktopCapturer of type ScreenCapturerMac";
     41  auto capturer =
     42      std::make_unique<ScreenCapturerMac>(options.configuration_monitor(),
     43                                          options.detect_updated_region(),
     44                                          options.allow_iosurface());
     45  if (!capturer->Init()) {
     46    return nullptr;
     47  }
     48 
     49  return capturer;
     50 }
     51 
     52 }  // namespace webrtc