From f0ab406bfd320ba4cab011818521cc2131b0e855 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Wed, 12 Jun 2024 22:34:33 -0400 Subject: [PATCH] gnu: mswebrtc: Update to 1.1.2. * gnu/packages/patches/mswebrtc-b64-refactor.patch: New patch. * gnu/packages/patches/mswebrtc-cmake.patch: Likewise. * gnu/local.mk (dist_patch_DATA): Register them. * gnu/packages/linphone.scm (mswebrtc): Update to 1.1.2. [source]: Apply patches. Change-Id: I9ff3ce3b26179f365d8a36ed7a6106b7fcd9e4fb --- gnu/local.mk | 2 + gnu/packages/linphone.scm | 100 +- .../patches/mswebrtc-b64-refactor.patch | 949 ++++++++++++++++++ gnu/packages/patches/mswebrtc-cmake.patch | 626 ++++++++++++ 4 files changed, 1629 insertions(+), 48 deletions(-) create mode 100644 gnu/packages/patches/mswebrtc-b64-refactor.patch create mode 100644 gnu/packages/patches/mswebrtc-cmake.patch diff --git a/gnu/local.mk b/gnu/local.mk index daad880fcb..1295eb9807 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1903,6 +1903,8 @@ dist_patch_DATA = \ %D%/packages/patches/mosaicatcher-unbundle-htslib.patch \ %D%/packages/patches/mrrescue-support-love-11.patch \ %D%/packages/patches/mrustc-patches.patch \ + %D%/packages/patches/mswebrtc-b64-refactor.patch \ + %D%/packages/patches/mswebrtc-cmake.patch \ %D%/packages/patches/mtools-mformat-uninitialized.patch \ %D%/packages/patches/mupen64plus-ui-console-notice.patch \ %D%/packages/patches/musescore-fix-build.patch \ diff --git a/gnu/packages/linphone.scm b/gnu/packages/linphone.scm index 0090899072..89467734e9 100644 --- a/gnu/packages/linphone.scm +++ b/gnu/packages/linphone.scm @@ -967,55 +967,59 @@ codec. It is based on the Skype's SILK implementation.") (license license:gpl2+)))) (define-public mswebrtc - (let ((commit "946ca706733f36a6b4923f04e569531125462d1d") - (revision "0")) - (package - (name "mswebrtc") - (version (git-version "1.1.1" revision commit)) - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://gitlab.linphone.org/BC/public/mswebrtc") - (commit commit))) - (file-name (git-file-name name version)) - (sha256 - (base32 "1pfg9m6bpbv0f53nx72rdxhlyriax9pg4yj0gpwq8ha6lqnpwg1x")))) - (build-system cmake-build-system) - (arguments - `(#:tests? #f ; No test target - #:configure-flags - (list - "-DENABLE_STATIC=NO") - #:phases - (modify-phases %standard-phases - (add-after 'unpack 'copy-inputs - (lambda* (#:key inputs outputs #:allow-other-keys) - (let* ((webrtc-from (assoc-ref inputs "webrtc")) - (webrtc-to (string-append (getcwd) "/webrtc"))) - (copy-recursively webrtc-from webrtc-to)) - #t))))) - (native-inputs - `(("webrtc" - ,(origin - (method git-fetch) - (uri - (git-reference - (url "https://gitlab.linphone.org/BC/public/external/webrtc") - (commit "583acd27665cfadef8ab03eb85a768d308bd29dd"))) - (file-name - (git-file-name "webrtc-for-mswebrtc" version)) - (sha256 - (base32 - "1maqychrgwy0z4zypa03qp726l2finw64z6cymdzhd58ql3p1lvm")))) - ("python" ,python-wrapper))) - (inputs - (list bctoolbox mediastreamer2 ortp)) - (synopsis "Media Streamer WebRTC Codec") - (description "MSWebRTC is a plugin of MediaStreamer, adding support for + ;; A newer, unreleased commit is needed to detect a recent oRTP; use the + ;; latest one available. + (package + (name "mswebrtc") + (version "1.1.2") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://gitlab.linphone.org/BC/public/mswebrtc") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 "10j124vd9zm03s1vzb74n3zjrf6x1nfvji7vryih4dq2xlgrqxx6")) + (patches (search-patches "mswebrtc-b64-refactor.patch" + "mswebrtc-cmake.patch")))) + (build-system cmake-build-system) + (arguments + (list + #:tests? #f ; No test target + #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'patch-Mediastreamer2_PLUGINS_DIR + (lambda _ + (substitute* "CMakeLists.txt" + (("\\$\\{Mediastreamer2_PLUGINS_DIR}") + (string-append #$output "/lib/mediastreamer/plugins"))))) + (add-after 'unpack 'copy-inputs + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((webrtc-from (assoc-ref inputs "webrtc")) + (webrtc-to (string-append (getcwd) "/webrtc"))) + (copy-recursively webrtc-from webrtc-to))))))) + (native-inputs + `(("webrtc" + ,(origin + (method git-fetch) + (uri + (git-reference + (url "https://gitlab.linphone.org/BC/public/external/webrtc") + (commit "583acd27665cfadef8ab03eb85a768d308bd29dd"))) + (file-name + (git-file-name "webrtc-for-mswebrtc" version)) + (sha256 + (base32 + "1maqychrgwy0z4zypa03qp726l2finw64z6cymdzhd58ql3p1lvm")))) + ("python" ,python-wrapper))) + (inputs (list bctoolbox mediastreamer2 ortp)) + (synopsis "Media Streamer WebRTC Codec") + (description "MSWebRTC is a plugin of MediaStreamer, adding support for WebRTC codec. It includes features from WebRTC, such as, iSAC and AECM.") - (home-page "https://gitlab.linphone.org/BC/public/mswebrtc") - (license license:gpl2+)))) + (home-page "https://gitlab.linphone.org/BC/public/mswebrtc") + (license license:gpl2+))) (define-public msamr ;; The latest 1.1.4 release is 2 years old, doesn't build with a recent diff --git a/gnu/packages/patches/mswebrtc-b64-refactor.patch b/gnu/packages/patches/mswebrtc-b64-refactor.patch new file mode 100644 index 0000000000..af4a1e1682 --- /dev/null +++ b/gnu/packages/patches/mswebrtc-b64-refactor.patch @@ -0,0 +1,949 @@ +From 17e72f00831a36da387ceafe7f3076ffa8f66aba Mon Sep 17 00:00:00 2001 +From: Clemence Him +Date: Fri, 22 Sep 2023 14:28:02 +0200 +Subject: [PATCH] Base64 functions refactoring + +--- + aec.c | 781 +++++++++++++++++++++++++++++----------------------------- + 1 file changed, 394 insertions(+), 387 deletions(-) + +diff --git a/aec.c b/aec.c +index 271f370..995f655 100644 +--- a/aec.c ++++ b/aec.c +@@ -24,19 +24,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + #include "mediastreamer2/msfilter.h" + #include "mediastreamer2/msticker.h" + #ifdef BUILD_AEC +-#include "echo_cancellation.h" + #include "aec_splitting_filter.h" ++#include "echo_cancellation.h" + #endif + #ifdef BUILD_AECM + #include "echo_control_mobile.h" + #endif +-#include "ortp/b64.h" + + #ifdef _WIN32 + #include /* for alloca */ + #endif + +-//#define EC_DUMP 1 ++// #define EC_DUMP 1 + #ifdef ANDROID + #define EC_DUMP_PREFIX "/sdcard" + #else +@@ -48,466 +47,485 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + static const float smooth_factor = 0.05f; + static const int framesize = 80; + +- + typedef enum _WebRTCAECType { +- WebRTCAECTypeNormal, +- WebRTCAECTypeMobile ++ WebRTCAECTypeNormal, ++ WebRTCAECTypeMobile + } WebRTCAECType; + + typedef struct WebRTCAECState { +- void *aecInst; +- MSBufferizer delayed_ref; +- MSFlowControlledBufferizer ref; +- MSBufferizer echo; +- int framesize; +- int samplerate; +- int delay_ms; +- int nominal_ref_samples; +- char *state_str; ++ void *aecInst; ++ MSBufferizer delayed_ref; ++ MSFlowControlledBufferizer ref; ++ MSBufferizer echo; ++ int framesize; ++ int samplerate; ++ int delay_ms; ++ int nominal_ref_samples; ++ char *state_str; + #ifdef EC_DUMP +- FILE *echofile; +- FILE *reffile; +- FILE *cleanfile; ++ FILE *echofile; ++ FILE *reffile; ++ FILE *cleanfile; + #endif +- bool_t echostarted; +- bool_t bypass_mode; +- bool_t using_zeroes; +- WebRTCAECType aec_type; ++ bool_t echostarted; ++ bool_t bypass_mode; ++ bool_t using_zeroes; ++ WebRTCAECType aec_type; + #ifdef BUILD_AEC +- MSWebRtcAecSplittingFilter *splitting_filter; ++ MSWebRtcAecSplittingFilter *splitting_filter; + #endif + } WebRTCAECState; + + static void webrtc_aecgeneric_init(MSFilter *f, WebRTCAECType aec_type) { +- WebRTCAECState *s = (WebRTCAECState *) ms_new0(WebRTCAECState, 1); +- +- s->samplerate = 8000; +- ms_bufferizer_init(&s->delayed_ref); +- ms_bufferizer_init(&s->echo); +- ms_flow_controlled_bufferizer_init(&s->ref, f, s->samplerate, 1); +- s->delay_ms = 0; +- s->aecInst = NULL; +- s->framesize = framesize; +- s->state_str = NULL; +- s->using_zeroes = FALSE; +- s->echostarted = FALSE; +- s->bypass_mode = FALSE; +- s->aec_type = aec_type; ++ WebRTCAECState *s = (WebRTCAECState *)ms_new0(WebRTCAECState, 1); ++ ++ s->samplerate = 8000; ++ ms_bufferizer_init(&s->delayed_ref); ++ ms_bufferizer_init(&s->echo); ++ ms_flow_controlled_bufferizer_init(&s->ref, f, s->samplerate, 1); ++ s->delay_ms = 0; ++ s->aecInst = NULL; ++ s->framesize = framesize; ++ s->state_str = NULL; ++ s->using_zeroes = FALSE; ++ s->echostarted = FALSE; ++ s->bypass_mode = FALSE; ++ s->aec_type = aec_type; + + #ifdef EC_DUMP +- { +- char *fname = ms_strdup_printf("%s/mswebrtcaec-%p-echo.raw", EC_DUMP_PREFIX, f); +- s->echofile = fopen(fname, "w"); +- ms_free(fname); +- fname = ms_strdup_printf("%s/mswebrtcaec-%p-ref.raw", EC_DUMP_PREFIX, f); +- s->reffile = fopen(fname, "w"); +- ms_free(fname); +- fname = ms_strdup_printf("%s/mswebrtcaec-%p-clean.raw", EC_DUMP_PREFIX, f); +- s->cleanfile = fopen(fname, "w"); +- ms_free(fname); +- } ++ { ++ char *fname = ++ ms_strdup_printf("%s/mswebrtcaec-%p-echo.raw", EC_DUMP_PREFIX, f); ++ s->echofile = fopen(fname, "w"); ++ ms_free(fname); ++ fname = ms_strdup_printf("%s/mswebrtcaec-%p-ref.raw", EC_DUMP_PREFIX, f); ++ s->reffile = fopen(fname, "w"); ++ ms_free(fname); ++ fname = ms_strdup_printf("%s/mswebrtcaec-%p-clean.raw", EC_DUMP_PREFIX, f); ++ s->cleanfile = fopen(fname, "w"); ++ ms_free(fname); ++ } + #endif + +- f->data = s; ++ f->data = s; + } + + #ifdef BUILD_AEC + static void webrtc_aec_init(MSFilter *f) { +- webrtc_aecgeneric_init(f, WebRTCAECTypeNormal); ++ webrtc_aecgeneric_init(f, WebRTCAECTypeNormal); + } + #endif + + #ifdef BUILD_AECM + static void webrtc_aecm_init(MSFilter *f) { +- webrtc_aecgeneric_init(f, WebRTCAECTypeMobile); ++ webrtc_aecgeneric_init(f, WebRTCAECTypeMobile); + } + #endif + + static void webrtc_aec_uninit(MSFilter *f) { +- WebRTCAECState *s = (WebRTCAECState *) f->data; +- if (s->state_str) ms_free(s->state_str); +- ms_bufferizer_uninit(&s->delayed_ref); ++ WebRTCAECState *s = (WebRTCAECState *)f->data; ++ if (s->state_str) ++ ms_free(s->state_str); ++ ms_bufferizer_uninit(&s->delayed_ref); + #ifdef EC_DUMP +- if (s->echofile) +- fclose(s->echofile); +- if (s->reffile) +- fclose(s->reffile); ++ if (s->echofile) ++ fclose(s->echofile); ++ if (s->reffile) ++ fclose(s->reffile); + #endif +- ms_free(s); ++ ms_free(s); + } + + static void configure_flow_controlled_bufferizer(WebRTCAECState *s) { +- ms_flow_controlled_bufferizer_set_samplerate(&s->ref, s->samplerate); +- ms_flow_controlled_bufferizer_set_max_size_ms(&s->ref, s->delay_ms); +- ms_flow_controlled_bufferizer_set_granularity_ms(&s->ref, (s->framesize * 1000) / s->samplerate); ++ ms_flow_controlled_bufferizer_set_samplerate(&s->ref, s->samplerate); ++ ms_flow_controlled_bufferizer_set_max_size_ms(&s->ref, s->delay_ms); ++ ms_flow_controlled_bufferizer_set_granularity_ms( ++ &s->ref, (s->framesize * 1000) / s->samplerate); + } + + static void webrtc_aec_preprocess(MSFilter *f) { +- WebRTCAECState *s = (WebRTCAECState *) f->data; ++ WebRTCAECState *s = (WebRTCAECState *)f->data; + #ifdef BUILD_AEC +- AecConfig aec_config; ++ AecConfig aec_config; + #endif + #ifdef BUILD_AECM +- AecmConfig aecm_config; +- int error_code; ++ AecmConfig aecm_config; ++ int error_code; + #endif +- int delay_samples = 0; +- mblk_t *m; ++ int delay_samples = 0; ++ mblk_t *m; + +- s->echostarted = FALSE; +- delay_samples = s->delay_ms * s->samplerate / 1000; +- s->framesize=(framesize*s->samplerate)/8000; +- ms_message("Initializing WebRTC echo canceler with framesize=%i, delay_ms=%i, delay_samples=%i", s->framesize, s->delay_ms, delay_samples); +- configure_flow_controlled_bufferizer(s); ++ s->echostarted = FALSE; ++ delay_samples = s->delay_ms * s->samplerate / 1000; ++ s->framesize = (framesize * s->samplerate) / 8000; ++ ms_message("Initializing WebRTC echo canceler with framesize=%i, " ++ "delay_ms=%i, delay_samples=%i", ++ s->framesize, s->delay_ms, delay_samples); ++ configure_flow_controlled_bufferizer(s); + + #ifdef BUILD_AEC +- if (s->aec_type == WebRTCAECTypeNormal) { +- if ((s->aecInst = WebRtcAec_Create()) == NULL) { +- s->bypass_mode = TRUE; +- ms_error("WebRtcAec_Create(): error, entering bypass mode"); +- return; +- } +- if ((WebRtcAec_Init(s->aecInst, MIN(48000, s->samplerate), s->samplerate)) < 0) { +- ms_error("WebRtcAec_Init(): WebRTC echo canceller does not support %d samplerate", s->samplerate); +- s->bypass_mode = TRUE; +- ms_error("Entering bypass mode"); +- return; +- } +- aec_config.nlpMode = kAecNlpAggressive; +- aec_config.skewMode = kAecFalse; +- aec_config.metricsMode = kAecFalse; +- aec_config.delay_logging = kAecFalse; +- if (WebRtcAec_set_config(s->aecInst, aec_config) != 0) { +- ms_error("WebRtcAec_set_config(): failed."); +- } +- } ++ if (s->aec_type == WebRTCAECTypeNormal) { ++ if ((s->aecInst = WebRtcAec_Create()) == NULL) { ++ s->bypass_mode = TRUE; ++ ms_error("WebRtcAec_Create(): error, entering bypass mode"); ++ return; ++ } ++ if ((WebRtcAec_Init(s->aecInst, MIN(48000, s->samplerate), s->samplerate)) < ++ 0) { ++ ms_error("WebRtcAec_Init(): WebRTC echo canceller does not support %d " ++ "samplerate", ++ s->samplerate); ++ s->bypass_mode = TRUE; ++ ms_error("Entering bypass mode"); ++ return; ++ } ++ aec_config.nlpMode = kAecNlpAggressive; ++ aec_config.skewMode = kAecFalse; ++ aec_config.metricsMode = kAecFalse; ++ aec_config.delay_logging = kAecFalse; ++ if (WebRtcAec_set_config(s->aecInst, aec_config) != 0) { ++ ms_error("WebRtcAec_set_config(): failed."); ++ } ++ } + #endif + #ifdef BUILD_AECM +- if (s->aec_type == WebRTCAECTypeMobile) { +- if ((s->aecInst = WebRtcAecm_Create()) == NULL) { +- s->bypass_mode = TRUE; +- ms_error("WebRtcAecm_Create(): error, entering bypass mode"); +- return; +- } +- if ((error_code = WebRtcAecm_Init(s->aecInst, s->samplerate)) < 0) { +- if (error_code == AECM_BAD_PARAMETER_ERROR) { +- ms_error("WebRtcAecm_Init(): WebRTC echo canceller does not support %d samplerate", s->samplerate); +- } +- s->bypass_mode = TRUE; +- ms_error("Entering bypass mode"); +- return; +- } +- aecm_config.cngMode = TRUE; +- aecm_config.echoMode = 3; +- if (WebRtcAecm_set_config(s->aecInst, aecm_config)!=0){ +- ms_error("WebRtcAecm_set_config(): failed."); +- } +- } ++ if (s->aec_type == WebRTCAECTypeMobile) { ++ if ((s->aecInst = WebRtcAecm_Create()) == NULL) { ++ s->bypass_mode = TRUE; ++ ms_error("WebRtcAecm_Create(): error, entering bypass mode"); ++ return; ++ } ++ if ((error_code = WebRtcAecm_Init(s->aecInst, s->samplerate)) < 0) { ++ if (error_code == AECM_BAD_PARAMETER_ERROR) { ++ ms_error("WebRtcAecm_Init(): WebRTC echo canceller does not support %d " ++ "samplerate", ++ s->samplerate); ++ } ++ s->bypass_mode = TRUE; ++ ms_error("Entering bypass mode"); ++ return; ++ } ++ aecm_config.cngMode = TRUE; ++ aecm_config.echoMode = 3; ++ if (WebRtcAecm_set_config(s->aecInst, aecm_config) != 0) { ++ ms_error("WebRtcAecm_set_config(): failed."); ++ } ++ } + #endif + +- /* fill with zeroes for the time of the delay*/ +- m = allocb(delay_samples * 2, 0); +- m->b_wptr += delay_samples * 2; +- ms_bufferizer_put(&s->delayed_ref, m); +- s->nominal_ref_samples = delay_samples; ++ /* fill with zeroes for the time of the delay*/ ++ m = allocb(delay_samples * 2, 0); ++ m->b_wptr += delay_samples * 2; ++ ms_bufferizer_put(&s->delayed_ref, m); ++ s->nominal_ref_samples = delay_samples; + } + + /* inputs[0]= reference signal from far end (sent to soundcard) + * inputs[1]= near speech & echo signal (read from soundcard) + * outputs[0]= is a copy of inputs[0] to be sent to soundcard + * outputs[1]= near end speech, echo removed - towards far end +-*/ ++ */ + static void webrtc_aec_process(MSFilter *f) { +- WebRTCAECState *s = (WebRTCAECState *) f->data; +- int nbytes = s->framesize * sizeof(int16_t); +- mblk_t *refm; +- int16_t *ref, *echo; +- int nbands = 1; +- int bandsize = s->framesize; +- +- if (s->bypass_mode) { +- while ((refm = ms_queue_get(f->inputs[0])) != NULL) { +- ms_queue_put(f->outputs[0], refm); +- } +- while ((refm = ms_queue_get(f->inputs[1])) != NULL) { +- ms_queue_put(f->outputs[1], refm); +- } +- return; +- } +- +- if (f->inputs[0] != NULL) { +- if (s->echostarted) { +- while ((refm = ms_queue_get(f->inputs[0])) != NULL) { +- mblk_t *cp=dupmsg(refm); +- ms_bufferizer_put(&s->delayed_ref,cp); +- ms_flow_controlled_bufferizer_put(&s->ref,refm); +- } +- } else { +- ms_warning("Getting reference signal but no echo to synchronize on."); +- ms_queue_flush(f->inputs[0]); +- } +- } +- +- ms_bufferizer_put_from_queue(&s->echo, f->inputs[1]); +- +- ref = (int16_t *) alloca(nbytes); +- echo = (int16_t *) alloca(nbytes); ++ WebRTCAECState *s = (WebRTCAECState *)f->data; ++ int nbytes = s->framesize * sizeof(int16_t); ++ mblk_t *refm; ++ int16_t *ref, *echo; ++ int nbands = 1; ++ int bandsize = s->framesize; ++ ++ if (s->bypass_mode) { ++ while ((refm = ms_queue_get(f->inputs[0])) != NULL) { ++ ms_queue_put(f->outputs[0], refm); ++ } ++ while ((refm = ms_queue_get(f->inputs[1])) != NULL) { ++ ms_queue_put(f->outputs[1], refm); ++ } ++ return; ++ } ++ ++ if (f->inputs[0] != NULL) { ++ if (s->echostarted) { ++ while ((refm = ms_queue_get(f->inputs[0])) != NULL) { ++ mblk_t *cp = dupmsg(refm); ++ ms_bufferizer_put(&s->delayed_ref, cp); ++ ms_flow_controlled_bufferizer_put(&s->ref, refm); ++ } ++ } else { ++ ms_warning("Getting reference signal but no echo to synchronize on."); ++ ms_queue_flush(f->inputs[0]); ++ } ++ } ++ ++ ms_bufferizer_put_from_queue(&s->echo, f->inputs[1]); ++ ++ ref = (int16_t *)alloca(nbytes); ++ echo = (int16_t *)alloca(nbytes); + #ifdef BUILD_AEC +- if (s->aec_type == WebRTCAECTypeNormal) { +- if (s->samplerate > 16000) { +- nbands = s->samplerate / 16000; +- bandsize = 160; +- } +- if (!s->splitting_filter) { +- s->splitting_filter = mswebrtc_aec_splitting_filter_create(nbands, bandsize); +- } +- } ++ if (s->aec_type == WebRTCAECTypeNormal) { ++ if (s->samplerate > 16000) { ++ nbands = s->samplerate / 16000; ++ bandsize = 160; ++ } ++ if (!s->splitting_filter) { ++ s->splitting_filter = ++ mswebrtc_aec_splitting_filter_create(nbands, bandsize); ++ } ++ } + #endif +- while (ms_bufferizer_read(&s->echo, (uint8_t *)echo, (size_t)nbytes) >= (size_t)nbytes) { +- mblk_t *oecho = allocb(nbytes, 0); +- int avail; +- int avail_samples; +- +- if (!s->echostarted) s->echostarted = TRUE; +- if ((avail = ms_bufferizer_get_avail(&s->delayed_ref)) < ((s->nominal_ref_samples * 2) + nbytes)) { +- /*we don't have enough to read in a reference signal buffer, inject silence instead*/ +- refm = allocb(nbytes, 0); +- memset(refm->b_wptr, 0, nbytes); +- refm->b_wptr += nbytes; +- ms_bufferizer_put(&s->delayed_ref, refm); +- /* +- * However, we don't inject this silence buffer to the sound card, in order to break the following bad loop: +- * - the sound playback filter detects it has too many pending samples, then triggers an event to request samples to be dropped upstream. +- * - the upstream MSFlowControl filter is requested to drop samples, which it starts to do. +- * - necessarily shortly after the AEC goes into a situation where it has not enough reference samples while processing an audio buffer from mic. +- * - if the AEC injects a silence buffer as output, then it will RECREATE a situation where the sound playback filter has too many pending samples. +- * That's why we should not do this. +- * By not doing this, we will create a discrepancy between what we really injected to the soundcard, and what we told to the +- * echo canceller about the samples we injected. This shifts the echo. The echo canceller will re-converge quickly to take into +- * account the situation. +- * +- */ +- //ms_queue_put(f->outputs[0], dupmsg(refm)); +- if (!s->using_zeroes) { +- ms_warning("Not enough ref samples, using zeroes"); +- s->using_zeroes = TRUE; +- } +- } else { +- if (s->using_zeroes) { +- ms_message("Samples are back."); +- s->using_zeroes = FALSE; +- } +- /* read from our no-delay buffer and output */ +- refm = allocb(nbytes, 0); +- if (ms_flow_controlled_bufferizer_read(&s->ref, refm->b_wptr, nbytes) == 0) { +- ms_fatal("Should never happen"); +- } +- refm->b_wptr += nbytes; +- ms_queue_put(f->outputs[0], refm); +- } +- +- /*now read a valid buffer of delayed ref samples*/ +- if (ms_bufferizer_read(&s->delayed_ref, (uint8_t *)ref, nbytes) == 0) { +- ms_fatal("Should never happen"); +- } +- avail -= nbytes; +- avail_samples = avail / 2; ++ while (ms_bufferizer_read(&s->echo, (uint8_t *)echo, (size_t)nbytes) >= ++ (size_t)nbytes) { ++ mblk_t *oecho = allocb(nbytes, 0); ++ int avail; ++ int avail_samples; ++ ++ if (!s->echostarted) ++ s->echostarted = TRUE; ++ if ((avail = ms_bufferizer_get_avail(&s->delayed_ref)) < ++ ((s->nominal_ref_samples * 2) + nbytes)) { ++ /*we don't have enough to read in a reference signal buffer, inject ++ * silence instead*/ ++ refm = allocb(nbytes, 0); ++ memset(refm->b_wptr, 0, nbytes); ++ refm->b_wptr += nbytes; ++ ms_bufferizer_put(&s->delayed_ref, refm); ++ /* ++ * However, we don't inject this silence buffer to the sound card, in ++ * order to break the following bad loop: ++ * - the sound playback filter detects it has too many pending samples, ++ * then triggers an event to request samples to be dropped upstream. ++ * - the upstream MSFlowControl filter is requested to drop samples, which ++ * it starts to do. ++ * - necessarily shortly after the AEC goes into a situation where it has ++ * not enough reference samples while processing an audio buffer from mic. ++ * - if the AEC injects a silence buffer as output, then it will RECREATE ++ * a situation where the sound playback filter has too many pending ++ * samples. That's why we should not do this. By not doing this, we will ++ * create a discrepancy between what we really injected to the soundcard, ++ * and what we told to the echo canceller about the samples we injected. ++ * This shifts the echo. The echo canceller will re-converge quickly to ++ * take into account the situation. ++ * ++ */ ++ // ms_queue_put(f->outputs[0], dupmsg(refm)); ++ if (!s->using_zeroes) { ++ ms_warning("Not enough ref samples, using zeroes"); ++ s->using_zeroes = TRUE; ++ } ++ } else { ++ if (s->using_zeroes) { ++ ms_message("Samples are back."); ++ s->using_zeroes = FALSE; ++ } ++ /* read from our no-delay buffer and output */ ++ refm = allocb(nbytes, 0); ++ if (ms_flow_controlled_bufferizer_read(&s->ref, refm->b_wptr, nbytes) == ++ 0) { ++ ms_fatal("Should never happen"); ++ } ++ refm->b_wptr += nbytes; ++ ms_queue_put(f->outputs[0], refm); ++ } ++ ++ /*now read a valid buffer of delayed ref samples*/ ++ if (ms_bufferizer_read(&s->delayed_ref, (uint8_t *)ref, nbytes) == 0) { ++ ms_fatal("Should never happen"); ++ } ++ avail -= nbytes; ++ avail_samples = avail / 2; + + #ifdef EC_DUMP +- if (s->reffile) +- fwrite(ref, nbytes, 1, s->reffile); +- if (s->echofile) +- fwrite(echo, nbytes, 1, s->echofile); ++ if (s->reffile) ++ fwrite(ref, nbytes, 1, s->reffile); ++ if (s->echofile) ++ fwrite(echo, nbytes, 1, s->echofile); + #endif + #ifdef BUILD_AEC +- if (s->aec_type == WebRTCAECTypeNormal) { +- mswebrtc_aec_splitting_filter_analysis(s->splitting_filter, ref, echo); +- if (WebRtcAec_BufferFarend(s->aecInst, +- mswebrtc_aec_splitting_filter_get_ref(s->splitting_filter), +- (size_t)mswebrtc_aec_splitting_filter_get_bandsize(s->splitting_filter)) != 0) +- ms_error("WebRtcAec_BufferFarend() failed."); +- if (WebRtcAec_Process(s->aecInst, +- mswebrtc_aec_splitting_filter_get_echo_bands(s->splitting_filter), +- mswebrtc_aec_splitting_filter_get_number_of_bands(s->splitting_filter), +- mswebrtc_aec_splitting_filter_get_output_bands(s->splitting_filter), +- (size_t)mswebrtc_aec_splitting_filter_get_bandsize(s->splitting_filter), 0, 0) != 0) +- ms_error("WebRtcAec_Process() failed."); +- mswebrtc_aec_splitting_filter_synthesis(s->splitting_filter, (int16_t *)oecho->b_wptr); +- } ++ if (s->aec_type == WebRTCAECTypeNormal) { ++ mswebrtc_aec_splitting_filter_analysis(s->splitting_filter, ref, echo); ++ if (WebRtcAec_BufferFarend( ++ s->aecInst, ++ mswebrtc_aec_splitting_filter_get_ref(s->splitting_filter), ++ (size_t)mswebrtc_aec_splitting_filter_get_bandsize( ++ s->splitting_filter)) != 0) ++ ms_error("WebRtcAec_BufferFarend() failed."); ++ if (WebRtcAec_Process( ++ s->aecInst, ++ mswebrtc_aec_splitting_filter_get_echo_bands(s->splitting_filter), ++ mswebrtc_aec_splitting_filter_get_number_of_bands( ++ s->splitting_filter), ++ mswebrtc_aec_splitting_filter_get_output_bands( ++ s->splitting_filter), ++ (size_t)mswebrtc_aec_splitting_filter_get_bandsize( ++ s->splitting_filter), ++ 0, 0) != 0) ++ ms_error("WebRtcAec_Process() failed."); ++ mswebrtc_aec_splitting_filter_synthesis(s->splitting_filter, ++ (int16_t *)oecho->b_wptr); ++ } + #endif + #ifdef BUILD_AECM +- if (s->aec_type == WebRTCAECTypeMobile) { +- if (WebRtcAecm_BufferFarend(s->aecInst, ref, (size_t)s->framesize) != 0) +- ms_error("WebRtcAecm_BufferFarend() failed."); +- if (WebRtcAecm_Process(s->aecInst, echo, NULL, (int16_t *)oecho->b_wptr, (size_t)s->framesize, 0) != 0) +- ms_error("WebRtcAecm_Process() failed."); +- } ++ if (s->aec_type == WebRTCAECTypeMobile) { ++ if (WebRtcAecm_BufferFarend(s->aecInst, ref, (size_t)s->framesize) != 0) ++ ms_error("WebRtcAecm_BufferFarend() failed."); ++ if (WebRtcAecm_Process(s->aecInst, echo, NULL, (int16_t *)oecho->b_wptr, ++ (size_t)s->framesize, 0) != 0) ++ ms_error("WebRtcAecm_Process() failed."); ++ } + #endif + #ifdef EC_DUMP +- if (s->cleanfile) +- fwrite(oecho->b_wptr, nbytes, 1, s->cleanfile); ++ if (s->cleanfile) ++ fwrite(oecho->b_wptr, nbytes, 1, s->cleanfile); + #endif +- oecho->b_wptr += nbytes; +- ms_queue_put(f->outputs[1], oecho); +- } ++ oecho->b_wptr += nbytes; ++ ms_queue_put(f->outputs[1], oecho); ++ } + } + + static void webrtc_aec_postprocess(MSFilter *f) { +- WebRTCAECState *s = (WebRTCAECState *) f->data; ++ WebRTCAECState *s = (WebRTCAECState *)f->data; + +- ms_bufferizer_flush(&s->delayed_ref); +- ms_bufferizer_flush(&s->echo); +- ms_flow_controlled_bufferizer_flush(&s->ref); ++ ms_bufferizer_flush(&s->delayed_ref); ++ ms_bufferizer_flush(&s->echo); ++ ms_flow_controlled_bufferizer_flush(&s->ref); + #ifdef BUILD_AEC +- if (s->splitting_filter) { +- mswebrtc_aec_splitting_filter_destroy(s->splitting_filter); +- s->splitting_filter = NULL; +- } ++ if (s->splitting_filter) { ++ mswebrtc_aec_splitting_filter_destroy(s->splitting_filter); ++ s->splitting_filter = NULL; ++ } + #endif +- if (s->aecInst != NULL) { ++ if (s->aecInst != NULL) { + #ifdef BUILD_AEC +- if (s->aec_type == WebRTCAECTypeNormal) { +- WebRtcAec_Free(s->aecInst); +- } ++ if (s->aec_type == WebRTCAECTypeNormal) { ++ WebRtcAec_Free(s->aecInst); ++ } + #endif + #ifdef BUILD_AECM +- if (s->aec_type == WebRTCAECTypeMobile) { +- WebRtcAecm_Free(s->aecInst); +- } ++ if (s->aec_type == WebRTCAECTypeMobile) { ++ WebRtcAecm_Free(s->aecInst); ++ } + #endif +- s->aecInst = NULL; +- } ++ s->aecInst = NULL; ++ } + } + + static int webrtc_aec_set_sr(MSFilter *f, void *arg) { +- WebRTCAECState *s = (WebRTCAECState *) f->data; +- int requested_sr = *(int *) arg; +- int sr = requested_sr; +- +- if ((s->aec_type == WebRTCAECTypeNormal) && (requested_sr >= 48000)) { +- sr = 48000; +- } else if ((s->aec_type == WebRTCAECTypeNormal) && (requested_sr >= 32000)) { +- sr = 32000; +- } else if (requested_sr >= 16000) { +- sr = 16000; +- } else { +- sr = 8000; +- } +- if (sr != requested_sr) +- ms_message("Webrtc %s does not support sampling rate %i, using %i instead", ((s->aec_type == WebRTCAECTypeNormal)?"aec":"aecm"),requested_sr, sr); +- +- s->samplerate = sr; +- configure_flow_controlled_bufferizer(s); +- return 0; ++ WebRTCAECState *s = (WebRTCAECState *)f->data; ++ int requested_sr = *(int *)arg; ++ int sr = requested_sr; ++ ++ if ((s->aec_type == WebRTCAECTypeNormal) && (requested_sr >= 48000)) { ++ sr = 48000; ++ } else if ((s->aec_type == WebRTCAECTypeNormal) && (requested_sr >= 32000)) { ++ sr = 32000; ++ } else if (requested_sr >= 16000) { ++ sr = 16000; ++ } else { ++ sr = 8000; ++ } ++ if (sr != requested_sr) ++ ms_message("Webrtc %s does not support sampling rate %i, using %i instead", ++ ((s->aec_type == WebRTCAECTypeNormal) ? "aec" : "aecm"), ++ requested_sr, sr); ++ ++ s->samplerate = sr; ++ configure_flow_controlled_bufferizer(s); ++ return 0; + } + + static int webrtc_aec_get_sr(MSFilter *f, void *arg) { +- WebRTCAECState *s = (WebRTCAECState *) f->data; +- *(int *) arg=s->samplerate; +- return 0; ++ WebRTCAECState *s = (WebRTCAECState *)f->data; ++ *(int *)arg = s->samplerate; ++ return 0; + } + + static int webrtc_aec_set_framesize(MSFilter *f, void *arg) { +- /* Do nothing because the WebRTC echo canceller only accept specific values: 80 and 160. We use 80 at 8khz, and 160 at 16khz */ +- return 0; ++ /* Do nothing because the WebRTC echo canceller only accept specific values: ++ * 80 and 160. We use 80 at 8khz, and 160 at 16khz */ ++ return 0; + } + + static int webrtc_aec_set_delay(MSFilter *f, void *arg) { +- WebRTCAECState *s = (WebRTCAECState *) f->data; +- s->delay_ms = *(int *) arg; +- configure_flow_controlled_bufferizer(s); +- return 0; ++ WebRTCAECState *s = (WebRTCAECState *)f->data; ++ s->delay_ms = *(int *)arg; ++ configure_flow_controlled_bufferizer(s); ++ return 0; + } + + static int webrtc_aec_set_tail_length(MSFilter *f, void *arg) { +- /* Do nothing because this is not needed by the WebRTC echo canceller. */ +- return 0; ++ /* Do nothing because this is not needed by the WebRTC echo canceller. */ ++ return 0; + } + static int webrtc_aec_set_bypass_mode(MSFilter *f, void *arg) { +- WebRTCAECState *s = (WebRTCAECState *) f->data; +- s->bypass_mode = *(bool_t *) arg; +- ms_message("set EC bypass mode to [%i]", s->bypass_mode); +- return 0; ++ WebRTCAECState *s = (WebRTCAECState *)f->data; ++ s->bypass_mode = *(bool_t *)arg; ++ ms_message("set EC bypass mode to [%i]", s->bypass_mode); ++ return 0; + } + static int webrtc_aec_get_bypass_mode(MSFilter *f, void *arg) { +- WebRTCAECState *s = (WebRTCAECState *) f->data; +- *(bool_t *) arg = s->bypass_mode; +- return 0; ++ WebRTCAECState *s = (WebRTCAECState *)f->data; ++ *(bool_t *)arg = s->bypass_mode; ++ return 0; + } + + static int webrtc_aec_set_state(MSFilter *f, void *arg) { +- WebRTCAECState *s = (WebRTCAECState *) f->data; +- s->state_str = ms_strdup((const char *) arg); +- return 0; ++ WebRTCAECState *s = (WebRTCAECState *)f->data; ++ s->state_str = ms_strdup((const char *)arg); ++ return 0; + } + + static int webrtc_aec_get_state(MSFilter *f, void *arg) { +- WebRTCAECState *s = (WebRTCAECState *) f->data; +- *(char **) arg = s->state_str; +- return 0; ++ WebRTCAECState *s = (WebRTCAECState *)f->data; ++ *(char **)arg = s->state_str; ++ return 0; + } + + static MSFilterMethod webrtc_aec_methods[] = { +- { MS_FILTER_SET_SAMPLE_RATE , webrtc_aec_set_sr }, +- { MS_FILTER_GET_SAMPLE_RATE , webrtc_aec_get_sr }, +- { MS_ECHO_CANCELLER_SET_TAIL_LENGTH , webrtc_aec_set_tail_length }, +- { MS_ECHO_CANCELLER_SET_DELAY , webrtc_aec_set_delay }, +- { MS_ECHO_CANCELLER_SET_FRAMESIZE , webrtc_aec_set_framesize }, +- { MS_ECHO_CANCELLER_SET_BYPASS_MODE , webrtc_aec_set_bypass_mode }, +- { MS_ECHO_CANCELLER_GET_BYPASS_MODE , webrtc_aec_get_bypass_mode }, +- { MS_ECHO_CANCELLER_GET_STATE_STRING , webrtc_aec_get_state }, +- { MS_ECHO_CANCELLER_SET_STATE_STRING , webrtc_aec_set_state }, +- { 0, NULL } +-}; +- ++ {MS_FILTER_SET_SAMPLE_RATE, webrtc_aec_set_sr}, ++ {MS_FILTER_GET_SAMPLE_RATE, webrtc_aec_get_sr}, ++ {MS_ECHO_CANCELLER_SET_TAIL_LENGTH, webrtc_aec_set_tail_length}, ++ {MS_ECHO_CANCELLER_SET_DELAY, webrtc_aec_set_delay}, ++ {MS_ECHO_CANCELLER_SET_FRAMESIZE, webrtc_aec_set_framesize}, ++ {MS_ECHO_CANCELLER_SET_BYPASS_MODE, webrtc_aec_set_bypass_mode}, ++ {MS_ECHO_CANCELLER_GET_BYPASS_MODE, webrtc_aec_get_bypass_mode}, ++ {MS_ECHO_CANCELLER_GET_STATE_STRING, webrtc_aec_get_state}, ++ {MS_ECHO_CANCELLER_SET_STATE_STRING, webrtc_aec_set_state}, ++ {0, NULL}}; + + #ifdef BUILD_AEC + +-#define MS_WEBRTC_AEC_NAME "MSWebRTCAEC" ++#define MS_WEBRTC_AEC_NAME "MSWebRTCAEC" + #define MS_WEBRTC_AEC_DESCRIPTION "Echo canceller using WebRTC library." +-#define MS_WEBRTC_AEC_CATEGORY MS_FILTER_OTHER +-#define MS_WEBRTC_AEC_ENC_FMT NULL +-#define MS_WEBRTC_AEC_NINPUTS 2 +-#define MS_WEBRTC_AEC_NOUTPUTS 2 +-#define MS_WEBRTC_AEC_FLAGS 0 ++#define MS_WEBRTC_AEC_CATEGORY MS_FILTER_OTHER ++#define MS_WEBRTC_AEC_ENC_FMT NULL ++#define MS_WEBRTC_AEC_NINPUTS 2 ++#define MS_WEBRTC_AEC_NOUTPUTS 2 ++#define MS_WEBRTC_AEC_FLAGS 0 + + #ifdef _MSC_VER + + MSFilterDesc ms_webrtc_aec_desc = { +- MS_FILTER_PLUGIN_ID, +- MS_WEBRTC_AEC_NAME, +- MS_WEBRTC_AEC_DESCRIPTION, +- MS_WEBRTC_AEC_CATEGORY, +- MS_WEBRTC_AEC_ENC_FMT, +- MS_WEBRTC_AEC_NINPUTS, +- MS_WEBRTC_AEC_NOUTPUTS, +- webrtc_aec_init, +- webrtc_aec_preprocess, +- webrtc_aec_process, +- webrtc_aec_postprocess, +- webrtc_aec_uninit, +- webrtc_aec_methods, +- MS_WEBRTC_AEC_FLAGS +-}; ++ MS_FILTER_PLUGIN_ID, MS_WEBRTC_AEC_NAME, MS_WEBRTC_AEC_DESCRIPTION, ++ MS_WEBRTC_AEC_CATEGORY, MS_WEBRTC_AEC_ENC_FMT, MS_WEBRTC_AEC_NINPUTS, ++ MS_WEBRTC_AEC_NOUTPUTS, webrtc_aec_init, webrtc_aec_preprocess, ++ webrtc_aec_process, webrtc_aec_postprocess, webrtc_aec_uninit, ++ webrtc_aec_methods, MS_WEBRTC_AEC_FLAGS}; + + #else + +-MSFilterDesc ms_webrtc_aec_desc = { +- .id = MS_FILTER_PLUGIN_ID, +- .name = MS_WEBRTC_AEC_NAME, +- .text = MS_WEBRTC_AEC_DESCRIPTION, +- .category = MS_WEBRTC_AEC_CATEGORY, +- .enc_fmt = MS_WEBRTC_AEC_ENC_FMT, +- .ninputs = MS_WEBRTC_AEC_NINPUTS, +- .noutputs = MS_WEBRTC_AEC_NOUTPUTS, +- .init = webrtc_aec_init, +- .preprocess = webrtc_aec_preprocess, +- .process = webrtc_aec_process, +- .postprocess = webrtc_aec_postprocess, +- .uninit = webrtc_aec_uninit, +- .methods = webrtc_aec_methods, +- .flags = MS_WEBRTC_AEC_FLAGS +-}; ++MSFilterDesc ms_webrtc_aec_desc = {.id = MS_FILTER_PLUGIN_ID, ++ .name = MS_WEBRTC_AEC_NAME, ++ .text = MS_WEBRTC_AEC_DESCRIPTION, ++ .category = MS_WEBRTC_AEC_CATEGORY, ++ .enc_fmt = MS_WEBRTC_AEC_ENC_FMT, ++ .ninputs = MS_WEBRTC_AEC_NINPUTS, ++ .noutputs = MS_WEBRTC_AEC_NOUTPUTS, ++ .init = webrtc_aec_init, ++ .preprocess = webrtc_aec_preprocess, ++ .process = webrtc_aec_process, ++ .postprocess = webrtc_aec_postprocess, ++ .uninit = webrtc_aec_uninit, ++ .methods = webrtc_aec_methods, ++ .flags = MS_WEBRTC_AEC_FLAGS}; + + #endif + +@@ -517,51 +535,40 @@ MS_FILTER_DESC_EXPORT(ms_webrtc_aec_desc) + + #ifdef BUILD_AECM + +-#define MS_WEBRTC_AECM_NAME "MSWebRTCAECM" +-#define MS_WEBRTC_AECM_DESCRIPTION "Echo canceller for mobile using WebRTC library." +-#define MS_WEBRTC_AECM_CATEGORY MS_FILTER_OTHER +-#define MS_WEBRTC_AECM_ENC_FMT NULL +-#define MS_WEBRTC_AECM_NINPUTS 2 +-#define MS_WEBRTC_AECM_NOUTPUTS 2 +-#define MS_WEBRTC_AECM_FLAGS 0 ++#define MS_WEBRTC_AECM_NAME "MSWebRTCAECM" ++#define MS_WEBRTC_AECM_DESCRIPTION \ ++ "Echo canceller for mobile using WebRTC library." ++#define MS_WEBRTC_AECM_CATEGORY MS_FILTER_OTHER ++#define MS_WEBRTC_AECM_ENC_FMT NULL ++#define MS_WEBRTC_AECM_NINPUTS 2 ++#define MS_WEBRTC_AECM_NOUTPUTS 2 ++#define MS_WEBRTC_AECM_FLAGS 0 + + #ifdef _MSC_VER + + MSFilterDesc ms_webrtc_aecm_desc = { +- MS_FILTER_PLUGIN_ID, +- MS_WEBRTC_AECM_NAME, +- MS_WEBRTC_AECM_DESCRIPTION, +- MS_WEBRTC_AECM_CATEGORY, +- MS_WEBRTC_AECM_ENC_FMT, +- MS_WEBRTC_AECM_NINPUTS, +- MS_WEBRTC_AECM_NOUTPUTS, +- webrtc_aecm_init, +- webrtc_aec_preprocess, +- webrtc_aec_process, +- webrtc_aec_postprocess, +- webrtc_aec_uninit, +- webrtc_aec_methods, +- MS_WEBRTC_AECM_FLAGS +-}; ++ MS_FILTER_PLUGIN_ID, MS_WEBRTC_AECM_NAME, MS_WEBRTC_AECM_DESCRIPTION, ++ MS_WEBRTC_AECM_CATEGORY, MS_WEBRTC_AECM_ENC_FMT, MS_WEBRTC_AECM_NINPUTS, ++ MS_WEBRTC_AECM_NOUTPUTS, webrtc_aecm_init, webrtc_aec_preprocess, ++ webrtc_aec_process, webrtc_aec_postprocess, webrtc_aec_uninit, ++ webrtc_aec_methods, MS_WEBRTC_AECM_FLAGS}; + + #else + +-MSFilterDesc ms_webrtc_aecm_desc = { +- .id = MS_FILTER_PLUGIN_ID, +- .name = MS_WEBRTC_AECM_NAME, +- .text = MS_WEBRTC_AECM_DESCRIPTION, +- .category = MS_WEBRTC_AECM_CATEGORY, +- .enc_fmt = MS_WEBRTC_AECM_ENC_FMT, +- .ninputs = MS_WEBRTC_AECM_NINPUTS, +- .noutputs = MS_WEBRTC_AECM_NOUTPUTS, +- .init = webrtc_aecm_init, +- .preprocess = webrtc_aec_preprocess, +- .process = webrtc_aec_process, +- .postprocess = webrtc_aec_postprocess, +- .uninit = webrtc_aec_uninit, +- .methods = webrtc_aec_methods, +- .flags = MS_WEBRTC_AECM_FLAGS +-}; ++MSFilterDesc ms_webrtc_aecm_desc = {.id = MS_FILTER_PLUGIN_ID, ++ .name = MS_WEBRTC_AECM_NAME, ++ .text = MS_WEBRTC_AECM_DESCRIPTION, ++ .category = MS_WEBRTC_AECM_CATEGORY, ++ .enc_fmt = MS_WEBRTC_AECM_ENC_FMT, ++ .ninputs = MS_WEBRTC_AECM_NINPUTS, ++ .noutputs = MS_WEBRTC_AECM_NOUTPUTS, ++ .init = webrtc_aecm_init, ++ .preprocess = webrtc_aec_preprocess, ++ .process = webrtc_aec_process, ++ .postprocess = webrtc_aec_postprocess, ++ .uninit = webrtc_aec_uninit, ++ .methods = webrtc_aec_methods, ++ .flags = MS_WEBRTC_AECM_FLAGS}; + + #endif + +-- +GitLab + diff --git a/gnu/packages/patches/mswebrtc-cmake.patch b/gnu/packages/patches/mswebrtc-cmake.patch new file mode 100644 index 0000000000..19d0c31b10 --- /dev/null +++ b/gnu/packages/patches/mswebrtc-cmake.patch @@ -0,0 +1,626 @@ +From e52911c291e5ebe16da764e53cb740b7deb77e75 Mon Sep 17 00:00:00 2001 +From: Ghislain MARY +Date: Mon, 13 Mar 2023 19:05:30 +0100 +Subject: [PATCH] Update CMakeLists.txt so that the project can be added as a + subdirectory of linphone-sdk. + +Rename CMake targets for uniform naming. +--- + CMakeLists.txt | 68 ++++++++++++++++++---------------- + cmake/FindBcToolbox.cmake | 67 +++++++++++++++++++++++++++++++++ + cmake/FindMediastreamer2.cmake | 46 +++++++++++++++++++++++ + cmake/FindOrtp.cmake | 43 +++++++++++++++++++++ + 4 files changed, 193 insertions(+), 31 deletions(-) + create mode 100644 cmake/FindBcToolbox.cmake + create mode 100644 cmake/FindMediastreamer2.cmake + create mode 100644 cmake/FindOrtp.cmake + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0f26f4f..fd5b52e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,6 @@ + ############################################################################ + # CMakeLists.txt +-# Copyright (C) 2014 Belledonne Communications, Grenoble France ++# Copyright (C) 2014-2023 Belledonne Communications, Grenoble France + # + ############################################################################ + # +@@ -20,7 +20,8 @@ + # + ############################################################################ + +-cmake_minimum_required(VERSION 3.1) ++cmake_minimum_required(VERSION 3.22) ++ + project(mswebrtc VERSION 1.1.1 LANGUAGES C CXX) + + +@@ -34,8 +35,6 @@ set(PACKAGE_URL "") + set(VERSION "${PACKAGE_VERSION}") + + +-option(ENABLE_SHARED "Build shared library." YES) +-option(ENABLE_STATIC "Build static library." YES) + option(ENABLE_AEC "Enable the WebRTC echo canceller support." YES) + option(ENABLE_AECM "Enable the WebRTC echo canceller for mobile support." YES) + option(ENABLE_ISAC "Enable the ISAC audio codec support." YES) +@@ -60,9 +59,20 @@ if(NOT CMAKE_INSTALL_RPATH AND CMAKE_INSTALL_PREFIX) + message(STATUS "Setting install rpath to ${CMAKE_INSTALL_RPATH}") + endif() + +-find_package(Mediastreamer2 REQUIRED CONFIG) +-find_package(ortp REQUIRED CONFIG) +-find_package(bctoolbox REQUIRED CONFIG) ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") ++ ++find_package(BcToolbox) ++if(NOT BCTOOLBOX_FOUND) ++ find_package(bctoolbox REQUIRED CONFIG) ++endif() ++find_package(Ortp) ++if(NOT ORTP_FOUND) ++ find_package(ortp REQUIRED CONFIG) ++endif() ++find_package(Mediastreamer2) ++if(NOT MEDIASTREAMER2_FOUND) ++ find_package(Mediastreamer2 REQUIRED CONFIG) ++endif() + + find_library(LIBM NAMES m) + +@@ -410,24 +420,18 @@ endif() + + set(MS2_PLUGINS_DIR "${MEDIASTREAMER2_PLUGINS_LOCATION}") + +-if(ENABLE_STATIC) +- add_library(mswebrtc-static STATIC ${SOURCE_FILES}) +- set_target_properties(mswebrtc-static PROPERTIES OUTPUT_NAME mswebrtc) +- set_target_properties(mswebrtc-static PROPERTIES LINKER_LANGUAGE CXX) +- target_link_libraries(mswebrtc-static ${LIBS}) +- install(TARGETS mswebrtc-static +- ARCHIVE DESTINATION "${MS2_PLUGINS_DIR}" +- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE +- ) +-endif() +-if(ENABLE_SHARED) +- if(NOT IOS) +- add_library(mswebrtc MODULE ${SOURCE_FILES}) +- else() ++if(BUILD_SHARED_LIBS) ++ if(IOS) + add_library(mswebrtc SHARED ${SOURCE_FILES}) ++ else() ++ add_library(mswebrtc MODULE ${SOURCE_FILES}) + endif() +- target_link_libraries(mswebrtc PRIVATE mediastreamer ortp bctoolbox ${LIBS}) +- set_target_properties(mswebrtc PROPERTIES LINKER_LANGUAGE CXX) ++else() ++ add_library(mswebrtc STATIC ${SOURCE_FILES}) ++endif() ++target_link_libraries(mswebrtc PRIVATE mediastreamer2 ortp bctoolbox ${LIBS}) ++set_target_properties(mswebrtc PROPERTIES LINKER_LANGUAGE CXX) ++if(BUILD_SHARED_LIBS) + if(APPLE) + if(IOS) + set(MIN_OS ${LINPHONE_IOS_DEPLOYMENT_TARGET}) +@@ -441,7 +445,7 @@ if(ENABLE_SHARED) + set(MIN_OS ${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() + +- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/build/osx/") ++ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/build/osx/") + endif() + if(MSVC) + if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") +@@ -454,14 +458,16 @@ if(ENABLE_SHARED) + set_target_properties(mswebrtc PROPERTIES PREFIX "lib") + endif() + endif() +- install(TARGETS mswebrtc +- RUNTIME DESTINATION ${MS2_PLUGINS_DIR} +- LIBRARY DESTINATION ${MS2_PLUGINS_DIR} +- ARCHIVE DESTINATION ${MS2_PLUGINS_DIR} +- FRAMEWORK DESTINATION Frameworks +- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE +- ) + endif() + ++install(TARGETS mswebrtc ++ RUNTIME DESTINATION ${MS2_PLUGINS_DIR} ++ LIBRARY DESTINATION ${MS2_PLUGINS_DIR} ++ ARCHIVE DESTINATION ${MS2_PLUGINS_DIR} ++ FRAMEWORK DESTINATION Frameworks ++ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ++) ++ ++ + add_subdirectory(build) + +diff --git a/cmake/FindBcToolbox.cmake b/cmake/FindBcToolbox.cmake +new file mode 100644 +index 0000000..5766478 +--- /dev/null ++++ b/cmake/FindBcToolbox.cmake +@@ -0,0 +1,67 @@ ++############################################################################ ++# FindBctoolbox.cmake ++# Copyright (C) 2023 Belledonne Communications, Grenoble France ++# ++############################################################################ ++# ++# This program is free software; you can redistribute it and/or ++# modify it under the terms of the GNU General Public License ++# as published by the Free Software Foundation; either version 2 ++# of the License, or (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++# ++############################################################################ ++# ++# - Find the bctoolbox include files and library ++# ++# BCTOOLBOX_FOUND - System has lib bctoolbox ++# BCTOOLBOX_INCLUDE_DIRS - The bctoolbox include directories ++# BCTOOLBOX_LIBRARIES - The libraries needed to use bctoolbox ++# BCTOOLBOX_CMAKE_DIR - The bctoolbox cmake directory ++# BCTOOLBOX_CORE_FOUND - System has core bctoolbox ++# BCTOOLBOX_CORE_INCLUDE_DIRS - The core bctoolbox include directories ++# BCTOOLBOX_CORE_LIBRARIES - The core bctoolbox libraries ++# BCTOOLBOX_TESTER_FOUND - System has bctoolbox tester ++# BCTOOLBOX_TESTER_INCLUDE_DIRS - The bctoolbox tester include directories ++# BCTOOLBOX_TESTER_LIBRARIES - The bctoolbox tester libraries ++ ++if(TARGET bctoolbox) ++ ++ set(BCTOOLBOX_CORE_LIBRARIES bctoolbox) ++ get_target_property(BCTOOLBOX_CORE_INCLUDE_DIRS bctoolbox INTERFACE_INCLUDE_DIRECTORIES) ++ set(BCTOOLBOX_CORE_FOUND TRUE) ++ get_target_property(BCTOOLBOX_SOURCE_DIR bctoolbox SOURCE_DIR) ++ set(BCTOOLBOX_CMAKE_DIR "${BCTOOLBOX_SOURCE_DIR}/../cmake") ++ if(TARGET bctoolbox-tester) ++ set(BCTOOLBOX_TESTER_LIBRARIES bctoolbox-tester) ++ get_target_property(BCTOOLBOX_TESTER_INCLUDE_DIRS bctoolbox-tester INTERFACE_INCLUDE_DIRECTORIES) ++ set(BCTOOLBOX_TESTER_FOUND TRUE) ++ set(BCTOOLBOX_TESTER_COMPONENT_VARIABLES BCTOOLBOX_TESTER_FOUND BCTOOLBOX_TESTER_INCLUDE_DIRS BCTOOLBOX_TESTER_LIBRARIES) ++ endif() ++ set(BCTOOLBOX_LIBRARIES ${BCTOOLBOX_CORE_LIBRARIES} ${BCTOOLBOX_TESTER_LIBRARIES}) ++ set(BCTOOLBOX_INCLUDE_DIRS ${BCTOOLBOX_CORE_INCLUDE_DIRS} ${BCTOOLBOX_TESTER_INCLUDE_DIRS}) ++ ++ ++ include(FindPackageHandleStandardArgs) ++ find_package_handle_standard_args(BcToolbox ++ DEFAULT_MSG ++ BCTOOLBOX_INCLUDE_DIRS BCTOOLBOX_LIBRARIES BCTOOLBOX_CMAKE_DIR ++ BCTOOLBOX_CORE_FOUND BCTOOLBOX_CORE_INCLUDE_DIRS BCTOOLBOX_CORE_LIBRARIES ++ ${BCTOOLBOX_TESTER_COMPONENT_VARIABLES} ++ ) ++ ++ mark_as_advanced( ++ BCTOOLBOX_INCLUDE_DIRS BCTOOLBOX_LIBRARIES BCTOOLBOX_CMAKE_DIR ++ BCTOOLBOX_CORE_FOUND BCTOOLBOX_CORE_INCLUDE_DIRS BCTOOLBOX_CORE_LIBRARIES ++ ${BCTOOLBOX_TESTER_COMPONENT_VARIABLES} ++ ) ++ ++endif() +diff --git a/cmake/FindMediastreamer2.cmake b/cmake/FindMediastreamer2.cmake +new file mode 100644 +index 0000000..64ac8f2 +--- /dev/null ++++ b/cmake/FindMediastreamer2.cmake +@@ -0,0 +1,46 @@ ++############################################################################ ++# FindMediastreamer2.cmake ++# Copyright (C) 2023 Belledonne Communications, Grenoble France ++# ++############################################################################ ++# ++# This program is free software; you can redistribute it and/or ++# modify it under the terms of the GNU General Public License ++# as published by the Free Software Foundation; either version 2 ++# of the License, or (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++# ++############################################################################ ++# ++# - Find the mediastreamer2 include files and library ++# ++# MEDIASTREAMER2_FOUND - system has lib mediastreamer2 ++# MEDIASTREAMER2_INCLUDE_DIRS - the mediasteamer2 include directory ++# MEDIASTREAMER2_LIBRARIES - The library needed to use mediasteamer2 ++# MEDIASTREAMER2_PLUGINS_LOCATION - The location of the mediastreamer2 plugins ++ ++if(TARGET mediastreamer2) ++ ++ set(MEDIASTREAMER2_LIBRARIES mediastreamer2) ++ get_target_property(MEDIASTREAMER2_INCLUDE_DIRS mediastreamer2 INTERFACE_INCLUDE_DIRECTORIES) ++ define_property(TARGET PROPERTY "MS2_PLUGINS" BRIEF_DOCS "Stores the location of mediastreamer2 plugins" FULL_DOCS "Stores the location of mediastreamer2 plugins") ++ get_target_property(MEDIASTREAMER2_PLUGINS_LOCATION mediastreamer2 MS2_PLUGINS) ++ ++ ++ include(FindPackageHandleStandardArgs) ++ find_package_handle_standard_args(Mediastreamer2 ++ DEFAULT_MSG ++ MEDIASTREAMER2_INCLUDE_DIRS MEDIASTREAMER2_LIBRARIES ++ ) ++ ++ mark_as_advanced(MEDIASTREAMER2_INCLUDE_DIRS MEDIASTREAMER2_LIBRARIES) ++ ++endif() +diff --git a/cmake/FindOrtp.cmake b/cmake/FindOrtp.cmake +new file mode 100644 +index 0000000..13121fb +--- /dev/null ++++ b/cmake/FindOrtp.cmake +@@ -0,0 +1,43 @@ ++############################################################################ ++# FindOrtp.cmake ++# Copyright (C) 2023 Belledonne Communications, Grenoble France ++# ++############################################################################ ++# ++# This program is free software; you can redistribute it and/or ++# modify it under the terms of the GNU General Public License ++# as published by the Free Software Foundation; either version 2 ++# of the License, or (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++# ++############################################################################ ++# ++# - Find the ortp include files and library ++# ++# ORTP_FOUND - system has lib ortp ++# ORTP_INCLUDE_DIRS - the ortp include directory ++# ORTP_LIBRARIES - The library needed to use ortp ++ ++if(TARGET ortp) ++ ++ set(ORTP_LIBRARIES ortp) ++ get_target_property(ORTP_INCLUDE_DIRS ortp INTERFACE_INCLUDE_DIRECTORIES) ++ ++ ++ include(FindPackageHandleStandardArgs) ++ find_package_handle_standard_args(Ortp ++ DEFAULT_MSG ++ ORTP_INCLUDE_DIRS ORTP_LIBRARIES ++ ) ++ ++ mark_as_advanced(ORTP_INCLUDE_DIRS ORTP_LIBRARIES) ++ ++endif() +-- +GitLab + +From b5aea9bdaeecd99f6fc5601bfb88541d4e55841b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micka=C3=ABl=20Turnel?= + +Date: Fri, 23 Jun 2023 11:05:24 +0200 +Subject: [PATCH] Change the library path in the binary dir so it can be + retrieved easily by testers + +--- + CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fd5b52e..ab3e651 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -24,6 +24,7 @@ cmake_minimum_required(VERSION 3.22) + + project(mswebrtc VERSION 1.1.1 LANGUAGES C CXX) + ++set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/mediastreamer2/plugins") + + set(PACKAGE "${PROJECT_NAME}") + set(PACKAGE_NAME "${PROJECT_NAME}") +-- +GitLab + +From 1809337d6191ec40f88191b5ce07cfb01ed07b20 Mon Sep 17 00:00:00 2001 +From: Ghislain MARY +Date: Tue, 20 Jun 2023 11:47:00 +0200 +Subject: [PATCH] Improve CMake find_package functionality. + +--- + CMakeLists.txt | 30 ++++----------- + build/CMakeLists.txt | 3 +- + cmake/FindBcToolbox.cmake | 67 ---------------------------------- + cmake/FindMediastreamer2.cmake | 46 ----------------------- + cmake/FindOrtp.cmake | 43 ---------------------- + 5 files changed, 10 insertions(+), 179 deletions(-) + delete mode 100644 cmake/FindBcToolbox.cmake + delete mode 100644 cmake/FindMediastreamer2.cmake + delete mode 100644 cmake/FindOrtp.cmake + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ab3e651..a869908 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -22,7 +22,7 @@ + + cmake_minimum_required(VERSION 3.22) + +-project(mswebrtc VERSION 1.1.1 LANGUAGES C CXX) ++project(MSWebRTC VERSION 1.1.1 LANGUAGES C CXX) + + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/mediastreamer2/plugins") + +@@ -60,20 +60,8 @@ if(NOT CMAKE_INSTALL_RPATH AND CMAKE_INSTALL_PREFIX) + message(STATUS "Setting install rpath to ${CMAKE_INSTALL_RPATH}") + endif() + +-list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +- +-find_package(BcToolbox) +-if(NOT BCTOOLBOX_FOUND) +- find_package(bctoolbox REQUIRED CONFIG) +-endif() +-find_package(Ortp) +-if(NOT ORTP_FOUND) +- find_package(ortp REQUIRED CONFIG) +-endif() +-find_package(Mediastreamer2) +-if(NOT MEDIASTREAMER2_FOUND) +- find_package(Mediastreamer2 REQUIRED CONFIG) +-endif() ++find_package(BCToolbox 5.3.0 REQUIRED) ++find_package(Mediastreamer2 5.3.0 REQUIRED) + + find_library(LIBM NAMES m) + +@@ -92,7 +80,7 @@ endif() + if(ENABLE_VAD) + set(BUILD_VAD 1) + endif() +-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) ++configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/config.h") + + set(WEBRTC_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/webrtc") + set(WEBRTC_SRC_DIR "${WEBRTC_ROOT_DIR}/webrtc") +@@ -419,8 +407,6 @@ if(LIBM) + list(APPEND LIBS ${LIBM}) + endif() + +-set(MS2_PLUGINS_DIR "${MEDIASTREAMER2_PLUGINS_LOCATION}") +- + if(BUILD_SHARED_LIBS) + if(IOS) + add_library(mswebrtc SHARED ${SOURCE_FILES}) +@@ -430,7 +416,7 @@ if(BUILD_SHARED_LIBS) + else() + add_library(mswebrtc STATIC ${SOURCE_FILES}) + endif() +-target_link_libraries(mswebrtc PRIVATE mediastreamer2 ortp bctoolbox ${LIBS}) ++target_link_libraries(mswebrtc PRIVATE ${Mediastreamer2_TARGET} ${LIBS}) + set_target_properties(mswebrtc PROPERTIES LINKER_LANGUAGE CXX) + if(BUILD_SHARED_LIBS) + if(APPLE) +@@ -462,9 +448,9 @@ if(BUILD_SHARED_LIBS) + endif() + + install(TARGETS mswebrtc +- RUNTIME DESTINATION ${MS2_PLUGINS_DIR} +- LIBRARY DESTINATION ${MS2_PLUGINS_DIR} +- ARCHIVE DESTINATION ${MS2_PLUGINS_DIR} ++ RUNTIME DESTINATION ${Mediastreamer2_PLUGINS_DIR} ++ LIBRARY DESTINATION ${Mediastreamer2_PLUGINS_DIR} ++ ARCHIVE DESTINATION ${Mediastreamer2_PLUGINS_DIR} + FRAMEWORK DESTINATION Frameworks + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) +diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt +index 82694c6..8f9108b 100755 +--- a/build/CMakeLists.txt ++++ b/build/CMakeLists.txt +@@ -21,7 +21,8 @@ + ############################################################################ + + if(NOT CPACK_PACKAGE_NAME) +- set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") ++ string(TOLOWER "${PROJECT_NAME}" LOWERCASE_PROJECT_NAME) ++ set(CPACK_PACKAGE_NAME "${LOWERCASE_PROJECT_NAME}") + endif() + + set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../COPYING") +diff --git a/cmake/FindBcToolbox.cmake b/cmake/FindBcToolbox.cmake +deleted file mode 100644 +index 5766478..0000000 +--- a/cmake/FindBcToolbox.cmake ++++ /dev/null +@@ -1,67 +0,0 @@ +-############################################################################ +-# FindBctoolbox.cmake +-# Copyright (C) 2023 Belledonne Communications, Grenoble France +-# +-############################################################################ +-# +-# This program is free software; you can redistribute it and/or +-# modify it under the terms of the GNU General Public License +-# as published by the Free Software Foundation; either version 2 +-# of the License, or (at your option) any later version. +-# +-# This program is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU General Public License for more details. +-# +-# You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +-# +-############################################################################ +-# +-# - Find the bctoolbox include files and library +-# +-# BCTOOLBOX_FOUND - System has lib bctoolbox +-# BCTOOLBOX_INCLUDE_DIRS - The bctoolbox include directories +-# BCTOOLBOX_LIBRARIES - The libraries needed to use bctoolbox +-# BCTOOLBOX_CMAKE_DIR - The bctoolbox cmake directory +-# BCTOOLBOX_CORE_FOUND - System has core bctoolbox +-# BCTOOLBOX_CORE_INCLUDE_DIRS - The core bctoolbox include directories +-# BCTOOLBOX_CORE_LIBRARIES - The core bctoolbox libraries +-# BCTOOLBOX_TESTER_FOUND - System has bctoolbox tester +-# BCTOOLBOX_TESTER_INCLUDE_DIRS - The bctoolbox tester include directories +-# BCTOOLBOX_TESTER_LIBRARIES - The bctoolbox tester libraries +- +-if(TARGET bctoolbox) +- +- set(BCTOOLBOX_CORE_LIBRARIES bctoolbox) +- get_target_property(BCTOOLBOX_CORE_INCLUDE_DIRS bctoolbox INTERFACE_INCLUDE_DIRECTORIES) +- set(BCTOOLBOX_CORE_FOUND TRUE) +- get_target_property(BCTOOLBOX_SOURCE_DIR bctoolbox SOURCE_DIR) +- set(BCTOOLBOX_CMAKE_DIR "${BCTOOLBOX_SOURCE_DIR}/../cmake") +- if(TARGET bctoolbox-tester) +- set(BCTOOLBOX_TESTER_LIBRARIES bctoolbox-tester) +- get_target_property(BCTOOLBOX_TESTER_INCLUDE_DIRS bctoolbox-tester INTERFACE_INCLUDE_DIRECTORIES) +- set(BCTOOLBOX_TESTER_FOUND TRUE) +- set(BCTOOLBOX_TESTER_COMPONENT_VARIABLES BCTOOLBOX_TESTER_FOUND BCTOOLBOX_TESTER_INCLUDE_DIRS BCTOOLBOX_TESTER_LIBRARIES) +- endif() +- set(BCTOOLBOX_LIBRARIES ${BCTOOLBOX_CORE_LIBRARIES} ${BCTOOLBOX_TESTER_LIBRARIES}) +- set(BCTOOLBOX_INCLUDE_DIRS ${BCTOOLBOX_CORE_INCLUDE_DIRS} ${BCTOOLBOX_TESTER_INCLUDE_DIRS}) +- +- +- include(FindPackageHandleStandardArgs) +- find_package_handle_standard_args(BcToolbox +- DEFAULT_MSG +- BCTOOLBOX_INCLUDE_DIRS BCTOOLBOX_LIBRARIES BCTOOLBOX_CMAKE_DIR +- BCTOOLBOX_CORE_FOUND BCTOOLBOX_CORE_INCLUDE_DIRS BCTOOLBOX_CORE_LIBRARIES +- ${BCTOOLBOX_TESTER_COMPONENT_VARIABLES} +- ) +- +- mark_as_advanced( +- BCTOOLBOX_INCLUDE_DIRS BCTOOLBOX_LIBRARIES BCTOOLBOX_CMAKE_DIR +- BCTOOLBOX_CORE_FOUND BCTOOLBOX_CORE_INCLUDE_DIRS BCTOOLBOX_CORE_LIBRARIES +- ${BCTOOLBOX_TESTER_COMPONENT_VARIABLES} +- ) +- +-endif() +diff --git a/cmake/FindMediastreamer2.cmake b/cmake/FindMediastreamer2.cmake +deleted file mode 100644 +index 64ac8f2..0000000 +--- a/cmake/FindMediastreamer2.cmake ++++ /dev/null +@@ -1,46 +0,0 @@ +-############################################################################ +-# FindMediastreamer2.cmake +-# Copyright (C) 2023 Belledonne Communications, Grenoble France +-# +-############################################################################ +-# +-# This program is free software; you can redistribute it and/or +-# modify it under the terms of the GNU General Public License +-# as published by the Free Software Foundation; either version 2 +-# of the License, or (at your option) any later version. +-# +-# This program is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU General Public License for more details. +-# +-# You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +-# +-############################################################################ +-# +-# - Find the mediastreamer2 include files and library +-# +-# MEDIASTREAMER2_FOUND - system has lib mediastreamer2 +-# MEDIASTREAMER2_INCLUDE_DIRS - the mediasteamer2 include directory +-# MEDIASTREAMER2_LIBRARIES - The library needed to use mediasteamer2 +-# MEDIASTREAMER2_PLUGINS_LOCATION - The location of the mediastreamer2 plugins +- +-if(TARGET mediastreamer2) +- +- set(MEDIASTREAMER2_LIBRARIES mediastreamer2) +- get_target_property(MEDIASTREAMER2_INCLUDE_DIRS mediastreamer2 INTERFACE_INCLUDE_DIRECTORIES) +- define_property(TARGET PROPERTY "MS2_PLUGINS" BRIEF_DOCS "Stores the location of mediastreamer2 plugins" FULL_DOCS "Stores the location of mediastreamer2 plugins") +- get_target_property(MEDIASTREAMER2_PLUGINS_LOCATION mediastreamer2 MS2_PLUGINS) +- +- +- include(FindPackageHandleStandardArgs) +- find_package_handle_standard_args(Mediastreamer2 +- DEFAULT_MSG +- MEDIASTREAMER2_INCLUDE_DIRS MEDIASTREAMER2_LIBRARIES +- ) +- +- mark_as_advanced(MEDIASTREAMER2_INCLUDE_DIRS MEDIASTREAMER2_LIBRARIES) +- +-endif() +diff --git a/cmake/FindOrtp.cmake b/cmake/FindOrtp.cmake +deleted file mode 100644 +index 13121fb..0000000 +--- a/cmake/FindOrtp.cmake ++++ /dev/null +@@ -1,43 +0,0 @@ +-############################################################################ +-# FindOrtp.cmake +-# Copyright (C) 2023 Belledonne Communications, Grenoble France +-# +-############################################################################ +-# +-# This program is free software; you can redistribute it and/or +-# modify it under the terms of the GNU General Public License +-# as published by the Free Software Foundation; either version 2 +-# of the License, or (at your option) any later version. +-# +-# This program is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU General Public License for more details. +-# +-# You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +-# +-############################################################################ +-# +-# - Find the ortp include files and library +-# +-# ORTP_FOUND - system has lib ortp +-# ORTP_INCLUDE_DIRS - the ortp include directory +-# ORTP_LIBRARIES - The library needed to use ortp +- +-if(TARGET ortp) +- +- set(ORTP_LIBRARIES ortp) +- get_target_property(ORTP_INCLUDE_DIRS ortp INTERFACE_INCLUDE_DIRECTORIES) +- +- +- include(FindPackageHandleStandardArgs) +- find_package_handle_standard_args(Ortp +- DEFAULT_MSG +- ORTP_INCLUDE_DIRS ORTP_LIBRARIES +- ) +- +- mark_as_advanced(ORTP_INCLUDE_DIRS ORTP_LIBRARIES) +- +-endif() +-- +GitLab +