Skip to content

Commit

Permalink
[LibWebRTC][Linux] Make PulseAudio support optional
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=271696

Reviewed by Adrian Perez de Castro.

Based on original patch by: Eugene Mutavchi <Ievgen_Mutavchi@comcast.com>

* Source/ThirdParty/libwebrtc/CMakeLists.txt:
* Source/ThirdParty/libwebrtc/cmake/FindLibPulse.cmake: Added.

Canonical link: https://commits.webkit.org/276708@main
  • Loading branch information
philn committed Mar 26, 2024
1 parent fac82a3 commit b5a5947
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Source/ThirdParty/libwebrtc/CMakeLists.txt
Expand Up @@ -2154,14 +2154,25 @@ else ()

Source/webrtc/modules/audio_device/linux/alsasymboltable_linux.cc
Source/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc
Source/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc
Source/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.cc
Source/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.cc
Source/webrtc/modules/audio_device/linux/latebindingsymboltable_linux.cc
Source/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.cc

Source/webrtc/modules/video_coding/codecs/h264/h264.cc
)

find_package(LibPulse)
if (NOT LIBPULSE_FOUND)
message(STATUS "libpulse is not found, not building support.")
else()
list(APPEND webrtc_SOURCES
Source/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc
Source/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.cc
Source/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.cc
)
target_include_directories(webrtc PRIVATE ${LibPulse_INCLUDE_DIRS})
target_compile_options(webrtc PRIVATE ${LibPulse_COMPILE_OPTIONS})
endif ()

endif ()

add_library(webrtc STATIC ${webrtc_SOURCES})
Expand Down
31 changes: 31 additions & 0 deletions Source/ThirdParty/libwebrtc/cmake/FindLibPulse.cmake
@@ -0,0 +1,31 @@
# Copyright 2023 RDK Management
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.

find_package(PkgConfig)
pkg_check_modules(PC_LIBPULSE libpulse)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibPulse DEFAULT_MSG PC_LIBPULSE_VERSION)

set(LibPulse_INCLUDE_DIRS ${PC_LIBPULSE_INCLUDE_DIRS})
set(LibPulse_COMPILE_OPTIONS ${PC_LIBPULSE_CFLAGS_OTHER})

0 comments on commit b5a5947

Please sign in to comment.