From f6720c18c6c3bb999bd698629771be8a5559bd05 Mon Sep 17 00:00:00 2001
From: winlin <winlin@vip.126.com>
Date: Mon, 25 Jan 2021 22:23:42 +0800
Subject: [PATCH] Enable --nasm and --srtp-asm by default for performance.
 4.0.64

---
 README.md                            |  1 +
 trunk/auto/depends.sh                |  3 ++-
 trunk/auto/options.sh                | 10 +++++-----
 trunk/configure                      | 10 ++++++++++
 trunk/src/core/srs_core_version4.hpp |  2 +-
 5 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index 1bf1ac342..2360de420 100755
--- a/README.md
+++ b/README.md
@@ -155,6 +155,7 @@ For previous versions, please read:
 
 ## V4 changes
 
+* v4.0, 2021-01-25, Enable --nasm and --srtp-asm by default for performance. 4.0.64
 * v4.0, 2021-01-20, Support HTTP-FLV and HLS for srs-player by H5. 4.0.63
 * v4.0, 2021-01-08, HTML5 video tag resolution adaptive. 4.0.59
 * v4.0, 2021-01-08, Fix memory leak and bugs for RTC. 4.0.58
diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh
index 5aa99680d..aafd93d92 100755
--- a/trunk/auto/depends.sh
+++ b/trunk/auto/depends.sh
@@ -491,6 +491,7 @@ if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then
     # For RTC, we should use ASM to improve performance, not a little improving.
     if [[ $SRS_RTC == NO || $SRS_NASM == NO ]]; then
         OPENSSL_OPTIONS="$OPENSSL_OPTIONS -no-asm"
+        echo "Warning: NASM is off, performance is hurt"
     fi
     # Mac OS X can have issues (its often a neglected platform).
     # @see https://wiki.openssl.org/index.php/Compilation_and_Installation
@@ -537,7 +538,7 @@ if [[ $SRS_SRTP_ASM == YES ]]; then
     echo "  #endif                                                " >> ${SRS_OBJS}/_tmp_srtp_asm_detect.c
     ${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";
+        SRS_SRTP_ASM=NO && echo "Warning: Disable SRTP-ASM optimization, please update docker";
     fi
     rm -f ${SRS_OBJS}/_tmp_srtp_asm_detect.c
 fi;
diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh
index e8ed1627f..be4e93fab 100755
--- a/trunk/auto/options.sh
+++ b/trunk/auto/options.sh
@@ -128,8 +128,8 @@ SRS_EXTRA_FLAGS=
 #
 #####################################################################################
 # Performance optimize.
-SRS_NASM=NO
-SRS_SRTP_ASM=NO
+SRS_NASM=YES
+SRS_SRTP_ASM=YES
 SRS_SENDMMSG=NO
 SRS_DEBUG=NO
 
@@ -500,18 +500,18 @@ function apply_detail_options() {
     fi
 
     if [[ $SRS_SRTP_ASM == YES && $SRS_RTC == NO ]]; then
-        echo "Disable SRTP ASM, because RTC is disabled."
+        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."
+        echo "Disable SRTP-ASM, because NASM is disabled."
         SRS_SRTP_ASM=NO
     fi
 
     # Which openssl we choose, openssl-1.0.* for SRTP with ASM, others we use openssl-1.1.*
     if [[ $SRS_SRTP_ASM == YES && $SRS_SSL_1_0 == NO ]]; then
-        echo "Use openssl-1.0 for SRTP ASM."
+        echo "Use openssl-1.0 for SRTP-ASM."
         SRS_SSL_1_0=YES
     fi
 
diff --git a/trunk/configure b/trunk/configure
index 5bfb54a0d..2b0f5be21 100755
--- a/trunk/configure
+++ b/trunk/configure
@@ -717,6 +717,16 @@ if [ $SRS_SSL = YES ]; then
 else
     echo -e "${YELLOW}Warning: RTMP complex handshake is disabled, flash cann't play h264/aac.${BLACK}"
 fi
+if [[ $SRS_NASM == YES ]]; then
+    echo -e "${GREEN}NASM for HTTPS(openssl) and FFmepg is enabled${BLACK}"
+else
+    echo -e "${YELLOW}Warning: NASM for HTTPS(openssl) and FFmepg is disabled${BLACK}"
+fi
+if [[ $SRS_SRTP_ASM == YES ]]; then
+    echo -e "${GREEN}SRTP-NASM for WebRTC(openssl) is enabled${BLACK}"
+else
+    echo -e "${YELLOW}Warning: SRTP-NASM for WebRTC(openssl) is disabled${BLACK}"
+fi
 if [ $SRS_TRANSCODE = YES ]; then
     echo -e "${GREEN}The transcoding is enabled${BLACK}"
 else
diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp
index 47a71625f..bf107fccc 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 63
+#define SRS_VERSION4_REVISION 64
 
 #endif