tor-browser

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

pipewire_utils.cc (1406B)


      1 /*
      2 *  Copyright 2022 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 "modules/portal/pipewire_utils.h"
     12 
     13 #include <pipewire/pipewire.h>
     14 
     15 #include "rtc_base/sanitizer.h"
     16 
     17 #if defined(WEBRTC_DLOPEN_PIPEWIRE)
     18 #include "modules/portal/pipewire_stubs.h"
     19 #endif  // defined(WEBRTC_DLOPEN_PIPEWIRE)
     20 
     21 namespace webrtc {
     22 
     23 RTC_NO_SANITIZE("cfi-icall")
     24 bool InitializePipeWire() {
     25 #if defined(WEBRTC_DLOPEN_PIPEWIRE)
     26  static constexpr char kPipeWireLib[] = "libpipewire-0.3.so.0";
     27 
     28  using modules_portal::InitializeStubs;
     29  using modules_portal::kModulePipewire;
     30 
     31  modules_portal::StubPathMap paths;
     32 
     33  // Check if the PipeWire library is available.
     34  paths[kModulePipewire].push_back(kPipeWireLib);
     35 
     36  static bool result = InitializeStubs(paths);
     37 
     38  return result;
     39 #else
     40  return true;
     41 #endif  // defined(WEBRTC_DLOPEN_PIPEWIRE)
     42 }
     43 
     44 PipeWireThreadLoopLock::PipeWireThreadLoopLock(pw_thread_loop* loop)
     45    : loop_(loop) {
     46  pw_thread_loop_lock(loop_);
     47 }
     48 
     49 PipeWireThreadLoopLock::~PipeWireThreadLoopLock() {
     50  pw_thread_loop_unlock(loop_);
     51 }
     52 
     53 }  // namespace webrtc