Skip to content

Commit ad57dfd

Browse files
committed
[LibWebRTC][Linux] Make PulseAudio support optional
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
1 parent 5cede2e commit ad57dfd

2 files changed

Lines changed: 45 additions & 3 deletions

File tree

Source/ThirdParty/libwebrtc/CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,14 +2154,25 @@ else ()
21542154

21552155
Source/webrtc/modules/audio_device/linux/alsasymboltable_linux.cc
21562156
Source/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc
2157-
Source/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc
21582157
Source/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.cc
2159-
Source/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.cc
21602158
Source/webrtc/modules/audio_device/linux/latebindingsymboltable_linux.cc
2161-
Source/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.cc
21622159

21632160
Source/webrtc/modules/video_coding/codecs/h264/h264.cc
21642161
)
2162+
2163+
find_package(LibPulse)
2164+
if (NOT LIBPULSE_FOUND)
2165+
message(STATUS "libpulse is not found, not building support.")
2166+
else()
2167+
list(APPEND webrtc_SOURCES
2168+
Source/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc
2169+
Source/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.cc
2170+
Source/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.cc
2171+
)
2172+
target_include_directories(webrtc PRIVATE ${LibPulse_INCLUDE_DIRS})
2173+
target_compile_options(webrtc PRIVATE ${LibPulse_COMPILE_OPTIONS})
2174+
endif ()
2175+
21652176
endif ()
21662177

21672178
add_library(webrtc STATIC ${webrtc_SOURCES})
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright 2023 RDK Management
2+
#
3+
# Redistribution and use in source and binary forms, with or without
4+
# modification, are permitted provided that the following conditions
5+
# are met:
6+
# 1. Redistributions of source code must retain the above copyright
7+
# notice, this list of conditions and the following disclaimer.
8+
# 2. Redistributions in binary form must reproduce the above copyright
9+
# notice, this list of conditions and the following disclaimer in the
10+
# documentation and/or other materials provided with the distribution.
11+
#
12+
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
13+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
14+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
15+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
16+
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
22+
# THE POSSIBILITY OF SUCH DAMAGE.
23+
24+
find_package(PkgConfig)
25+
pkg_check_modules(PC_LIBPULSE libpulse)
26+
27+
include(FindPackageHandleStandardArgs)
28+
find_package_handle_standard_args(LibPulse DEFAULT_MSG PC_LIBPULSE_VERSION)
29+
30+
set(LibPulse_INCLUDE_DIRS ${PC_LIBPULSE_INCLUDE_DIRS})
31+
set(LibPulse_COMPILE_OPTIONS ${PC_LIBPULSE_CFLAGS_OTHER})

0 commit comments

Comments
 (0)