Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OPUS music and desktop DSP flags to configure.ac #81

Open
wants to merge 5 commits into
base: public
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ DerivedData/
.vs/

xcuserdata/
autom4te.cache/
autom4te.cache/
8 changes: 8 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,14 @@ TGVOIP_HDRS += \
audio/AudioIOCallback.h
endif

if ENABLE_DESKTOP_DSP
CFLAGS += -DTGVOIP_USE_DESKTOP_DSP
endif

if ENABLE_OPUS_MUSIC
CFLAGS += -DTGVOIP_USE_OPUS_MUSIC
endif

if TARGET_CPU_ARM
SRC += \
webrtc_dsp/common_audio/signal_processing/complex_bit_reverse_arm.S \
Expand Down
29 changes: 16 additions & 13 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,15 @@ host_triplet = @host@
@ENABLE_AUDIO_CALLBACK_TRUE@@ENABLE_DSP_TRUE@am__append_17 = \
@ENABLE_AUDIO_CALLBACK_TRUE@@ENABLE_DSP_TRUE@audio/AudioIOCallback.h

@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_TRUE@am__append_18 = \
@ENABLE_DESKTOP_DSP_TRUE@@ENABLE_DSP_TRUE@am__append_18 = -DTGVOIP_USE_DESKTOP_DSP
@ENABLE_DSP_TRUE@@ENABLE_OPUS_MUSIC_TRUE@am__append_19 = -DTGVOIP_USE_OPUS_MUSIC
@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_TRUE@am__append_20 = \
@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_TRUE@webrtc_dsp/common_audio/signal_processing/complex_bit_reverse_arm.S \
@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_TRUE@webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_arm.S

@ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@am__append_19 = -mfpu=neon -mfloat-abi=hard
@ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@am__append_20 = -mfpu=neon -mfloat-abi=hard
@ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@am__append_21 = \
@ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@am__append_21 = -mfpu=neon -mfloat-abi=hard
@ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@am__append_22 = -mfpu=neon -mfloat-abi=hard
@ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@am__append_23 = \
@ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@webrtc_dsp/common_audio/signal_processing/cross_correlation_neon.c \
@ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@webrtc_dsp/common_audio/signal_processing/downsample_fast_neon.c \
@ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@webrtc_dsp/common_audio/signal_processing/min_max_operations_neon.c \
Expand All @@ -435,13 +437,13 @@ host_triplet = @host@
@ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@webrtc_dsp/modules/audio_processing/utility/ooura_fft_neon.cc

# webrtc_dsp/common_audio/signal_processing/filter_ar_fast_q12_armv7.S
@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_FALSE@am__append_22 = \
@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_FALSE@am__append_24 = \
@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_FALSE@webrtc_dsp/common_audio/signal_processing/complex_bit_reverse.c \
@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_FALSE@webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c


# headers
@ENABLE_DSP_TRUE@am__append_23 = \
@ENABLE_DSP_TRUE@am__append_25 = \
@ENABLE_DSP_TRUE@webrtc_dsp/system_wrappers/include/field_trial.h \
@ENABLE_DSP_TRUE@webrtc_dsp/system_wrappers/include/cpu_features_wrapper.h \
@ENABLE_DSP_TRUE@webrtc_dsp/system_wrappers/include/asm_defines.h \
Expand Down Expand Up @@ -761,8 +763,8 @@ host_triplet = @host@
@ENABLE_DSP_TRUE@webrtc_dsp/common_audio/vad/vad_sp.h \
@ENABLE_DSP_TRUE@webrtc_dsp/common_audio/vad/vad_filterbank.h

@ENABLE_DSP_FALSE@am__append_24 = -DTGVOIP_NO_DSP
@TARGET_OS_OSX_TRUE@am__append_25 = -std=gnu++0x $(CFLAGS)
@ENABLE_DSP_FALSE@am__append_26 = -DTGVOIP_NO_DSP
@TARGET_OS_OSX_TRUE@am__append_27 = -std=gnu++0x $(CFLAGS)
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
Expand Down Expand Up @@ -2227,11 +2229,12 @@ AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@ $(am__append_9) $(am__append_20)
CCASFLAGS = @CCASFLAGS@ $(am__append_9) $(am__append_22)
CCDEPMODE = @CCDEPMODE@
CFLAGS = -Wall -DHAVE_CONFIG_H -Wno-unknown-pragmas $(am__append_8) \
$(am__append_11) $(am__append_13) $(am__append_15) \
$(am__append_19) $(am__append_24)
$(am__append_18) $(am__append_19) $(am__append_21) \
$(am__append_26)
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
Expand Down Expand Up @@ -2272,7 +2275,7 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJCXX = @OBJCXX@
OBJCXXDEPMODE = @OBJCXXDEPMODE@
OBJCXXFLAGS = @OBJCXXFLAGS@ $(am__append_25)
OBJCXXFLAGS = @OBJCXXFLAGS@ $(am__append_27)
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
Expand Down Expand Up @@ -2357,8 +2360,8 @@ SRC = VoIPController.cpp Buffers.cpp CongestionControl.cpp \
video/VideoRenderer.cpp video/ScreamCongestionController.cpp \
json11.cpp $(am__append_1) $(am__append_4) $(am__append_6) \
$(am__append_10) $(am__append_12) $(am__append_14) \
$(am__append_16) $(am__append_18) $(am__append_21) \
$(am__append_22) $(am__append_23)
$(am__append_16) $(am__append_20) $(am__append_23) \
$(am__append_24) $(am__append_25)
TGVOIP_HDRS = VoIPController.h Buffers.h BlockingQueue.h \
PrivateDefines.h CongestionControl.h EchoCanceller.h \
JitterBuffer.h logging.h threading.h MediaStreamItf.h \
Expand Down
14 changes: 12 additions & 2 deletions OpusEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,16 @@ namespace{
tgvoip::OpusEncoder::OpusEncoder(MediaStreamItf *source, bool needSecondary):queue(11), bufferPool(960*2, 10){
this->source=source;
source->SetCallback(tgvoip::OpusEncoder::Callback, this);
#ifdef TGVOIP_USE_OPUS_MUSIC
enc=opus_encoder_create(48000, 1, OPUS_APPLICATION_AUDIO, NULL);
opus_encoder_ctl(enc, OPUS_SET_SIGNAL(OPUS_SIGNAL_MUSIC));
#else
enc=opus_encoder_create(48000, 1, OPUS_APPLICATION_VOIP, NULL);
opus_encoder_ctl(enc, OPUS_SET_SIGNAL(OPUS_SIGNAL_VOICE));
#endif
opus_encoder_ctl(enc, OPUS_SET_COMPLEXITY(10));
opus_encoder_ctl(enc, OPUS_SET_PACKET_LOSS_PERC(1));
opus_encoder_ctl(enc, OPUS_SET_INBAND_FEC(1));
opus_encoder_ctl(enc, OPUS_SET_SIGNAL(OPUS_SIGNAL_VOICE));
opus_encoder_ctl(enc, OPUS_SET_BANDWIDTH(OPUS_BANDWIDTH_FULLBAND));
requestedBitrate=20000;
currentBitrate=0;
Expand All @@ -56,9 +61,14 @@ tgvoip::OpusEncoder::OpusEncoder(MediaStreamItf *source, bool needSecondary):que
secondaryEncoderEnabled=false;

if(needSecondary){
#ifdef TGVOIP_USE_OPUS_MUSIC
secondaryEncoder=opus_encoder_create(48000, 1, OPUS_APPLICATION_AUDIO, NULL);
opus_encoder_ctl(secondaryEncoder, OPUS_SET_SIGNAL(OPUS_SIGNAL_MUSIC));
#else
secondaryEncoder=opus_encoder_create(48000, 1, OPUS_APPLICATION_VOIP, NULL);
opus_encoder_ctl(secondaryEncoder, OPUS_SET_COMPLEXITY(10));
opus_encoder_ctl(secondaryEncoder, OPUS_SET_SIGNAL(OPUS_SIGNAL_VOICE));
#endif
opus_encoder_ctl(secondaryEncoder, OPUS_SET_COMPLEXITY(10));
//opus_encoder_ctl(secondaryEncoder, OPUS_SET_VBR(0));
opus_encoder_ctl(secondaryEncoder, OPUS_SET_BITRATE(8000));
opus_encoder_ctl(secondaryEncoder, OPUS_SET_BANDWIDTH(secondaryEnabledBandwidth));
Expand Down
1 change: 1 addition & 0 deletions VoIPController.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ namespace tgvoip{
};

enum{
STATE_CREATED=0,
STATE_WAIT_INIT=1,
STATE_WAIT_INIT_ACK,
STATE_ESTABLISHED,
Expand Down
48 changes: 48 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,10 @@ WITH_ALSA_FALSE
WITH_ALSA_TRUE
WITH_PULSE_FALSE
WITH_PULSE_TRUE
ENABLE_OPUS_MUSIC_FALSE
ENABLE_OPUS_MUSIC_TRUE
ENABLE_DESKTOP_DSP_FALSE
ENABLE_DESKTOP_DSP_TRUE
ENABLE_AUDIO_CALLBACK_FALSE
ENABLE_AUDIO_CALLBACK_TRUE
TARGET_OS_OSX_FALSE
Expand Down Expand Up @@ -798,6 +802,8 @@ with_gnu_ld
with_sysroot
enable_libtool_lock
enable_audio_callback
enable_desktop_dsp
enable_opus_music
with_pulse
with_alsa
enable_dsp
Expand Down Expand Up @@ -1450,6 +1456,8 @@ Optional Features:
speeds up one-time build
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-audio-callback enable callback-based audio I/O
--enable-desktop-dsp enable desktop DSP
--enable-opus-music enable music preset in OPUS encoder
--disable-dsp disable signal processing (echo cancellation, noise
suppression, and automatic gain control)

Expand Down Expand Up @@ -17698,6 +17706,38 @@ else
fi


# Check whether --enable-desktop-dsp was given.
if test "${enable_desktop_dsp+set}" = set; then :
enableval=$enable_desktop_dsp;
else
enable_desktop_dsp=no
fi

if test "x$enable_desktop_dsp" == xyes; then
ENABLE_DESKTOP_DSP_TRUE=
ENABLE_DESKTOP_DSP_FALSE='#'
else
ENABLE_DESKTOP_DSP_TRUE='#'
ENABLE_DESKTOP_DSP_FALSE=
fi


# Check whether --enable-opus-music was given.
if test "${enable_opus_music+set}" = set; then :
enableval=$enable_opus_music;
else
enable_opus_music=no
fi

if test "x$enable_opus_music" == xyes; then
ENABLE_OPUS_MUSIC_TRUE=
ENABLE_OPUS_MUSIC_FALSE='#'
else
ENABLE_OPUS_MUSIC_TRUE='#'
ENABLE_OPUS_MUSIC_FALSE=
fi


if test "x$os_osx" != xyes && test "x$enable_audio_callback" != xyes; then :
# Linux
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
Expand Down Expand Up @@ -18754,6 +18794,14 @@ if test -z "${ENABLE_AUDIO_CALLBACK_TRUE}" && test -z "${ENABLE_AUDIO_CALLBACK_F
as_fn_error $? "conditional \"ENABLE_AUDIO_CALLBACK\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ENABLE_DESKTOP_DSP_TRUE}" && test -z "${ENABLE_DESKTOP_DSP_FALSE}"; then
as_fn_error $? "conditional \"ENABLE_DESKTOP_DSP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ENABLE_OPUS_MUSIC_TRUE}" && test -z "${ENABLE_OPUS_MUSIC_FALSE}"; then
as_fn_error $? "conditional \"ENABLE_OPUS_MUSIC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${WITH_PULSE_TRUE}" && test -z "${WITH_PULSE_FALSE}"; then
as_fn_error $? "conditional \"WITH_PULSE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
Expand Down
6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ AM_CONDITIONAL(TARGET_OS_OSX, test "x$os_osx" == xyes)
AC_ARG_ENABLE([audio-callback], [AS_HELP_STRING([--enable-audio-callback], [enable callback-based audio I/O])], [], [enable_audio_callback=no])
AM_CONDITIONAL(ENABLE_AUDIO_CALLBACK, test "x$enable_audio_callback" == xyes)

AC_ARG_ENABLE([desktop-dsp], [AS_HELP_STRING([--enable-desktop-dsp], [enable desktop DSP])], [], [enable_desktop_dsp=no])
AM_CONDITIONAL(ENABLE_DESKTOP_DSP, test "x$enable_desktop_dsp" == xyes)

AC_ARG_ENABLE([opus-music], [AS_HELP_STRING([--enable-opus-music], [enable music preset in OPUS encoder])], [], [enable_opus_music=no])
AM_CONDITIONAL(ENABLE_OPUS_MUSIC, test "x$enable_opus_music" == xyes)

AS_IF([test "x$os_osx" != xyes && test "x$enable_audio_callback" != xyes], [ # Linux
AC_CHECK_LIB([dl], [dlopen])

Expand Down