From 10d5f99d3d718fe11b5a8b90096ccb7a07125fbb Mon Sep 17 00:00:00 2001 From: winlin Date: Sun, 5 Apr 2020 17:14:22 +0800 Subject: [PATCH] For #307, SRTP ASM only works with openssl-1.0, auto detect it. 4.0.22 --- README.md | 1 + trunk/auto/depends.sh | 16 ++++++++++++---- trunk/src/core/srs_core_version4.hpp | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 05fe32591..85290663a 100755 --- a/README.md +++ b/README.md @@ -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 diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index 5175c6957..1ed7e3aa3 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -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 " > ${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 diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 59147ea42..34fd22900 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -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