1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 03:41:55 +00:00

For #307, SRTP ASM only works with openssl-1.0, auto detect it. 4.0.22

This commit is contained in:
winlin 2020-04-05 17:14:22 +08:00
parent 9943565ec9
commit 10d5f99d3d
3 changed files with 14 additions and 5 deletions

View file

@ -158,6 +158,7 @@ For previous versions, please read:
## V4 changes
* v4.0, 2020-04-05, For [#307][bug #307], SRTP ASM only works with openssl-1.0, auto detect it. 4.0.22
* v4.0, 2020-04-04, Merge RTC and GB28181, with bugs fixed. 4.0.21
* v4.0, 2020-04-04, For [#307][bug #307], refine RTC latency from 600ms to 200ms. 4.0.20
* v4.0, 2020-04-03, For [#307][bug #307], build SRTP with openssl to improve performance. 4.0.19

View file

@ -479,10 +479,6 @@ if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then
elif [[ ! -f ${SRS_OBJS}/${SRS_PLATFORM}/openssl/lib/libssl.a ]]; then
# For older docker, which does not support SRTP asm optimization.
if [[ -f /usr/local/lib64/libssl.a ]]; then
# TODO: FIMXE: Remove it in future, do not need to be compatible with older docker.
if [[ $SRS_SRTP_ASM == YES ]]; then
SRS_SRTP_ASM=NO && echo "Warning: Disable SRTP ASM optimization, please update docker";
fi;
(mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/openssl/lib && cd ${SRS_OBJS}/${SRS_PLATFORM}/openssl/lib &&
ln -sf /usr/local/lib64/libssl.a && ln -sf /usr/local/lib64/libcrypto.a &&
mkdir -p /usr/local/lib64/pkgconfig && ln -sf /usr/local/lib64/pkgconfig)
@ -540,6 +536,18 @@ fi
# srtp
#####################################################################################
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# For openssl-1.1.*, we should disable SRTP ASM, because SRTP only works with openssl-1.0.*
if [[ $SRS_SRTP_ASM == YES ]]; then
echo "#include <openssl/ssl.h>" > ${SRS_OBJS}/_tmp_srtp_asm_detect.c
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
if [[ $? -ne 0 ]]; then
SRS_SRTP_ASM=NO && echo "Warning: Disable SRTP ASM optimization, please update docker";
fi
rm -f ${SRS_OBJS}/_tmp_srtp_asm_detect.c
fi;
SRTP_CONFIG="echo SRTP without openssl(ASM) optimization" && SRTP_OPTIONS=""
# If use ASM for SRTP, we enable openssl(with ASM).
if [[ $SRS_SRTP_ASM == YES ]]; then

View file

@ -24,6 +24,6 @@
#ifndef SRS_CORE_VERSION4_HPP
#define SRS_CORE_VERSION4_HPP
#define SRS_VERSION4_REVISION 21
#define SRS_VERSION4_REVISION 22
#endif