1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-12 19:31:53 +00:00

For #1659, #307, add opus codec library

This commit is contained in:
winlin 2020-03-22 14:03:48 +08:00
parent 2da4e0a43e
commit 634a14bfa6
2 changed files with 39 additions and 12 deletions

BIN
trunk/3rdparty/opus-1.3.1.tar.gz vendored Normal file

Binary file not shown.

View file

@ -84,6 +84,13 @@ function Ubuntu_prepare()
echo "The unzip is installed."
fi
nasm -v >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing nasm."
require_sudoer "sudo apt-get install -y --force-yes nasm"
sudo apt-get install -y --force-yes nasm; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The nasm is installed."
fi
if [[ $SRS_VALGRIND == YES ]]; then
valgrind --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing valgrind."
@ -157,6 +164,13 @@ function Centos_prepare()
echo "The unzip is installed."
fi
nasm -v >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing nasm."
require_sudoer "sudo yum install -y nasm"
sudo yum install -y nasm; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The nasm is installed."
fi
if [[ $SRS_VALGRIND == YES ]]; then
valgrind --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing valgrind."
@ -373,7 +387,7 @@ if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then
rm -rf ${SRS_OBJS}/openssl-1.1.0e && cd ${SRS_OBJS} &&
unzip -q ../3rdparty/openssl-1.1.0e.zip && cd openssl-1.1.0e &&
${OPENSSL_CONFIG} --prefix=`pwd`/_release $OPENSSL_OPTIONS &&
make CC=${SRS_TOOL_CC} AR="${SRS_TOOL_AR} -rs" LD=${SRS_TOOL_LD} RANDLIB=${SRS_TOOL_RANDLIB} && make install_sw &&
make CC=${SRS_TOOL_CC} AR="${SRS_TOOL_AR} -rs" LD=${SRS_TOOL_LD} RANDLIB=${SRS_TOOL_RANDLIB} ${SRS_JOBS} && make install_sw &&
cd .. && rm -rf openssl && ln -sf openssl-1.1.0e/_release openssl
)
fi
@ -382,6 +396,27 @@ if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then
if [ ! -f ${SRS_OBJS}/openssl/lib/libssl.a ]; then echo "Build openssl-1.1.0e failed."; exit -1; fi
fi
#####################################################################################
# libopus, for WebRTC to transcode AAC with Opus.
#####################################################################################
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# cross build not specified, if exists flag, need to rebuild for no-arm platform.
if [[ -f ${SRS_OBJS}/opus/lib/libopus.a ]]; then
echo "The opus-1.3.1 is ok.";
else
echo "Building opus-1.3.1.";
(
rm -rf ${SRS_OBJS}/opus-1.3.1 && cd ${SRS_OBJS} &&
tar xf ../3rdparty/opus-1.3.1.tar.gz && cd opus-1.3.1 &&
./configure --prefix=`pwd`/_release --enable-static --disable-shared && make ${SRS_JOBS} && make install
cd .. && rm -rf opus && ln -sf opus-1.3.1/_release opus
)
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build opus-1.3.1 failed, ret=$ret"; exit $ret; fi
if [ ! -f ${SRS_OBJS}/opus/lib/libopus.a ]; then echo "Build opus-1.3.1 failed."; exit -1; fi
fi
#####################################################################################
# live transcoding, ffmpeg-4.1, x264-core157, lame-3.99.5, libaacplus-2.0.2.
#####################################################################################
@ -393,17 +428,9 @@ if [ $SRS_FFMPEG_TOOL = YES ]; then
if [[ -f ${SRS_OBJS}/ffmpeg/bin/ffmpeg ]]; then
echo "ffmpeg-4.1 is ok.";
else
echo "build ffmpeg-4.1";
(
cd ${SRS_OBJS} && pwd_dir=`pwd` &&
rm -rf ffmepg.src && mkdir -p ffmpeg.src && cd ffmpeg.src &&
rm -f build_ffmpeg.sh && ln -sf ../../auto/build_ffmpeg.sh && . build_ffmpeg.sh &&
cd ${pwd_dir} && rm -rf ffmpeg && ln -sf ffmpeg.src/_release ffmpeg
)
echo "no ffmpeg-4.1 found, please run in docker ossrs/srs:dev";
exit -1;
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build ffmpeg-4.1 failed, ret=$ret"; exit $ret; fi
if [ ! -f ${SRS_OBJS}/ffmpeg/bin/ffmpeg ]; then echo "build ffmpeg-4.1 failed."; exit -1; fi
fi
#####################################################################################
@ -417,7 +444,7 @@ if [[ $SRS_SRT == YES ]]; then
if [[ -f ${SRS_OBJS}/srt/lib/libsrt.a ]]; then
echo "libsrt-1.4.1 is ok.";
else
echo "no libsrt, please use srs-docker or build from source https://github.com/ossrs/srs/issues/1147#issuecomment-577469119";
echo "no libsrt, please run in docker ossrs/srs:srt or build from source https://github.com/ossrs/srs/issues/1147#issuecomment-577469119";
exit -1;
fi
fi