From 88d77ff852859bc7d18e71385b6e5d7acffdfa49 Mon Sep 17 00:00:00 2001 From: Arnaud Rebillout Date: Mon, 1 Oct 2018 11:01:47 +0700 Subject: [PATCH] meson: Enable echo-cancel module, add libwebrtc_util lib, add speex and webrtc dependencies Signed-off-by: Arnaud Rebillout --- meson.build | 10 ++++++++ src/modules/echo-cancel/meson.build | 18 ++++++++++++++ src/modules/meson.build | 48 ++++++++++++++++++++++++++++++++++++- src/pulsecore/meson.build | 6 ++++- 4 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 src/modules/echo-cancel/meson.build diff --git a/meson.build b/meson.build index 51c6f1e..b3aa49f 100644 --- a/meson.build +++ b/meson.build @@ -279,11 +279,21 @@ if sbc_dep.found() and dbus_dep.found() cdata.set('HAVE_BLUEZ_5', 1) endif +speex_dep = dependency('speexdsp', version : '>= 1.2', required : false) +if speex_dep.found() + cdata.set('HAVE_SPEEX', 1) +endif + udev_dep = dependency('libudev', version : '>= 143', required : false) if udev_dep.found() cdata.set('HAVE_UDEV', 1) endif +webrtc_dep = dependency('webrtc-audio-processing', version : '>= 0.2', required : false) +if webrtc_dep.found() + cdata.set('HAVE_WEBRTC', 1) +endif + # Now generate config.h from everything above configure_file(output : 'config.h', configuration : cdata) diff --git a/src/modules/echo-cancel/meson.build b/src/modules/echo-cancel/meson.build new file mode 100644 index 0000000..2197c80 --- /dev/null +++ b/src/modules/echo-cancel/meson.build @@ -0,0 +1,18 @@ +# The webrtc code is split off into a helper library to avoid having automake +# link module-echo-cancel with C++ (which it does if there are any C++ deps, +# even conditional ones). + +# Defining this library as shared fails, as it actually requires a symbol +# from module-echo-cancel.c. Setting it to static solves that. + +libwebrtc_util_sources = [ + 'webrtc.cc' +] + +libwebrtc_util = static_library('libwebrtc_util', + libwebrtc_util_sources, + cpp_args : [pa_c_args, server_c_args], + include_directories : [configinc, topinc], + dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep, webrtc_dep], + install : true +) diff --git a/src/modules/meson.build b/src/modules/meson.build index b79011c..683b42f 100644 --- a/src/modules/meson.build +++ b/src/modules/meson.build @@ -22,7 +22,6 @@ all_modules = [ [ 'module-detect', 'module-detect.c' ], [ 'module-device-manager', 'module-device-manager.c', [], [], [], libprotocol_native ], [ 'module-device-restore', 'module-device-restore.c', [], [], [dbus_dep], libprotocol_native ], -# [ 'module-echo-cancel', 'module-echo-cancel.c' ], [ 'module-esound-compat-spawnfd', 'module-esound-compat-spawnfd.c' ], [ 'module-esound-compat-spawnpid', 'module-esound-compat-spawnpid.c' ], # [ 'module-esound-protocol-tcp', 'module-protocol-stub.c' ], @@ -197,6 +196,53 @@ if x11_dep.found() endif endif +# Module echo-cancel is quite modular itself and requires a section of its own + +module_echo_cancel_sources = [ + 'echo-cancel/echo-cancel.h', + 'echo-cancel/module-echo-cancel.c', + 'echo-cancel/null.c', +] +module_echo_cancel_flags = [] +module_echo_cancel_deps = [] +module_echo_cancel_libs = [] + +# FIXME: Adrian support should be optional +module_echo_cancel_sources += [ + 'echo-cancel/adrian.c', 'echo-cancel/adrian.h', + 'echo-cancel/adrian-aec.c', 'echo-cancel/adrian-aec.h', +] +module_echo_cancel_flags += ['-DHAVE_ADRIAN_EC=1'] + +# FIXME: support ORC (depends on Adrian) +#ORC_SOURCE += modules/echo-cancel/adrian-aec +#module_echo_cancel_sources += [ +# 'echo-cancel/adrian-aec-orc-gen.c', 'echo-cancel/adrian-aec-orc-gen.h' +#] +#module_echo_cancel_deps += [orc_dep] + +if speex_dep.found() + module_echo_cancel_sources += ['echo-cancel/speex.c'] + module_echo_cancel_deps += [speex_dep] +endif + +if webrtc_dep.found() + subdir('echo-cancel') + module_echo_cancel_libs += [libwebrtc_util] +endif + +all_modules += [ + [ 'module-echo-cancel', + module_echo_cancel_sources, + [], + module_echo_cancel_flags, + module_echo_cancel_deps, + module_echo_cancel_libs, + ] +] + +# Generate a shared module object for each modules + foreach m : all_modules name = m[0] sources = m[1] diff --git a/src/pulsecore/meson.build b/src/pulsecore/meson.build index 7057daf..a683004 100644 --- a/src/pulsecore/meson.build +++ b/src/pulsecore/meson.build @@ -126,6 +126,10 @@ if dbus_dep.found() ] endif +if speex_dep.found() + libpulsecore_sources += ['resampler/speex.c'] +endif + if x11_dep.found() libpulsecore_sources += ['x11wrap.c'] libpulsecore_headers += ['x11wrap.h'] @@ -159,7 +163,7 @@ libpulsecore = shared_library('pulsecore-' + pa_version_major_minor, c_args : [pa_c_args, server_c_args], install : true, link_with : libpulsecore_simd_lib, - dependencies : [libm_dep, libpulsecommon_dep, libpulse_dep, ltdl_dep, shm_dep, sndfile_dep, database_dep, dbus_dep, x11_dep], + dependencies : [libm_dep, libpulsecommon_dep, libpulse_dep, ltdl_dep, shm_dep, sndfile_dep, database_dep, dbus_dep, speex_dep, x11_dep], implicit_include_directories : false) libpulsecore_dep = declare_dependency(link_with: libpulsecore) -- 2.7.4