libpjsip: add alsa option
PATCH v3 1/8 libpjsip: add alsa option
This is the first patch in a series that will enable several features for libpjsip. This patch does the following:
- Turn libpjsip into a menuconfig option
- Add a option for alsa support
---
Changes v1 -> v2:
- Remove the option to enable or disable alsa support in favor of just depending on alsa-lib if it's selected by the user.
Changes v2 -> v3:
- Make this patch the start of the series.
- Re-add the option to enable or disable support (Thomas)
package/libpjsip/Config.in | 12 +++++++++++- package/libpjsip/libpjsip.mk | 8 +++++++- 2 files changed, 18 insertions(+), 2 deletions(-)
package/libpjsip/Config.in +11 -1
@@ -1,4 +1,4 @@ -config BR2_PACKAGE_LIBPJSIP +menuconfig BR2_PACKAGE_LIBPJSIP bool "libpjsip" depends on BR2_INSTALL_LIBSTDCPP depends on BR2_TOOLCHAIN_HAS_THREADS
@@ -10,5 +10,15 @@ config BR2_PACKAGE_LIBPJSIP http://www.pjsip.org +if BR2_PACKAGE_LIBPJSIP + +comment "sound" + +config BR2_PACKAGE_LIBPJSIP_ALSA + bool "alsa support" + select BR2_PACKAGE_ALSA_LIB + +endif #BR2_PACKAGE_LIBPJSIP + comment "libpjsip needs a toolchain w/ C++, threads" depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
package/libpjsip/libpjsip.mk +7 -1
@@ -25,7 +25,6 @@ LIBPJSIP_CONF_ENV = \ CFLAGS="$(LIBPJSIP_CFLAGS)" LIBPJSIP_CONF_OPTS = \ - --disable-sound \ --disable-gsm-codec \ --disable-speex-codec \ --disable-speex-aec \
@@ -68,4 +67,11 @@ ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBUUID),y) LIBPJSIP_DEPENDENCIES += util-linux endif +ifeq ($(BR2_PACKAGE_LIBPJSIP_ALSA),y) +LIBPJSIP_DEPENDENCIES += alsa-lib +LIBPJSIP_CONF_OPTS += --enable-sound +else +LIBPJSIP_CONF_OPTS += --disable-sound +endif + $(eval $(autotools-package))
Signature · 1 line
2.13.6
PATCH v3 2/8 libpjsip: add portaudio option
Currently, --with-external-pa also has no effect on the build result, other than giving the warning:
<command-line>:0:0: warning: "PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO" redefined
Indeed, os-auto.mk will set this define twice: it is set to 1 due to
--with-external-pa, and then set to 0 due to --enable-sound (AC_PJMEDIA_SND=alsa) or --disable-sound (AC_PJMEDIA_SND=null). The 0 "wins" so portaudio is not used at all.
Instead of adding an explicit --without-external-pa, I patched the build system to set PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO properly, submitted the patch upstream, and ran several tests to make sure that the code functions properly.
---
Changes v1 -> v2:
- Remove the option to enable or disable portaudio support in favor of just depending on portaudio if it's selected by the user.
Changes v2 -> v3:
- Re-add the option to enable or disable support
- Add 0002-fix-building-against-external-portaudio.patch to fix the broken --with-external-pa option.
- select BR2_PACKAGE_LIBPJSIP_ALSA if portaudio is selected with a note in the Config.in as to why.
...2-fix-building-against-external-portaudio.patch | 75 ++++++++++++++++++++++ package/libpjsip/Config.in | 7 ++ package/libpjsip/libpjsip.mk | 9 +++ 3 files changed, 91 insertions(+) create mode 100644 package/libpjsip/0002-fix-building-against-external-portaudio.patch
package/libpjsip/0002-fix-building-against-external-portaudio.patch new file +75 -0
@@ -0,0 +1,75 @@ +From d173d3bc68bdfdcc1f00baff903072b3e89c6c36 Mon Sep 17 00:00:00 2001 +From: Adam Duskett <[email protected]> +Date: Mon, 20 Nov 2017 11:45:13 -0500 +Subject: [PATCH] fix building against external portaudio + +currently, --with-external-pa has no effect other than giving the warning +<command-line>:0:0: warning: "PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO" redefined + +os-auto.mk will set this define twice if alsa is selected: +1 due to the --with-external-pa +0 due to the --enable-sound + +This is a simple fix: +- Add linking to portaudio if --with-external-pa is defined. +- Remove the hardcoded PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0 if alsa is selected + and instead move it to a else clause when checking if --with-external-pa was + passed at configure time. + +upstream-status: pending + +Signed-off-by: Adam Duskett <[email protected]> +--- + aconfigure | 1 + + aconfigure.ac | 1 + + pjmedia/build/os-auto.mak.in | 3 ++- + 3 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/aconfigure b/aconfigure +index aec2a28..23bf9a6 100755 +--- a/aconfigure ++++ b/aconfigure +@@ -6281,6 +6281,7 @@ _ACEOF + if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes!!" >&5 + $as_echo "yes!!" >&6; } ++ LIBS="$LIBS -lportaudio" + ac_external_pa="1" + + else +diff --git a/aconfigure.ac b/aconfigure.ac +index e9770b7..432b56a 100644 +--- a/aconfigure.ac ++++ b/aconfigure.ac +@@ -675,6 +675,7 @@ AC_ARG_WITH(external-pa, + ]], + [Pa_Initialize();])], + [AC_MSG_RESULT(yes!!) ++ [LIBS="$LIBS -lportaudio"] + ac_external_pa="1" + ], + [AC_MSG_ERROR([Unable to use PortAudio. If PortAudio development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])]) +diff --git a/pjmedia/build/os-auto.mak.in b/pjmedia/build/os-auto.mak.in +index f998f66..5881e65 100644 +--- a/pjmedia/build/os-auto.mak.in ++++ b/pjmedia/build/os-auto.mak.in +@@ -190,6 +190,8 @@ endif + ifeq (@ac_external_pa@,1) + # External PA + export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=1 ++else ++export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=0 + endif + + # +@@ -235,7 +237,6 @@ endif + # + ifneq ($(findstring alsa,$(AC_PJMEDIA_SND)),) + export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_ALSA=1 \ +- -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=0 \ + -DPJMEDIA_AUDIO_DEV_HAS_WMME=0 + endif + +-- +2.13.6 +
package/libpjsip/Config.in +7 -0
@@ -18,6 +18,13 @@ config BR2_PACKAGE_LIBPJSIP_ALSA bool "alsa support" select BR2_PACKAGE_ALSA_LIB +config BR2_PACKAGE_LIBPJSIP_PORTAUDIO + bool "portaudio support" + select BR2_PACKAGE_PORTAUDIO + # portaudio can compile without alsa, but it will + # disable sound, which would be useless. + select BR2_PACKAGE_LIBPJSIP_ALSA + endif #BR2_PACKAGE_LIBPJSIP comment "libpjsip needs a toolchain w/ C++, threads"
package/libpjsip/libpjsip.mk +9 -0
@@ -74,4 +74,13 @@ else LIBPJSIP_CONF_OPTS += --disable-sound endif +ifeq ($(BR2_PACKAGE_LIBPJSIP_PORTAUDIO),y) +LIBPJSIP_DEPENDENCIES += portaudio +LIBPJSIP_CONF_OPTS += --with-external-pa +else +LIBPJSIP_CONF_OPTS += --without-external-pa +endif + + + $(eval $(autotools-package))
Signature · 1 line
2.13.6
PATCH v3 3/8 libpjsip: enable ffmpeg support
In reply to Adam Duskett--enable-video has no effect at all on Linux (only on Android and Darwin). --disable-video has the effect of disabling SDL, FFmpeg, v4l2, openh264, and libyuv. Since all of these are enabled/disabled explicitly already, there is no need to specify --disable-video. To do so correctly is non-trivial when we want to support e.g. FFmpeg OR v4l2.
---
Changes v1 -> v2:
- Remove the option to enable or disable FFmpeg support in favor of just depending on FFmpeg if it's selected by the user.
- Add explination as to why with-ffmpeg is being passed to libpjsip (Arnout)
Changes v2 -> v3:
- Re-add the option to enable or disable support
- Add a better commit message (Arnout)
- Add a more thorough comment in the make file explaining why passing --enable-ffmpeg actually disables it. (Arnout)
- Remove the =$(STAGING_DIR)/usr from --with-ffmpeg (Arnout)
package/libpjsip/Config.in | 9 +++++++++ package/libpjsip/libpjsip.mk | 14 +++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-)
package/libpjsip/Config.in +9 -0
@@ -25,6 +25,15 @@ config BR2_PACKAGE_LIBPJSIP_PORTAUDIO # disable sound, which would be useless. select BR2_PACKAGE_LIBPJSIP_ALSA +comment "video" + +config BR2_PACKAGE_LIBPJSIP_FFMPEG + bool "ffmpeg support" + depends on BR2_PACKAGE_FFMPEG_ARCH_SUPPORTS + select BR2_PACKAGE_FFMPEG + help + Enable ffmpeg support + endif #BR2_PACKAGE_LIBPJSIP comment "libpjsip needs a toolchain w/ C++, threads"
package/libpjsip/libpjsip.mk +11 -3
@@ -29,7 +29,6 @@ LIBPJSIP_CONF_OPTS = \ --disable-speex-codec \ --disable-speex-aec \ --disable-resample \ - --disable-video \ --disable-opencore-amr \ --disable-g7221-codec \ --disable-ilbc-codec \
@@ -42,7 +41,6 @@ LIBPJSIP_CONF_OPTS = \ --disable-g722-codec \ --disable-libsamplerate \ --disable-sdl \ - --disable-ffmpeg \ --disable-v4l2 \ --disable-openh264 \ --disable-libyuv \
@@ -81,6 +79,16 @@ else LIBPJSIP_CONF_OPTS += --without-external-pa endif - +# When --enable-ffmpeg is given, the code to enable FFmpeg is not executed. +# Also, when cross-compiling and no --with-ffmpeg option is given, FFmpeg is +# disabled. Therefore, a --with-ffmpeg option needs to be given. Normally it +# is used to pass the path to the directory where FFmpeg is installed, but +# since we install it directly under sysroot we can pass it empty. +ifeq ($(BR2_PACKAGE_LIBPJSIP_FFMPEG),y) +LIBPJSIP_DEPENDENCIES += ffmpeg +LIBPJSIP_CONF_OPTS += --with-ffmpeg +else +LIBPJSIP_CONF_OPTS += --disable-ffmpeg +endif $(eval $(autotools-package))
Signature · 1 line
2.13.6
PATCH v3 4/8 libpjsip: enable v4l2 support
In reply to Adam Duskett---
Changes v1 -> v2:
- Remove the option to enable or disable v4l2 support in favor of just depending on libv4l if it's selected by the user.
Changes v2 -> v3:
- Re-add the option to enable or disable support
package/libpjsip/Config.in | 10 ++++++++++ package/libpjsip/libpjsip.mk | 9 +++++++-- 2 files changed, 17 insertions(+), 2 deletions(-)
package/libpjsip/Config.in +10 -0
@@ -34,6 +34,16 @@ config BR2_PACKAGE_LIBPJSIP_FFMPEG help Enable ffmpeg support +config BR2_PACKAGE_LIBPJSIP_V4L2 + bool "V4L2 support" + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 # libv4l -> media headers + select BR2_PACKAGE_LIBV4L + help + Enable Video4Linux2 support + +comment "v4l2 support needs headers >= 3.0" + depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 + endif #BR2_PACKAGE_LIBPJSIP comment "libpjsip needs a toolchain w/ C++, threads"
package/libpjsip/libpjsip.mk +6 -1
@@ -41,7 +41,6 @@ LIBPJSIP_CONF_OPTS = \ --disable-g722-codec \ --disable-libsamplerate \ --disable-sdl \ - --disable-v4l2 \ --disable-openh264 \ --disable-libyuv \ --disable-ipp \
@@ -91,4 +90,10 @@ else LIBPJSIP_CONF_OPTS += --disable-ffmpeg endif +ifeq ($(BR2_PACKAGE_LIBPJSIP_V4L2),y) +LIBPJSIP_DEPENDENCIES += libv4l +else +LIBPJSIP_CONF_OPTS += --disable-v4l2 +endif + $(eval $(autotools-package))
Signature · 1 line
2.13.6
PATCH v3 5/8 libpjsip: add dependency-less codecs
In reply to Adam Duskettlibpjsip has several codecs, all of which can be disabled or enabled individually. A few reasons for adding each codec as an individual choice are:
1) Many products might not want some of the more obscure codecs such as ILBC or L16.
2) libpjsip has functions that will enumerate all the codecs that were built. If all the codecs where built, this would require a developer to have to parse out the codecs they don't want.
As such, turn libpjsip into a menuconfig and add each supported codec as an individual choice.
Start with the codecs that are built into libpjsip and have no external dependencies. These codecs are:
- G.711
- G.722
- G.722.1
- iLBC
- L16
---
Changes v1 -> v2:
- Combine all dependency-less codecs into a single patch.
- Add a more-detailed commit message explaining the reasoning for enabling each codec as a individual option. (Arnout)
Changes v2 -> v3:
- None
package/libpjsip/Config.in | 17 +++++++++++++++++ package/libpjsip/libpjsip.mk | 32 +++++++++++++++++++++++++++----- 2 files changed, 44 insertions(+), 5 deletions(-)
package/libpjsip/Config.in +17 -0
@@ -44,6 +44,23 @@ config BR2_PACKAGE_LIBPJSIP_V4L2 comment "v4l2 support needs headers >= 3.0" depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 +comment "dependency-less codecs" + +config BR2_PACKAGE_LIBPJSIP_CODEC_G711 + bool "G.711" + +config BR2_PACKAGE_LIBPJSIP_CODEC_G722 + bool "G.722" + +config BR2_PACKAGE_LIBPJSIP_CODEC_G7221 + bool "G.722.1" + +config BR2_PACKAGE_LIBPJSIP_CODEC_ILBC + bool "iLBC" + +config BR2_PACKAGE_LIBPJSIP_CODEC_L16 + bool "L16" + endif #BR2_PACKAGE_LIBPJSIP comment "libpjsip needs a toolchain w/ C++, threads"
package/libpjsip/libpjsip.mk +27 -5
@@ -30,15 +30,10 @@ LIBPJSIP_CONF_OPTS = \ --disable-speex-aec \ --disable-resample \ --disable-opencore-amr \ - --disable-g7221-codec \ - --disable-ilbc-codec \ --disable-libwebrtc \ --disable-opus \ --disable-oss \ --disable-ext-sound \ - --disable-g711-codec \ - --disable-l16-codec \ - --disable-g722-codec \ --disable-libsamplerate \ --disable-sdl \ --disable-openh264 \
@@ -96,4 +91,31 @@ else LIBPJSIP_CONF_OPTS += --disable-v4l2 endif +# Codecs can only be disabled. If explicitly enabled, the check is +# omitted (but successful), and there is no configure trace "Checking +# if [codec] codec is disabled...no". So we only explicitly disable it +# and we do not explicitly enable it, so we get the configure log in +# both cases. +ifneq ($(BR2_PACKAGE_LIBPJSIP_CODEC_G711),y) +LIBPJSIP_CONF_OPTS += --disable-g711-codec +endif + +ifneq ($(BR2_PACKAGE_LIBPJSIP_CODEC_G722),y) +LIBPJSIP_CONF_OPTS += --disable-g722-codec +endif + +# libpjsip can only use a bundled version of libg7221 +ifneq ($(BR2_PACKAGE_LIBPJSIP_CODEC_G7221),y) +LIBPJSIP_CONF_OPTS += --disable-g7221-codec +endif + +# libpjsip can only use a bundled version of libilbc +ifneq ($(BR2_PACKAGE_LIBPJSIP_CODEC_ILBC),y) +LIBPJSIP_CONF_OPTS += --disable-ilbc-codec +endif + +ifneq ($(BR2_PACKAGE_LIBPJSIP_CODEC_L16),y) +LIBPJSIP_CONF_OPTS += --disable-l16-codec +endif + $(eval $(autotools-package))
Signature · 1 line
2.13.6
PATCH v3 6/8 libpjsip: add codecs with dependencies
In reply to Adam DuskettAdd all supported codecs that rely on external dependencies. These codecs are:
- bcg729
- gsm
- opus
- speex
- opencore-amr
---
Changes v1 -> v2:
- Combine all codecs with external dependencies into a single patch.
Changes v2 -> v3:
- Add opencore-amr codec.
package/libpjsip/Config.in | 26 ++++++++++++++++++++++++++ package/libpjsip/libpjsip.mk | 40 +++++++++++++++++++++++++++++++++++----- 2 files changed, 61 insertions(+), 5 deletions(-)
package/libpjsip/Config.in +26 -0
@@ -61,6 +61,32 @@ config BR2_PACKAGE_LIBPJSIP_CODEC_ILBC config BR2_PACKAGE_LIBPJSIP_CODEC_L16 bool "L16" +comment "Codecs with external dependencies" + +config BR2_PACKAGE_LIBPJSIP_CODEC_BCG729 + bool "BCG729" + select BR2_PACKAGE_BCG729 + +config BR2_PACKAGE_LIBPJSIP_CODEC_GSM + bool "GSM" + depends on !BR2_STATIC_LIBS # libgsm + select BR2_PACKAGE_LIBGSM + +comment "GSM codec needs a toolchain w/ shared libraries" + depends on BR2_STATIC_LIBS + +config BR2_PACKAGE_LIBPJSIP_CODEC_OPENCORE_AMR + bool "Opencore-amr" + select BR2_PACKAGE_OPENCORE_AMR + +config BR2_PACKAGE_LIBPJSIP_CODEC_OPUS + bool "Opus" + select BR2_PACKAGE_OPUS + +config BR2_PACKAGE_LIBPJSIP_CODEC_SPEEX + bool "Speex" + select BR2_PACKAGE_SPEEX + endif #BR2_PACKAGE_LIBPJSIP comment "libpjsip needs a toolchain w/ C++, threads"
package/libpjsip/libpjsip.mk +35 -5
@@ -25,13 +25,8 @@ LIBPJSIP_CONF_ENV = \ CFLAGS="$(LIBPJSIP_CFLAGS)" LIBPJSIP_CONF_OPTS = \ - --disable-gsm-codec \ - --disable-speex-codec \ - --disable-speex-aec \ --disable-resample \ - --disable-opencore-amr \ --disable-libwebrtc \ - --disable-opus \ --disable-oss \ --disable-ext-sound \ --disable-libsamplerate \
@@ -118,4 +113,39 @@ ifneq ($(BR2_PACKAGE_LIBPJSIP_CODEC_L16),y) LIBPJSIP_CONF_OPTS += --disable-l16-codec endif +# Codecs with external dependencies +ifeq ($(BR2_PACKAGE_LIBPJSIP_CODEC_BCG729),y) +LIBPJSIP_DEPENDENCIES += bcg729 +LIBPJSIP_CONF_OPTS += --with-bcg729=$(STAGING_DIR)/usr +else +LIBPJSIP_CONF_OPTS += --disable-bcg729 +endif + +ifeq ($(BR2_PACKAGE_LIBPJSIP_CODEC_GSM),y) +LIBPJSIP_DEPENDENCIES += libgsm +LIBPJSIP_CONF_OPTS += --with-external-gsm +else +LIBPJSIP_CONF_OPTS += --disable-gsm-codec +endif + +ifeq ($(BR2_PACKAGE_LIBPJSIP_CODEC_OPENCORE_AMR),y) +LIBPJSIP_DEPENDENCIES += opencore-amr +LIBPJSIP_CONF_OPTS += --with-opencore-amr +else +LIBPJSIP_CONF_OPTS += --disable-opencore-amr +endif + +ifeq ($(BR2_PACKAGE_LIBPJSIP_CODEC_OPUS),y) +LIBPJSIP_DEPENDENCIES += opus +else +LIBPJSIP_CONF_OPTS += --disable-opus +endif + +ifeq ($(BR2_PACKAGE_LIBPJSIP_CODEC_SPEEX),y) +LIBPJSIP_DEPENDENCIES += speex +LIBPJSIP_CONF_OPTS += --with-external-speex +else +LIBPJSIP_CONF_OPTS += --disable-speex-codec --disable-speex-aec +endif + $(eval $(autotools-package))
Signature · 1 line
2.13.6
PATCH v3 7/8 libpjsip: enable libsamplerate
In reply to Adam DuskettIf libsamplerate is selected, libpjsip should depend on it.
---
Changes v1 -> v2:
- None
Changes v2 -> v3:
- Add this patch to the series.
package/libpjsip/libpjsip.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
package/libpjsip/libpjsip.mk +7 -1
@@ -29,7 +29,6 @@ LIBPJSIP_CONF_OPTS = \ --disable-libwebrtc \ --disable-oss \ --disable-ext-sound \ - --disable-libsamplerate \ --disable-sdl \ --disable-openh264 \ --disable-libyuv \
@@ -68,6 +67,13 @@ else LIBPJSIP_CONF_OPTS += --without-external-pa endif +ifeq ($(BR2_PACKAGE_LIBSAMPLERATE),y) +LIBPJSIP_DEPENDENCIES += libsamplerate +LIBPJSIP_CONF_OPTS += --enable-libsamplerate +else +LIBPJSIP_CONF_OPTS += --disable-libsamplerate +endif + # When --enable-ffmpeg is given, the code to enable FFmpeg is not executed. # Also, when cross-compiling and no --with-ffmpeg option is given, FFmpeg is # disabled. Therefore, a --with-ffmpeg option needs to be given. Normally it
Signature · 1 line
2.13.6
PATCH v3 8/8 libpjsip: enable resample
In reply to Adam DuskettResampling support is essential to most sip devices.
---
Changes v1 -> v2:
- None
Changes v2 -> v3:
- Add this patch to the series.
package/libpjsip/libpjsip.mk | 1 - 1 file changed, 1 deletion(-)
package/libpjsip/libpjsip.mk +0 -1
@@ -25,7 +25,6 @@ LIBPJSIP_CONF_ENV = \ CFLAGS="$(LIBPJSIP_CFLAGS)" LIBPJSIP_CONF_OPTS = \ - --disable-resample \ --disable-libwebrtc \ --disable-oss \ --disable-ext-sound \
Signature · 1 line
2.13.6