mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
For #307, support configure with sendmmsg.
This commit is contained in:
parent
b23525033b
commit
dc3df926eb
8 changed files with 56 additions and 15 deletions
|
@ -160,6 +160,11 @@ if [ $SRS_OSX = YES ]; then
|
|||
else
|
||||
srs_undefine_macro "SRS_AUTO_OSX" $SRS_AUTO_HEADERS_H
|
||||
fi
|
||||
if [ $SRS_SENDMMSG = YES ]; then
|
||||
srs_define_macro "SRS_AUTO_SENDMMSG" $SRS_AUTO_HEADERS_H
|
||||
else
|
||||
srs_undefine_macro "SRS_AUTO_SENDMMSG" $SRS_AUTO_HEADERS_H
|
||||
fi
|
||||
|
||||
# prefix
|
||||
echo "" >> $SRS_AUTO_HEADERS_H
|
||||
|
|
|
@ -346,9 +346,14 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
|||
if [[ $SRS_OSX == YES ]]; then
|
||||
_ST_MAKE=darwin-debug && _ST_EXTRA_CFLAGS="-DMD_HAVE_KQUEUE" && _ST_LD=${SRS_TOOL_CC} && _ST_OBJ="DARWIN_*"
|
||||
fi
|
||||
# For UDP sendmmsg, disable it if not suppported.
|
||||
if [[ $SRS_SENDMMSG == YES ]]; then
|
||||
echo "Build ST with UDP sendmmsg support."
|
||||
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_HAVE_SENDMMSG -D_GNU_SOURCE"
|
||||
fi
|
||||
# Pass the global extra flags.
|
||||
if [[ $SRS_EXTRA_FLAGS != '' ]]; then
|
||||
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS $SRS_EXTRA_FLAGS"
|
||||
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS $SRS_EXTRA_FLAGS"
|
||||
fi
|
||||
# Patched ST from https://github.com/ossrs/state-threads/tree/srs
|
||||
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/st/libst.a ]]; then
|
||||
|
@ -542,7 +547,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
|||
echo "#if OPENSSL_VERSION_NUMBER >= 0x10100000L // v1.1.x" >> ${SRS_OBJS}/_tmp_srtp_asm_detect.c
|
||||
echo "#error \"SRTP only works with openssl-1.0.*\"" >> ${SRS_OBJS}/_tmp_srtp_asm_detect.c
|
||||
echo "#endif" >> ${SRS_OBJS}/_tmp_srtp_asm_detect.c
|
||||
gcc -c ${SRS_OBJS}/_tmp_srtp_asm_detect.c -I${SRS_OBJS}/openssl/include -o /dev/null >/dev/null 2>&1
|
||||
${SRS_TOOL_CC} -c ${SRS_OBJS}/_tmp_srtp_asm_detect.c -I${SRS_OBJS}/openssl/include -o /dev/null >/dev/null 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
SRS_SRTP_ASM=NO && echo "Warning: Disable SRTP ASM optimization, please update docker";
|
||||
fi
|
||||
|
|
|
@ -120,6 +120,7 @@ SRS_EXTRA_FLAGS=
|
|||
# Performance optimize.
|
||||
SRS_NASM=YES
|
||||
SRS_SRTP_ASM=YES
|
||||
SRS_SENDMMSG=YES
|
||||
|
||||
#####################################################################################
|
||||
# menu
|
||||
|
@ -187,6 +188,8 @@ Performance: @see https://blog.csdn.net/win_lin/article/details/5
|
|||
--without-nasm Build FFMPEG for RTC without nasm support, for CentOS6 nasm is too old.
|
||||
--with-srtp-nasm Build SRTP with ASM(openssl-asm) support, requires RTC and openssl-1.0.*.
|
||||
--without-srtp-nasm Disable SRTP ASM support.
|
||||
--with-sendmmsg Enable UDP sendmmsg support. @see http://man7.org/linux/man-pages/man2/sendmmsg.2.html
|
||||
--without-sendmmsg Disable UDP sendmmsg support.
|
||||
|
||||
Toolchain options: @see https://github.com/ossrs/srs/issues/1547#issuecomment-576078411
|
||||
--arm Enable crossbuild for ARM.
|
||||
|
@ -249,6 +252,7 @@ function parse_user_option() {
|
|||
--with-gb28181) SRS_GB28181=YES ;;
|
||||
--with-nasm) SRS_NASM=YES ;;
|
||||
--with-srtp-nasm) SRS_SRTP_ASM=YES ;;
|
||||
--with-sendmmsg) SRS_SENDMMSG=YES ;;
|
||||
--with-clean) SRS_CLEAN=YES ;;
|
||||
--with-gperf) SRS_GPERF=YES ;;
|
||||
--with-gmc) SRS_GPERF_MC=YES ;;
|
||||
|
@ -270,6 +274,7 @@ function parse_user_option() {
|
|||
--without-gb28181) SRS_GB28181=NO ;;
|
||||
--without-nasm) SRS_NASM=NO ;;
|
||||
--without-srtp-nasm) SRS_SRTP_ASM=NO ;;
|
||||
--without-sendmmsg) SRS_SENDMMSG=NO ;;
|
||||
--without-clean) SRS_CLEAN=NO ;;
|
||||
--without-gperf) SRS_GPERF=NO ;;
|
||||
--without-gmc) SRS_GPERF_MC=NO ;;
|
||||
|
@ -547,6 +552,22 @@ function apply_user_detail_options() {
|
|||
SRS_GPROF=NO
|
||||
SRS_STATIC=NO
|
||||
fi
|
||||
|
||||
if [[ $SRS_SRTP_ASM == YES && $SRS_RTC == NO ]]; then
|
||||
echo "Disable SRTP ASM, because RTC is disabled."
|
||||
SRS_SRTP_ASM=NO
|
||||
fi
|
||||
|
||||
if [[ $SRS_SRTP_ASM == YES && $SRS_NASM == NO ]]; then
|
||||
echo "Disable SRTP ASM, because NASM is disabled."
|
||||
SRS_SRTP_ASM=NO
|
||||
fi
|
||||
|
||||
grep -qs sendmmsg /usr/include/sys/socket.h
|
||||
if [[ $? -ne 0 && $SRS_SENDMMSG == YES ]]; then
|
||||
echo "Disable UDP sendmmsg automatically"
|
||||
SRS_SENDMMSG=NO
|
||||
fi
|
||||
}
|
||||
apply_user_detail_options
|
||||
|
||||
|
@ -574,6 +595,7 @@ function regenerate_options() {
|
|||
if [ $SRS_GB28181 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gb28181"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gb28181"; fi
|
||||
if [ $SRS_NASM = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-nasm"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-nasm"; fi
|
||||
if [ $SRS_SRTP_ASM = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-srtp-nasm"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-srtp-nasm"; fi
|
||||
if [ $SRS_SENDMMSG = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-sendmmsg"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-sendmmsg"; fi
|
||||
if [ $SRS_CLEAN = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-clean"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-clean"; fi
|
||||
if [ $SRS_GPERF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gperf"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gperf"; fi
|
||||
if [ $SRS_GPERF_MC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gmc"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gmc"; fi
|
||||
|
@ -626,16 +648,6 @@ function check_option_conflicts() {
|
|||
exit -1
|
||||
fi
|
||||
|
||||
if [[ $SRS_SRTP_ASM == YES && $SRS_RTC == NO ]]; then
|
||||
echo "Disable SRTP ASM, because RTC is disabled."
|
||||
SRS_SRTP_ASM=NO
|
||||
fi
|
||||
|
||||
if [[ $SRS_SRTP_ASM == YES && $SRS_NASM == NO ]]; then
|
||||
echo "Disable SRTP ASM, because NASM is disabled."
|
||||
SRS_SRTP_ASM=NO
|
||||
fi
|
||||
|
||||
# TODO: FIXME: check more os.
|
||||
|
||||
__check_ok=YES
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue