From a699262e7291f3eed4439ab271d25b35db473a2a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Fri, 19 Mar 2021 11:01:07 -0400
Subject: [PATCH] build: fix meson for webrtc support

Change-Id: Iedcfe91af40893004c8f640c8a718966db8d7468
---
 meson.build       |  3 +++
 meson_options.txt |  1 +
 src/meson.build   | 11 +++++++++++
 3 files changed, 15 insertions(+)

diff --git a/meson.build b/meson.build
index f8e660811c..de1f69b878 100644
--- a/meson.build
+++ b/meson.build
@@ -80,6 +80,9 @@ conf.set10('HAVE_PULSE', deplibpulse.found())
 depjack = dependency('jack', required: get_option('jack'))
 conf.set10('HAVE_JACK', depjack.found())
 
+depwebrtcap = dependency('webrtc-audio-processing', required: get_option('webrtc-audio-processing'))
+conf.set10('HAVE_WEBRTC_AP', depwebrtcap.found())
+
 depportaudio = dependency('portaudio-2.0', required: get_option('portaudio'))
 conf.set10('HAVE_PORTAUDIO', depportaudio.found())
 
diff --git a/meson_options.txt b/meson_options.txt
index 32d46b76c3..1935b0181b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -11,6 +11,7 @@ option('jack', type: 'feature', value: 'auto', description: 'Enable support for
 option('portaudio', type: 'feature', value: 'auto', description: 'Enable support for PortAudio')
 option('upnp', type: 'feature', value: 'auto', description: 'Enable support for UPnP')
 option('natpmp', type: 'feature', value: 'auto', description: 'Enable support for NAT-PMP')
+option('webrtc-audio-processing', type: 'feature', value: 'auto', description: 'Enable support for WebRtc audio processing')
 
 option('natpmp_prefix', type: 'string', value: '', description: 'Override a system directory to search for the library "natpmp"')
 option('tests', type: 'boolean', value: false, description: 'Build tests')
diff --git a/src/meson.build b/src/meson.build
index 24993df574..0b8826dfb3 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -45,6 +45,9 @@ libjami_sources = files(
     'media/audio/audio_receive_thread.cpp',
     'media/audio/audio_rtp_session.cpp',
     'media/audio/audio_sender.cpp',
+    'media/audio/echo-cancel/echo_canceller.h',
+    'media/audio/echo-cancel/null_echo_canceller.h',
+    'media/audio/echo-cancel/null_echo_canceller.cpp',
     'media/audio/dcblocker.cpp',
     'media/audio/dsp.cpp',
     'media/audio/resampler.cpp',
@@ -159,6 +162,14 @@ if conf.get('HAVE_PULSE') == 1
     libjami_dependencies += deplibpulse
 endif
 
+if conf.get('HAVE_WEBRTC_AP') == 1
+    libjami_sources += files(
+        'media/audio/echo-cancel/webrtc_echo_canceller.h',
+        'media/audio/echo-cancel/webrtc_echo_canceller.cpp'
+    )
+    libjami_dependencies += depwebrtcap
+endif
+
 if conf.get('HAVE_JACK') == 1
     libjami_sources += files(
         'media/audio/jack/jacklayer.cpp'
-- 
GitLab