1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Merge branch 'feature/rtc' into develop

This commit is contained in:
winlin 2020-06-23 18:58:37 +08:00
commit 1c72a89fca
97 changed files with 654 additions and 9368 deletions

View file

@ -69,6 +69,18 @@ else
srs_undefine_macro "SRS_SRT" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_CXX11 = YES ]; then
srs_define_macro "SRS_CXX11" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_CXX11" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_CXX14 = YES ]; then
srs_define_macro "SRS_CXX14" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_CXX14" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_RTC = YES ]; then
srs_define_macro "SRS_RTC" $SRS_AUTO_HEADERS_H
else

View file

@ -1,112 +0,0 @@
#!/bin/bash
ff_src_dir="../../3rdparty"
# the jobs to make ffmpeg
if [[ "" == $SRS_JOBS ]]; then
export SRS_JOBS="--jobs=1"
fi
ff_current_dir=$(pwd -P)
ff_build_dir="${ff_current_dir}/_build"
ff_release_dir="${ff_current_dir}/_release"
echo "start to build the tools for transcode system:"
echo "current_dir: ${ff_current_dir}"
echo "build_dir: ${ff_build_dir}"
echo "release_dir: ${ff_release_dir}"
echo "SRS_JOBS: ${SRS_JOBS}"
mkdir -p ${ff_build_dir}
mkdir -p ${ff_release_dir}
# yasm for libx264
ff_yasm_bin=${ff_release_dir}/bin/yasm
if [[ -f ${ff_yasm_bin} ]]; then
echo "yasm is ok"
else
echo "build yasm-1.2.0"
cd $ff_current_dir &&
rm -rf yasm-1.2.0 && unzip -q ${ff_src_dir}/yasm-1.2.0.zip &&
cd yasm-1.2.0 && ./configure --prefix=${ff_release_dir} &&
make && make install
ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build yasm-1.2.0 failed"; exit 1; fi
fi
# add yasm to path, for x264 to use yasm directly.
# ffmpeg can specifies the yasm path when configure it.
export PATH=${PATH}:${ff_release_dir}/bin
# libfdk-aac
if [[ -f ${ff_release_dir}/lib/libfdk-aac.a ]]; then
echo "libfdk_aac is ok"
else
echo "build fdk-aac-0.1.3"
cd $ff_current_dir &&
rm -rf fdk-aac-0.1.3 && unzip -q ${ff_src_dir}/fdk-aac-0.1.3.zip &&
cd fdk-aac-0.1.3 && bash autogen.sh && ./configure --prefix=${ff_release_dir} --enable-static && make ${SRS_JOBS} && make install
ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build fdk-aac-0.1.3 failed"; exit 1; fi
fi
# lame-3.99
if [[ -f ${ff_release_dir}/lib/libmp3lame.a ]]; then
echo "libmp3lame is ok"
else
echo "build lame-3.99.5"
cd $ff_current_dir &&
rm -rf lame-3.99.5 && unzip -q ${ff_src_dir}/lame-3.99.5.zip &&
cd lame-3.99.5 && ./configure --prefix=${ff_release_dir} --enable-static && make ${SRS_JOBS} && make install
ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build lame-3.99.5 failed"; exit 1; fi
fi
# speex-1.2rc1
if [[ -f ${ff_release_dir}/lib/libspeex.a ]]; then
echo "libspeex is ok"
else
echo "build speex-1.2rc1"
cd $ff_current_dir &&
rm -rf speex-1.2rc1 && unzip -q ${ff_src_dir}/speex-1.2rc1.zip &&
cd speex-1.2rc1 && ./configure --prefix=${ff_release_dir} --enable-static && make ${SRS_JOBS} && make install
ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build speex-1.2rc1 failed"; exit 1; fi
fi
# x264 core.157
if [[ -f ${ff_release_dir}/lib/libx264.a ]]; then
echo "x264 is ok"
else
echo "build x264"
cd $ff_current_dir &&
rm -rf x264-snapshot-20181116-2245 && unzip -q ${ff_src_dir}/x264-snapshot-20181116-2245.zip &&
cd x264-snapshot-20181116-2245 &&
./configure --prefix=${ff_release_dir} --disable-opencl --bit-depth=all \
--enable-static --disable-avs --disable-swscale --disable-lavf \
--disable-ffms --disable-gpac --disable-cli &&
make ${SRS_JOBS} && make install
ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build x264 failed"; exit 1; fi
fi
# ffmpeg-4.1
if [[ -f ${ff_release_dir}/bin/ffmpeg ]]; then
echo "ffmpeg-4.1 is ok"
else
echo "build ffmpeg-4.1"
cd $ff_current_dir &&
rm -rf ffmpeg-4.1 && unzip -q ${ff_src_dir}/ffmpeg-4.1.zip &&
echo "remove all so to force the ffmpeg to build in static" &&
rm -f ${ff_release_dir}/lib/*.so* &&
echo "export the dir to enable the build command canbe use." &&
export ffmpeg_exported_release_dir=${ff_release_dir} &&
cd ffmpeg-4.1 &&
./configure \
--enable-gpl --enable-nonfree \
--yasmexe=${ff_yasm_bin} \
--prefix=${ff_release_dir} --cc= \
--enable-static --disable-shared --disable-debug \
--extra-cflags='-I${ffmpeg_exported_release_dir}/include' \
--extra-ldflags='-L${ffmpeg_exported_release_dir}/lib -lm -ldl' \
--disable-ffplay --disable-ffprobe --disable-doc \
--enable-postproc --enable-bzlib --enable-zlib --enable-parsers \
--enable-libx264 --enable-libmp3lame --enable-libfdk-aac --enable-libspeex \
--enable-pthreads --extra-libs=-lpthread \
--enable-encoders --enable-decoders --enable-avfilter --enable-muxers --enable-demuxers &&
make ${SRS_JOBS} && make install
ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build ffmpeg failed"; exit 1; fi
fi

View file

@ -1,8 +0,0 @@
#!/bin/bash
# genereate the library header file.
objs=$1
rm -f $objs/include/srs_librtmp.h &&
cp $objs/../src/libs/srs_librtmp.hpp $objs/include/srs_librtmp.h
echo "genereate srs-librtmp headers success"

View file

@ -29,8 +29,8 @@ echo "# INCS for ${MODULE_ID}, headers of module and its depends to compile" >>
echo "${MODULE_ID}_MODULE_INCS = -I${MODULE_DIR} " >> ${FILE}
#
# the private include files, for example:
# CORE_INCS = -Isrc/core -Iobjs/st -Iobjs -Iobjs/hp -Iobjs
# MAIN_INCS = -Isrc/main $(CORE_MODULE_INCS) -Iobjs/st -Iobjs
# CORE_INCS = -Isrc/core -Iobjs
# CORE_LIBS_INCS = -Iobjs/st -Iobjs/ffmpeg/include
# where the public will be used for other modules which depends on it.
INCS_NAME="${MODULE_ID}_INCS"
#
@ -39,12 +39,14 @@ echo -n "${INCS_NAME} = -I${MODULE_DIR} " >> ${FILE}
#
# depends module header files
for item in ${MODULE_DEPENDS[*]}; do
DEP_INCS_NAME="${item}_INCS"do
DEP_INCS_NAME="${item}_MODULE_INCS"
echo -n "\$(${DEP_INCS_NAME})" >> ${FILE}
done
echo "" >> ${FILE}
#
# depends library header files
INCS_LIBS_NAME="${MODULE_ID}_LIBS_INCS"
echo -n "${INCS_LIBS_NAME} = " >> ${FILE}
for item in ${ModuleLibIncs[*]}; do
echo -n "-I${item} " >> ${FILE}
done
@ -58,6 +60,7 @@ DEPS_NAME="${MODULE_ID}_DEPS"
echo -n "${DEPS_NAME} = " >> ${FILE}
for item in ${MODULE_FILES[*]}; do
HEADER_FILE="${MODULE_DIR}/${item}.hpp"
if [[ ! -f ${HEADER_FILE} ]]; then HEADER_FILE="${MODULE_DIR}/${item}.h"; fi
if [ -f ${HEADER_FILE} ]; then
echo -n " ${HEADER_FILE}" >> ${FILE}
fi
@ -75,13 +78,16 @@ echo "# OBJ for ${MODULE_ID}, each object file" >> ${FILE}
MODULE_OBJS=()
for item in ${MODULE_FILES[*]}; do
CPP_FILE="${MODULE_DIR}/${item}.cpp"
if [[ ! -f ${CPP_FILE} ]]; then CPP_FILE="${MODULE_DIR}/${item}.cc"; fi
OBJ_FILE="${SRS_OBJS_DIR}/${MODULE_DIR}/${item}.o"
MODULE_OBJS="${MODULE_OBJS[@]} ${CPP_FILE}"
if [ -f ${CPP_FILE} ]; then
echo "${OBJ_FILE}: \$(${DEPS_NAME}) ${CPP_FILE} " >> ${FILE}
echo " \$(CXX) -c \$(CXXFLAGS) ${DEFINES}\\" >> ${FILE}
echo " \$(${INCS_NAME})\\" >> ${FILE}
echo " -o ${OBJ_FILE} ${CPP_FILE}" >> ${FILE}
echo " \$(${INCS_NAME})\\" >> ${FILE}
echo " \$(${INCS_LIBS_NAME})\\" >> ${FILE}
echo " -o ${OBJ_FILE} \\" >> ${FILE}
echo " ${CPP_FILE}" >> ${FILE}
fi
done
echo "" >> ${FILE}

View file

@ -19,6 +19,8 @@ SRS_HDS=NO
SRS_SRT=NO
SRS_RTC=YES
SRS_GB28181=NO
SRS_CXX11=NO
SRS_CXX14=NO
SRS_NGINX=NO
SRS_FFMPEG_TOOL=NO
SRS_LIBRTMP=NO
@ -149,6 +151,8 @@ Features:
--srt=on|off Whether build the SRT support for SRS.
--rtc=on|off Whether build the WebRTC support for SRS.
--gb28181=on|off Whether build the GB28181 support for SRS.
--cxx11=on|off Whether enable the C++11 support for SRS.
--cxx14=on|off Whether enable the C++14 support for SRS.
--prefix=<path> The absolute installation path for srs. Default: $SRS_PREFIX
--gcov=on|off Whether enable the GCOV compiler options.
@ -321,6 +325,9 @@ function parse_user_option() {
--without-gb28181) SRS_GB28181=NO ;;
--gb28181) if [[ $value == off ]]; then SRS_GB28181=NO; else SRS_GB28181=YES; fi ;;
--cxx11) if [[ $value == off ]]; then SRS_CXX11=NO; else SRS_CXX11=YES; fi ;;
--cxx14) if [[ $value == off ]]; then SRS_CXX14=NO; else SRS_CXX14=YES; fi ;;
--with-clean) SRS_CLEAN=YES ;;
--without-clean) SRS_CLEAN=NO ;;
--clean) if [[ $value == off ]]; then SRS_CLEAN=NO; else SRS_CLEAN=YES; fi ;;
@ -514,6 +521,11 @@ function apply_user_presets() {
SRS_UTEST=NO
SRS_STATIC=NO
fi
# Enable c++11 for SRT.
if [[ $SRS_SRT == YES ]]; then
SRS_CXX11=YES
fi
}
apply_user_presets
@ -613,6 +625,8 @@ function regenerate_options() {
if [ $SRS_RTC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --rtc=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --rtc=off"; fi
if [ $SRS_SIMULATOR = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --simulator=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --simulator=off"; fi
if [ $SRS_GB28181 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gb28181=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gb28181=off"; fi
if [ $SRS_CXX11 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx11=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx11=off"; fi
if [ $SRS_CXX14 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx14=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx14=off"; fi
if [ $SRS_NASM = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --nasm=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --nasm=off"; fi
if [ $SRS_SRTP_ASM = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --srtp-nasm=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --srtp-nasm=off"; fi
if [ $SRS_SENDMMSG = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sendmmsg=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sendmmsg=off"; fi