diff --git a/trunk/3rdparty/opus-1.3.1.tar.gz b/trunk/3rdparty/opus-1.3.1.tar.gz new file mode 100644 index 000000000..1119371fc Binary files /dev/null and b/trunk/3rdparty/opus-1.3.1.tar.gz differ diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index b2c69bbdb..786c8aef8 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -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