[GTK][WPE] Make libwebrtc compile using the system opus library
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Oct 2018 07:39:06 +0000 (07:39 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Oct 2018 07:39:06 +0000 (07:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=190573

Patch by Alejandro G. Castro <alex@igalia.com> on 2018-10-16
Reviewed by Philippe Normand.

We found some situations where gstreamer gets confused when it
tries to use opus because it finds opus symbols compiled for
liwebrtc. We are going to try the option to use the system opus
library also for libwebrtc.

* CMakeLists.txt: Added opus dependency.
* cmake/FindOpus.cmake: Added the hints to find the opus library
in the compilation.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237174 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/ThirdParty/libwebrtc/CMakeLists.txt
Source/ThirdParty/libwebrtc/ChangeLog
Source/ThirdParty/libwebrtc/cmake/FindOpus.cmake [new file with mode: 0644]

index d5a22792b3835e8dbcf4bdb1eace57608eaf50e2..cf4f7980387096ffbba4b425420bdfd52747dd5a 100644 (file)
@@ -16,6 +16,11 @@ if (NOT ALSALIB_FOUND)
     message(FATAL_ERROR "alsa-lib is needed for USE_LIBWEBRTC.")
 endif ()
 
+find_package(Opus 1.3)
+if (NOT LIBOPUS_FOUND)
+    message(FATAL_ERROR "libopus is needed for USE_LIBWEBRTC.")
+endif ()
+
 set(webrtc_SOURCES
     Source/third_party/abseil-cpp/absl/base/dynamic_annotations.cc
     Source/third_party/abseil-cpp/absl/base/internal/raw_logging.cc
@@ -309,141 +314,6 @@ set(webrtc_SOURCES
     Source/third_party/libyuv/source/scale_common.cc
     Source/third_party/libyuv/source/scale_gcc.cc
     Source/third_party/libyuv/source/video_common.cc
-    Source/third_party/opus/src/celt/bands.c
-    Source/third_party/opus/src/celt/celt.c
-    Source/third_party/opus/src/celt/celt_decoder.c
-    Source/third_party/opus/src/celt/celt_encoder.c
-    Source/third_party/opus/src/celt/celt_lpc.c
-    Source/third_party/opus/src/celt/cwrs.c
-    Source/third_party/opus/src/celt/entcode.c
-    Source/third_party/opus/src/celt/entdec.c
-    Source/third_party/opus/src/celt/entenc.c
-    Source/third_party/opus/src/celt/kiss_fft.c
-    Source/third_party/opus/src/celt/laplace.c
-    Source/third_party/opus/src/celt/mathops.c
-    Source/third_party/opus/src/celt/mdct.c
-    Source/third_party/opus/src/celt/modes.c
-    Source/third_party/opus/src/celt/pitch.c
-    Source/third_party/opus/src/celt/quant_bands.c
-    Source/third_party/opus/src/celt/rate.c
-    Source/third_party/opus/src/celt/vq.c
-    Source/third_party/opus/src/silk/A2NLSF.c
-    Source/third_party/opus/src/silk/CNG.c
-    Source/third_party/opus/src/silk/HP_variable_cutoff.c
-    Source/third_party/opus/src/silk/LPC_analysis_filter.c
-    Source/third_party/opus/src/silk/LPC_inv_pred_gain.c
-    Source/third_party/opus/src/silk/LP_variable_cutoff.c
-    Source/third_party/opus/src/silk/NLSF2A.c
-    Source/third_party/opus/src/silk/NLSF_VQ.c
-    Source/third_party/opus/src/silk/NLSF_VQ_weights_laroia.c
-    Source/third_party/opus/src/silk/NLSF_decode.c
-    Source/third_party/opus/src/silk/NLSF_del_dec_quant.c
-    Source/third_party/opus/src/silk/NLSF_encode.c
-    Source/third_party/opus/src/silk/NLSF_stabilize.c
-    Source/third_party/opus/src/silk/NLSF_unpack.c
-    Source/third_party/opus/src/silk/NSQ.c
-    Source/third_party/opus/src/silk/NSQ_del_dec.c
-    Source/third_party/opus/src/silk/PLC.c
-    Source/third_party/opus/src/silk/VAD.c
-    Source/third_party/opus/src/silk/VQ_WMat_EC.c
-    Source/third_party/opus/src/silk/ana_filt_bank_1.c
-    Source/third_party/opus/src/silk/biquad_alt.c
-    Source/third_party/opus/src/silk/bwexpander.c
-    Source/third_party/opus/src/silk/bwexpander_32.c
-    Source/third_party/opus/src/silk/check_control_input.c
-    Source/third_party/opus/src/silk/code_signs.c
-    Source/third_party/opus/src/silk/control_SNR.c
-    Source/third_party/opus/src/silk/control_audio_bandwidth.c
-    Source/third_party/opus/src/silk/control_codec.c
-    Source/third_party/opus/src/silk/debug.c
-    Source/third_party/opus/src/silk/dec_API.c
-    Source/third_party/opus/src/silk/decode_core.c
-    Source/third_party/opus/src/silk/decode_frame.c
-    Source/third_party/opus/src/silk/decode_indices.c
-    Source/third_party/opus/src/silk/decode_parameters.c
-    Source/third_party/opus/src/silk/decode_pitch.c
-    Source/third_party/opus/src/silk/decode_pulses.c
-    Source/third_party/opus/src/silk/decoder_set_fs.c
-    Source/third_party/opus/src/silk/enc_API.c
-    Source/third_party/opus/src/silk/encode_indices.c
-    Source/third_party/opus/src/silk/encode_pulses.c
-    Source/third_party/opus/src/silk/float/LPC_analysis_filter_FLP.c
-    Source/third_party/opus/src/silk/float/LPC_inv_pred_gain_FLP.c
-    Source/third_party/opus/src/silk/float/LTP_analysis_filter_FLP.c
-    Source/third_party/opus/src/silk/float/LTP_scale_ctrl_FLP.c
-    Source/third_party/opus/src/silk/float/apply_sine_window_FLP.c
-    Source/third_party/opus/src/silk/float/autocorrelation_FLP.c
-    Source/third_party/opus/src/silk/float/burg_modified_FLP.c
-    Source/third_party/opus/src/silk/float/bwexpander_FLP.c
-    Source/third_party/opus/src/silk/float/corrMatrix_FLP.c
-    Source/third_party/opus/src/silk/float/encode_frame_FLP.c
-    Source/third_party/opus/src/silk/float/energy_FLP.c
-    Source/third_party/opus/src/silk/float/find_LPC_FLP.c
-    Source/third_party/opus/src/silk/float/find_LTP_FLP.c
-    Source/third_party/opus/src/silk/float/find_pitch_lags_FLP.c
-    Source/third_party/opus/src/silk/float/find_pred_coefs_FLP.c
-    Source/third_party/opus/src/silk/float/inner_product_FLP.c
-    Source/third_party/opus/src/silk/float/k2a_FLP.c
-    Source/third_party/opus/src/silk/float/levinsondurbin_FLP.c
-    Source/third_party/opus/src/silk/float/noise_shape_analysis_FLP.c
-    Source/third_party/opus/src/silk/float/pitch_analysis_core_FLP.c
-    Source/third_party/opus/src/silk/float/prefilter_FLP.c
-    Source/third_party/opus/src/silk/float/process_gains_FLP.c
-    Source/third_party/opus/src/silk/float/regularize_correlations_FLP.c
-    Source/third_party/opus/src/silk/float/residual_energy_FLP.c
-    Source/third_party/opus/src/silk/float/scale_copy_vector_FLP.c
-    Source/third_party/opus/src/silk/float/scale_vector_FLP.c
-    Source/third_party/opus/src/silk/float/schur_FLP.c
-    Source/third_party/opus/src/silk/float/solve_LS_FLP.c
-    Source/third_party/opus/src/silk/float/sort_FLP.c
-    Source/third_party/opus/src/silk/float/warped_autocorrelation_FLP.c
-    Source/third_party/opus/src/silk/float/wrappers_FLP.c
-    Source/third_party/opus/src/silk/gain_quant.c
-    Source/third_party/opus/src/silk/init_decoder.c
-    Source/third_party/opus/src/silk/init_encoder.c
-    Source/third_party/opus/src/silk/inner_prod_aligned.c
-    Source/third_party/opus/src/silk/interpolate.c
-    Source/third_party/opus/src/silk/lin2log.c
-    Source/third_party/opus/src/silk/log2lin.c
-    Source/third_party/opus/src/silk/pitch_est_tables.c
-    Source/third_party/opus/src/silk/process_NLSFs.c
-    Source/third_party/opus/src/silk/quant_LTP_gains.c
-    Source/third_party/opus/src/silk/resampler.c
-    Source/third_party/opus/src/silk/resampler_down2.c
-    Source/third_party/opus/src/silk/resampler_down2_3.c
-    Source/third_party/opus/src/silk/resampler_private_AR2.c
-    Source/third_party/opus/src/silk/resampler_private_IIR_FIR.c
-    Source/third_party/opus/src/silk/resampler_private_down_FIR.c
-    Source/third_party/opus/src/silk/resampler_private_up2_HQ.c
-    Source/third_party/opus/src/silk/resampler_rom.c
-    Source/third_party/opus/src/silk/shell_coder.c
-    Source/third_party/opus/src/silk/sigm_Q15.c
-    Source/third_party/opus/src/silk/sort.c
-    Source/third_party/opus/src/silk/stereo_LR_to_MS.c
-    Source/third_party/opus/src/silk/stereo_MS_to_LR.c
-    Source/third_party/opus/src/silk/stereo_decode_pred.c
-    Source/third_party/opus/src/silk/stereo_encode_pred.c
-    Source/third_party/opus/src/silk/stereo_find_predictor.c
-    Source/third_party/opus/src/silk/stereo_quant_pred.c
-    Source/third_party/opus/src/silk/sum_sqr_shift.c
-    Source/third_party/opus/src/silk/table_LSF_cos.c
-    Source/third_party/opus/src/silk/tables_LTP.c
-    Source/third_party/opus/src/silk/tables_NLSF_CB_NB_MB.c
-    Source/third_party/opus/src/silk/tables_NLSF_CB_WB.c
-    Source/third_party/opus/src/silk/tables_gain.c
-    Source/third_party/opus/src/silk/tables_other.c
-    Source/third_party/opus/src/silk/tables_pitch_lag.c
-    Source/third_party/opus/src/silk/tables_pulses_per_block.c
-    Source/third_party/opus/src/src/analysis.c
-    Source/third_party/opus/src/src/mlp.c
-    Source/third_party/opus/src/src/mlp_data.c
-    Source/third_party/opus/src/src/opus.c
-    Source/third_party/opus/src/src/opus_decoder.c
-    Source/third_party/opus/src/src/opus_encoder.c
-    Source/third_party/opus/src/src/opus_multistream.c
-    Source/third_party/opus/src/src/opus_multistream_decoder.c
-    Source/third_party/opus/src/src/opus_multistream_encoder.c
-    Source/third_party/opus/src/src/repacketizer.c
     Source/third_party/rnnoise/src/kiss_fft.cc
     Source/third_party/rnnoise/src/rnn_vad_weights.cc
     Source/third_party/usrsctp/usrsctplib/netinet/sctp_asconf.c
@@ -1542,6 +1412,8 @@ target_link_libraries(webrtc ${VPX_LIBRARY})
 
 target_link_libraries(webrtc ${EVENT_LIBRARY})
 
+target_link_libraries(webrtc ${OPUS_LIBRARY})
+
 # libsrtp package compilation
 set(libsrtp_SOURCES
     Source/third_party/libsrtp/crypto/cipher/aes_gcm_ossl.c
index 32e877615b1f84bef4cc5cd298286f8a6da39c8a..43f95c6200efb95ee43c9b32027d355f4ef773c8 100644 (file)
@@ -1,3 +1,19 @@
+2018-10-16  Alejandro G. Castro  <alex@igalia.com>
+
+        [GTK][WPE] Make libwebrtc compile using the system opus library
+        https://bugs.webkit.org/show_bug.cgi?id=190573
+
+        Reviewed by Philippe Normand.
+
+        We found some situations where gstreamer gets confused when it
+        tries to use opus because it finds opus symbols compiled for
+        liwebrtc. We are going to try the option to use the system opus
+        library also for libwebrtc.
+
+        * CMakeLists.txt: Added opus dependency.
+        * cmake/FindOpus.cmake: Added the hints to find the opus library
+        in the compilation.
+
 2018-10-15  Youenn Fablet  <youenn@apple.com>
 
         RTCPeerConnection.generateCertificate is not a function
diff --git a/Source/ThirdParty/libwebrtc/cmake/FindOpus.cmake b/Source/ThirdParty/libwebrtc/cmake/FindOpus.cmake
new file mode 100644 (file)
index 0000000..4d49aa7
--- /dev/null
@@ -0,0 +1,46 @@
+# - Try to find opus.
+# Once done, this will define
+#
+#  LIBOPUS_FOUND - system has opus.
+#  OPUS_LIBRARY - link this to use opus.
+#
+# Copyright (C) 2018 Igalia S.L.
+#
+# 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 THE COPYRIGHT HOLDER 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 THE COPYRIGHT HOLDER 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_LIBOPUS opus)
+
+find_library(OPUS_LIBRARY
+    NAME opus
+    HINTS ${PC_LIBOPUS_LIBDIR}
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibOpus
+    REQUIRED_VARS OPUS_LIBRARY
+    FOUND_VAR LIBOPUS_FOUND
+    VERSION_VAR PC_LIBOPUS_VERSION)
+
+mark_as_advanced(
+    OPUS_LIBRARY
+)