From a80084289b39266fa7a7023bf6237357e02fd7a8 Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 14 Apr 2020 20:12:33 +0800 Subject: [PATCH] Support debug --- trunk/auto/auto_headers.sh | 6 ++++++ trunk/auto/options.sh | 4 ++++ trunk/scripts/perf_gso.py | 2 +- trunk/src/core/srs_core.hpp | 5 +++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/trunk/auto/auto_headers.sh b/trunk/auto/auto_headers.sh index 84b64319b..d77325395 100755 --- a/trunk/auto/auto_headers.sh +++ b/trunk/auto/auto_headers.sh @@ -171,6 +171,12 @@ else srs_undefine_macro "SRS_AUTO_HAS_SENDMMSG" $SRS_AUTO_HEADERS_H fi +if [ $SRS_DEBUG = YES ]; then + srs_define_macro "SRS_AUTO_DEBUG" $SRS_AUTO_HEADERS_H +else + srs_undefine_macro "SRS_AUTO_DEBUG" $SRS_AUTO_HEADERS_H +fi + # prefix echo "" >> $SRS_AUTO_HEADERS_H echo "#define SRS_AUTO_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 0e31b05fd..69293fce3 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -122,6 +122,7 @@ SRS_NASM=YES SRS_SRTP_ASM=YES SRS_SENDMMSG=YES SRS_HAS_SENDMMSG=YES +SRS_DEBUG=NO ##################################################################################### # menu @@ -162,6 +163,7 @@ Features: --prefix= The absolute installation path for srs. Default: $SRS_PREFIX --static Whether add '-static' to link options. --gcov Whether enable the GCOV compiler options. + --debug Whether enable the debug code, may hurt performance. --jobs[=N] Allow N jobs at once; infinite jobs with no arg. Used for make in the configure, for example, to make ffmpeg. --log-verbose Whether enable the log verbose level. default: no. @@ -293,6 +295,7 @@ function parse_user_option() { --log-info) SRS_LOG_INFO=YES ;; --log-trace) SRS_LOG_TRACE=YES ;; --gcov) SRS_GCOV=YES ;; + --debug) SRS_DEBUG=YES ;; --arm) SRS_CROSS_BUILD=YES ;; --mips) SRS_CROSS_BUILD=YES ;; @@ -623,6 +626,7 @@ function regenerate_options() { if [ $SRS_LOG_INFO = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-info"; fi if [ $SRS_LOG_TRACE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-trace"; fi if [ $SRS_GCOV = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gcov"; fi + if [ $SRS_DEBUG = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --debug"; fi if [[ $SRS_EXTRA_FLAGS != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --extra-flags=\\\"$SRS_EXTRA_FLAGS\\\""; fi if [[ $SRS_BUILD_TAG != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --build-tag=\\\"$SRS_BUILD_TAG\\\""; fi if [[ $SRS_TOOL_CC != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cc=$SRS_TOOL_CC"; fi diff --git a/trunk/scripts/perf_gso.py b/trunk/scripts/perf_gso.py index 95ef027b5..75df5e527 100755 --- a/trunk/scripts/perf_gso.py +++ b/trunk/scripts/perf_gso.py @@ -35,7 +35,7 @@ f.close() print "Repsonse %s"%(s) obj = json.loads(s) -keys = [3, 5, 9, 16, 32, 64, 128, 256, 1000] +keys = [1, 3, 5, 9, 16, 32, 64, 256, 1000] print "" print("AV---Frames"), diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index c846214b2..725c1bff4 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -33,6 +33,11 @@ // The macros generated by configure script. #include +// Alias for debug. +#ifdef SRS_AUTO_DEBUG +#define SRS_DEBUG +#endif + // To convert macro values to string. // @see https://gcc.gnu.org/onlinedocs/cpp/Stringification.html#Stringification #define SRS_INTERNAL_STR(v) #v