1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Refactor macro SRS_AUTO_XXX to SRS_XXX.

This commit is contained in:
winlin 2020-04-29 20:02:28 +08:00
parent 2fe1874a87
commit ed338f4c0a
31 changed files with 193 additions and 198 deletions

View file

@ -11,11 +11,11 @@ echo "#ifndef SRS_AUTO_HEADER_HPP" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_HEADER_HPP" >> $SRS_AUTO_HEADERS_H echo "#define SRS_AUTO_HEADER_HPP" >> $SRS_AUTO_HEADERS_H
echo "" >> $SRS_AUTO_HEADERS_H echo "" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_BUILD_TS \"`date +%s`\"" >> $SRS_AUTO_HEADERS_H echo "#define SRS_BUILD_TS \"`date +%s`\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_BUILD_DATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $SRS_AUTO_HEADERS_H echo "#define SRS_BUILD_DATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_UNAME \"`uname -a`\"" >> $SRS_AUTO_HEADERS_H echo "#define SRS_UNAME \"`uname -a`\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_USER_CONFIGURE \"${SRS_AUTO_USER_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H echo "#define SRS_USER_CONFIGURE \"${SRS_AUTO_USER_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_CONFIGURE \"${SRS_AUTO_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H echo "#define SRS_CONFIGURE \"${SRS_AUTO_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H
echo "" >> $SRS_AUTO_HEADERS_H echo "" >> $SRS_AUTO_HEADERS_H
function srs_define_macro() function srs_define_macro()
@ -62,73 +62,73 @@ echo "" >> $SRS_AUTO_HEADERS_H
##################################################################################### #####################################################################################
# auto headers in depends. # auto headers in depends.
if [ $SRS_HDS = YES ]; then if [ $SRS_HDS = YES ]; then
srs_define_macro "SRS_AUTO_HDS" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_HDS" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_HDS" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_HDS" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_SRT = YES ]; then if [ $SRS_SRT = YES ]; then
srs_define_macro "SRS_AUTO_SRT" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_SRT" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_SRT" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_SRT" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_RTC = YES ]; then if [ $SRS_RTC = YES ]; then
srs_define_macro "SRS_AUTO_RTC" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_RTC" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_RTC" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_RTC" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_GB28181 = YES ]; then if [ $SRS_GB28181 = YES ]; then
srs_define_macro "SRS_AUTO_GB28181" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_GB28181" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_GB28181" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_GB28181" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_MEM_WATCH = YES ]; then if [ $SRS_MEM_WATCH = YES ]; then
srs_define_macro "SRS_AUTO_MEM_WATCH" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_MEM_WATCH" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_MEM_WATCH" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_MEM_WATCH" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_UTEST = YES ]; then if [ $SRS_UTEST = YES ]; then
srs_define_macro "SRS_AUTO_UTEST" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_UTEST" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_UTEST" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_UTEST" $SRS_AUTO_HEADERS_H
fi fi
# whatever the FFMPEG tools, if transcode and ingest specified, # whatever the FFMPEG tools, if transcode and ingest specified,
# srs always compile the FFMPEG tool stub which used to start the FFMPEG process. # srs always compile the FFMPEG tool stub which used to start the FFMPEG process.
if [ $SRS_FFMPEG_STUB = YES ]; then if [ $SRS_FFMPEG_STUB = YES ]; then
srs_define_macro "SRS_AUTO_FFMPEG_STUB" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_FFMPEG_STUB" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_FFMPEG_STUB" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_FFMPEG_STUB" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_GPERF = YES ]; then if [ $SRS_GPERF = YES ]; then
srs_define_macro "SRS_AUTO_GPERF" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_GPERF" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_GPERF" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_GPERF" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_GPERF_MC = YES ]; then if [ $SRS_GPERF_MC = YES ]; then
srs_define_macro "SRS_AUTO_GPERF_MC" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_GPERF_MC" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_GPERF_MC" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_GPERF_MC" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_GPERF_MD = YES ]; then if [ $SRS_GPERF_MD = YES ]; then
srs_define_macro "SRS_AUTO_GPERF_MD" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_GPERF_MD" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_GPERF_MD" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_GPERF_MD" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_GPERF_MP = YES ]; then if [ $SRS_GPERF_MP = YES ]; then
srs_define_macro "SRS_AUTO_GPERF_MP" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_GPERF_MP" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_GPERF_MP" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_GPERF_MP" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_GPERF_CP = YES ]; then if [ $SRS_GPERF_CP = YES ]; then
srs_define_macro "SRS_AUTO_GPERF_CP" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_GPERF_CP" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_GPERF_CP" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_GPERF_CP" $SRS_AUTO_HEADERS_H
fi fi
##################################################################################### #####################################################################################
@ -136,50 +136,50 @@ fi
##################################################################################### #####################################################################################
# for log level compile settings # for log level compile settings
if [ $SRS_LOG_VERBOSE = YES ]; then if [ $SRS_LOG_VERBOSE = YES ]; then
srs_define_macro "SRS_AUTO_VERBOSE" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_VERBOSE" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_VERBOSE" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_VERBOSE" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_LOG_INFO = YES ]; then if [ $SRS_LOG_INFO = YES ]; then
srs_define_macro "SRS_AUTO_INFO" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_INFO" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_INFO" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_INFO" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_LOG_TRACE = YES ]; then if [ $SRS_LOG_TRACE = YES ]; then
srs_define_macro "SRS_AUTO_TRACE" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_TRACE" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_TRACE" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_TRACE" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_CROSS_BUILD = YES ]; then if [ $SRS_CROSS_BUILD = YES ]; then
srs_define_macro "SRS_AUTO_CROSSBUILD" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_CROSSBUILD" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_CROSSBUILD" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_CROSSBUILD" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_OSX = YES ]; then if [ $SRS_OSX = YES ]; then
srs_define_macro "SRS_AUTO_OSX" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_OSX" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_OSX" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_OSX" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_SENDMMSG = YES ]; then if [ $SRS_SENDMMSG = YES ]; then
srs_define_macro "SRS_AUTO_SENDMMSG" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_SENDMMSG" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_SENDMMSG" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_SENDMMSG" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_HAS_SENDMMSG = YES ]; then if [ $SRS_HAS_SENDMMSG = YES ]; then
srs_define_macro "SRS_AUTO_HAS_SENDMMSG" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_HAS_SENDMMSG" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_HAS_SENDMMSG" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_HAS_SENDMMSG" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_DEBUG = YES ]; then if [ $SRS_DEBUG = YES ]; then
srs_define_macro "SRS_AUTO_DEBUG" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_DEBUG" $SRS_AUTO_HEADERS_H
else else
srs_undefine_macro "SRS_AUTO_DEBUG" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_DEBUG" $SRS_AUTO_HEADERS_H
fi fi
# prefix # prefix
echo "" >> $SRS_AUTO_HEADERS_H echo "" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H echo "#define SRS_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H
echo "" >> $SRS_AUTO_HEADERS_H echo "" >> $SRS_AUTO_HEADERS_H
@ -188,13 +188,13 @@ echo "" >> $SRS_AUTO_HEADERS_H
##################################################################################### #####################################################################################
if [[ -f ../AUTHORS.txt ]]; then if [[ -f ../AUTHORS.txt ]]; then
SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk '{print $2}'` SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk '{print $2}'`
echo "#define SRS_AUTO_CONSTRIBUTORS \"\\" >> $SRS_AUTO_HEADERS_H echo "#define SRS_CONSTRIBUTORS \"\\" >> $SRS_AUTO_HEADERS_H
for CONTRIBUTOR in $SRS_CONSTRIBUTORS; do for CONTRIBUTOR in $SRS_CONSTRIBUTORS; do
echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H
done done
echo "\"" >> $SRS_AUTO_HEADERS_H echo "\"" >> $SRS_AUTO_HEADERS_H
else else
echo "#define SRS_AUTO_CONSTRIBUTORS \"ossrs\"" >> $SRS_AUTO_HEADERS_H echo "#define SRS_CONSTRIBUTORS \"ossrs\"" >> $SRS_AUTO_HEADERS_H
fi fi
# new empty line to auto headers file. # new empty line to auto headers file.

View file

@ -4781,7 +4781,7 @@ bool SrsConfig::get_rtc_server_encrypt()
int SrsConfig::get_rtc_server_sendmmsg() int SrsConfig::get_rtc_server_sendmmsg()
{ {
#if !defined(SRS_AUTO_HAS_SENDMMSG) || !defined(SRS_AUTO_SENDMMSG) #if !defined(SRS_HAS_SENDMMSG) || !defined(SRS_SENDMMSG)
return 1; return 1;
#else #else
static int DEFAULT = 256; static int DEFAULT = 256;

View file

@ -45,7 +45,7 @@ using namespace std;
#include <srs_core_autofree.hpp> #include <srs_core_autofree.hpp>
#include <srs_kernel_utility.hpp> #include <srs_kernel_utility.hpp>
#ifdef SRS_AUTO_FFMPEG_STUB #ifdef SRS_FFMPEG_STUB
#define SRS_RTMP_ENCODER_COPY "copy" #define SRS_RTMP_ENCODER_COPY "copy"
#define SRS_RTMP_ENCODER_NO_VIDEO "vn" #define SRS_RTMP_ENCODER_NO_VIDEO "vn"

View file

@ -26,7 +26,7 @@
#include <srs_core.hpp> #include <srs_core.hpp>
#ifdef SRS_AUTO_FFMPEG_STUB #ifdef SRS_FFMPEG_STUB
#include <vector> #include <vector>
#include <string> #include <string>

View file

@ -23,7 +23,7 @@
#include <srs_app_hds.hpp> #include <srs_app_hds.hpp>
#ifdef SRS_AUTO_HDS #ifdef SRS_HDS
#include <unistd.h> #include <unistd.h>
#include <string> #include <string>

View file

@ -26,7 +26,7 @@
#include <srs_core.hpp> #include <srs_core.hpp>
#ifdef SRS_AUTO_HDS #ifdef SRS_HDS
#include <list> #include <list>

View file

@ -55,7 +55,7 @@ using namespace std;
// drop the segment when duration of ts too small. // drop the segment when duration of ts too small.
// TODO: FIXME: Refine to time unit. // TODO: FIXME: Refine to time unit.
#define SRS_AUTO_HLS_SEGMENT_MIN_DURATION (100 * SRS_UTIME_MILLISECONDS) #define SRS_HLS_SEGMENT_MIN_DURATION (100 * SRS_UTIME_MILLISECONDS)
// fragment plus the deviation percent. // fragment plus the deviation percent.
#define SRS_HLS_FLOOR_REAP_PERCENT 0.3 #define SRS_HLS_FLOOR_REAP_PERCENT 0.3
@ -498,7 +498,7 @@ bool SrsHlsMuxer::is_segment_overflow()
srs_assert(current); srs_assert(current);
// to prevent very small segment. // to prevent very small segment.
if (current->duration() < 2 * SRS_AUTO_HLS_SEGMENT_MIN_DURATION) { if (current->duration() < 2 * SRS_HLS_SEGMENT_MIN_DURATION) {
return false; return false;
} }
@ -518,7 +518,7 @@ bool SrsHlsMuxer::is_segment_absolutely_overflow()
srs_assert(current); srs_assert(current);
// to prevent very small segment. // to prevent very small segment.
if (current->duration() < 2 * SRS_AUTO_HLS_SEGMENT_MIN_DURATION) { if (current->duration() < 2 * SRS_HLS_SEGMENT_MIN_DURATION) {
return false; return false;
} }
@ -619,7 +619,7 @@ srs_error_t SrsHlsMuxer::do_segment_close()
// when too small, it maybe not enough data to play. // when too small, it maybe not enough data to play.
// when too large, it maybe timestamp corrupt. // when too large, it maybe timestamp corrupt.
// make the segment more acceptable, when in [min, max_td * 2], it's ok. // make the segment more acceptable, when in [min, max_td * 2], it's ok.
bool matchMinDuration = current->duration() >= SRS_AUTO_HLS_SEGMENT_MIN_DURATION; bool matchMinDuration = current->duration() >= SRS_HLS_SEGMENT_MIN_DURATION;
bool matchMaxDuration = current->duration() <= max_td * 2 * 1000; bool matchMaxDuration = current->duration() <= max_td * 2 * 1000;
if (matchMinDuration && matchMaxDuration) { if (matchMinDuration && matchMaxDuration) {
// use async to call the http hooks, for it will cause thread switch. // use async to call the http hooks, for it will cause thread switch.

View file

@ -46,7 +46,7 @@ using namespace std;
#include <srs_protocol_amf0.hpp> #include <srs_protocol_amf0.hpp>
#include <srs_protocol_utility.hpp> #include <srs_protocol_utility.hpp>
#include <srs_app_coworkers.hpp> #include <srs_app_coworkers.hpp>
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
#include <srs_app_rtc_conn.hpp> #include <srs_app_rtc_conn.hpp>
#endif #endif
@ -556,7 +556,7 @@ srs_error_t SrsGoApiAuthors::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa
obj->set("data", data); obj->set("data", data);
data->set("license", SrsJsonAny::str(RTMP_SIG_SRS_LICENSE)); data->set("license", SrsJsonAny::str(RTMP_SIG_SRS_LICENSE));
data->set("contributors", SrsJsonAny::str(SRS_AUTO_CONSTRIBUTORS)); data->set("contributors", SrsJsonAny::str(SRS_CONSTRIBUTORS));
return srs_api_response(w, r, obj->dumps()); return srs_api_response(w, r, obj->dumps());
} }
@ -582,17 +582,17 @@ srs_error_t SrsGoApiFeatures::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
SrsJsonObject* data = SrsJsonAny::object(); SrsJsonObject* data = SrsJsonAny::object();
obj->set("data", data); obj->set("data", data);
data->set("options", SrsJsonAny::str(SRS_AUTO_USER_CONFIGURE)); data->set("options", SrsJsonAny::str(SRS_USER_CONFIGURE));
data->set("options2", SrsJsonAny::str(SRS_AUTO_CONFIGURE)); data->set("options2", SrsJsonAny::str(SRS_CONFIGURE));
data->set("build", SrsJsonAny::str(SRS_AUTO_BUILD_DATE)); data->set("build", SrsJsonAny::str(SRS_BUILD_DATE));
data->set("build2", SrsJsonAny::str(SRS_AUTO_BUILD_TS)); data->set("build2", SrsJsonAny::str(SRS_BUILD_TS));
SrsJsonObject* features = SrsJsonAny::object(); SrsJsonObject* features = SrsJsonAny::object();
data->set("features", features); data->set("features", features);
features->set("ssl", SrsJsonAny::boolean(true)); features->set("ssl", SrsJsonAny::boolean(true));
features->set("hls", SrsJsonAny::boolean(true)); features->set("hls", SrsJsonAny::boolean(true));
#ifdef SRS_AUTO_HDS #ifdef SRS_HDS
features->set("hds", SrsJsonAny::boolean(true)); features->set("hds", SrsJsonAny::boolean(true));
#else #else
features->set("hds", SrsJsonAny::boolean(false)); features->set("hds", SrsJsonAny::boolean(false));
@ -785,7 +785,7 @@ srs_error_t SrsGoApiStreams::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa
return srs_api_response(w, r, obj->dumps()); return srs_api_response(w, r, obj->dumps());
} }
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
uint32_t SrsGoApiRtcPlay::ssrc_num = 0; uint32_t SrsGoApiRtcPlay::ssrc_num = 0;
SrsGoApiRtcPlay::SrsGoApiRtcPlay(SrsRtcServer* rtc_svr) SrsGoApiRtcPlay::SrsGoApiRtcPlay(SrsRtcServer* rtc_svr)
@ -2045,7 +2045,7 @@ srs_error_t SrsGoApiError::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage
return srs_api_response_code(w, r, 100); return srs_api_response_code(w, r, 100);
} }
#ifdef SRS_AUTO_GB28181 #ifdef SRS_GB28181
SrsGoApiGb28181::SrsGoApiGb28181() SrsGoApiGb28181::SrsGoApiGb28181()
{ {
} }
@ -2228,7 +2228,7 @@ srs_error_t SrsGoApiGb28181::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMe
} }
#endif #endif
#ifdef SRS_AUTO_GPERF #ifdef SRS_GPERF
#include <gperftools/malloc_extension.h> #include <gperftools/malloc_extension.h>
SrsGoApiTcmalloc::SrsGoApiTcmalloc() SrsGoApiTcmalloc::SrsGoApiTcmalloc()

View file

@ -167,7 +167,7 @@ public:
virtual srs_error_t serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r); virtual srs_error_t serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r);
}; };
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
class SrsGoApiRtcPlay : public ISrsHttpHandler class SrsGoApiRtcPlay : public ISrsHttpHandler
{ {
public: public:
@ -258,7 +258,7 @@ public:
virtual srs_error_t serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r); virtual srs_error_t serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r);
}; };
#ifdef SRS_AUTO_GB28181 #ifdef SRS_GB28181
class SrsGoApiGb28181 : public ISrsHttpHandler class SrsGoApiGb28181 : public ISrsHttpHandler
{ {
public: public:
@ -271,7 +271,7 @@ private:
}; };
#endif #endif
#ifdef SRS_AUTO_GPERF #ifdef SRS_GPERF
class SrsGoApiTcmalloc : public ISrsHttpHandler class SrsGoApiTcmalloc : public ISrsHttpHandler
{ {
public: public:

View file

@ -194,7 +194,7 @@ void SrsIngester::fast_kill()
// when error, ingester sleep for a while and retry. // when error, ingester sleep for a while and retry.
// ingest never sleep a long time, for we must start the stream ASAP. // ingest never sleep a long time, for we must start the stream ASAP.
#define SRS_AUTO_INGESTER_CIMS (3 * SRS_UTIME_SECONDS) #define SRS_INGESTER_CIMS (3 * SRS_UTIME_SECONDS)
srs_error_t SrsIngester::cycle() srs_error_t SrsIngester::cycle()
{ {
@ -212,7 +212,7 @@ srs_error_t SrsIngester::cycle()
srs_freep(err); srs_freep(err);
} }
srs_usleep(SRS_AUTO_INGESTER_CIMS); srs_usleep(SRS_INGESTER_CIMS);
} }
return err; return err;

View file

@ -890,7 +890,7 @@ srs_error_t SrsRtcSenderThread::send_messages(
return srs_error_wrap(err, "messages to packets"); return srs_error_wrap(err, "messages to packets");
} }
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
// If enabled GSO, send out some packets in a msghdr. // If enabled GSO, send out some packets in a msghdr.
if (packets.use_gso) { if (packets.use_gso) {
if ((err = send_packets_gso(packets)) != srs_success) { if ((err = send_packets_gso(packets)) != srs_success) {
@ -1223,7 +1223,7 @@ srs_error_t SrsRtcSenderThread::send_packets_gso(SrsRtcPackets& packets)
mhdr->msg_hdr.msg_namelen = (socklen_t)addrlen; mhdr->msg_hdr.msg_namelen = (socklen_t)addrlen;
mhdr->msg_hdr.msg_controllen = 0; mhdr->msg_hdr.msg_controllen = 0;
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
if (using_gso) { if (using_gso) {
mhdr->msg_hdr.msg_controllen = CMSG_SPACE(sizeof(uint16_t)); mhdr->msg_hdr.msg_controllen = CMSG_SPACE(sizeof(uint16_t));
if (!mhdr->msg_hdr.msg_control) { if (!mhdr->msg_hdr.msg_control) {
@ -2273,7 +2273,7 @@ srs_error_t SrsRtcSession::on_stun(SrsUdpMuxSocket* skt, SrsStunPacket* stun_req
return err; return err;
} }
#ifdef SRS_AUTO_OSX #ifdef SRS_OSX
// These functions are similar to the older byteorder(3) family of functions. // These functions are similar to the older byteorder(3) family of functions.
// For example, be32toh() is identical to ntohl(). // For example, be32toh() is identical to ntohl().
// @see https://linux.die.net/man/3/be32toh // @see https://linux.die.net/man/3/be32toh

View file

@ -30,7 +30,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <algorithm> #include <algorithm>
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
#include <sys/inotify.h> #include <sys/inotify.h>
#endif #endif
using namespace std; using namespace std;
@ -349,7 +349,7 @@ SrsUdpCasterListener::~SrsUdpCasterListener()
srs_freep(caster); srs_freep(caster);
} }
#ifdef SRS_AUTO_GB28181 #ifdef SRS_GB28181
SrsGb28181Listener::SrsGb28181Listener(SrsServer* svr, SrsListenerType t, SrsConfDirective* c) : SrsUdpStreamListener(svr, t, NULL) SrsGb28181Listener::SrsGb28181Listener(SrsServer* svr, SrsListenerType t, SrsConfDirective* c) : SrsUdpStreamListener(svr, t, NULL)
{ {
@ -514,7 +514,7 @@ srs_error_t SrsInotifyWorker::start()
{ {
srs_error_t err = srs_success; srs_error_t err = srs_success;
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
// Whether enable auto reload config. // Whether enable auto reload config.
bool auto_reload = _srs_config->inotify_auto_reload(); bool auto_reload = _srs_config->inotify_auto_reload();
if (!auto_reload && _srs_in_docker && _srs_config->auto_reload_for_docker()) { if (!auto_reload && _srs_in_docker && _srs_config->auto_reload_for_docker()) {
@ -594,7 +594,7 @@ srs_error_t SrsInotifyWorker::cycle()
{ {
srs_error_t err = srs_success; srs_error_t err = srs_success;
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
string config_path = _srs_config->config(); string config_path = _srs_config->config();
string config_file = srs_path_basename(config_path); string config_file = srs_path_basename(config_path);
string k8s_file = "..data"; string k8s_file = "..data";
@ -695,7 +695,7 @@ void SrsServer::destroy()
srs_freep(signal_manager); srs_freep(signal_manager);
srs_freep(conn_manager); srs_freep(conn_manager);
#ifdef SRS_AUTO_GB28181 #ifdef SRS_GB28181
//free global gb28181 manager //free global gb28181 manager
srs_freep(_srs_gb28181); srs_freep(_srs_gb28181);
#endif #endif
@ -721,7 +721,7 @@ void SrsServer::dispose()
// @remark don't dispose all connections, for too slow. // @remark don't dispose all connections, for too slow.
#ifdef SRS_AUTO_MEM_WATCH #ifdef SRS_MEM_WATCH
srs_memory_report(); srs_memory_report();
#endif #endif
} }
@ -763,7 +763,7 @@ void SrsServer::gracefully_dispose()
_srs_sources->dispose(); _srs_sources->dispose();
srs_trace("source disposed"); srs_trace("source disposed");
#ifdef SRS_AUTO_MEM_WATCH #ifdef SRS_MEM_WATCH
srs_memory_report(); srs_memory_report();
#endif #endif
@ -992,7 +992,7 @@ srs_error_t SrsServer::http_handle()
if ((err = http_api_mux->handle("/api/v1/perf", new SrsGoApiPerf())) != srs_success) { if ((err = http_api_mux->handle("/api/v1/perf", new SrsGoApiPerf())) != srs_success) {
return srs_error_wrap(err, "handle perf"); return srs_error_wrap(err, "handle perf");
} }
#ifdef SRS_AUTO_GB28181 #ifdef SRS_GB28181
if ((err = http_api_mux->handle("/api/v1/gb28181", new SrsGoApiGb28181())) != srs_success) { if ((err = http_api_mux->handle("/api/v1/gb28181", new SrsGoApiGb28181())) != srs_success) {
return srs_error_wrap(err, "handle raw"); return srs_error_wrap(err, "handle raw");
} }
@ -1015,7 +1015,7 @@ srs_error_t SrsServer::http_handle()
return srs_error_wrap(err, "handle tests errors for error.srs.com"); return srs_error_wrap(err, "handle tests errors for error.srs.com");
} }
#ifdef SRS_AUTO_GPERF #ifdef SRS_GPERF
// The test api for get tcmalloc stats. // The test api for get tcmalloc stats.
// @see Memory Introspection in https://gperftools.github.io/gperftools/tcmalloc.html // @see Memory Introspection in https://gperftools.github.io/gperftools/tcmalloc.html
if ((err = http_api_mux->handle("/api/v1/tcmalloc", new SrsGoApiTcmalloc())) != srs_success) { if ((err = http_api_mux->handle("/api/v1/tcmalloc", new SrsGoApiTcmalloc())) != srs_success) {
@ -1058,7 +1058,7 @@ srs_error_t SrsServer::cycle()
// Do server main cycle. // Do server main cycle.
err = do_cycle(); err = do_cycle();
#ifdef SRS_AUTO_GPERF_MC #ifdef SRS_GPERF_MC
destroy(); destroy();
// remark, for gmc, never invoke the exit(). // remark, for gmc, never invoke the exit().
@ -1104,7 +1104,7 @@ void SrsServer::on_signal(int signo)
return; return;
} }
#ifndef SRS_AUTO_GPERF_MC #ifndef SRS_GPERF_MC
if (signo == SRS_SIGNAL_REOPEN_LOG) { if (signo == SRS_SIGNAL_REOPEN_LOG) {
_srs_log->reopen(); _srs_log->reopen();
srs_warn("reopen log file, signo=%d", signo); srs_warn("reopen log file, signo=%d", signo);
@ -1112,7 +1112,7 @@ void SrsServer::on_signal(int signo)
} }
#endif #endif
#ifdef SRS_AUTO_GPERF_MC #ifdef SRS_GPERF_MC
if (signo == SRS_SIGNAL_REOPEN_LOG) { if (signo == SRS_SIGNAL_REOPEN_LOG) {
signal_gmc_stop = true; signal_gmc_stop = true;
srs_warn("for gmc, the SIGUSR1 used as SIGINT, signo=%d", signo); srs_warn("for gmc, the SIGUSR1 used as SIGINT, signo=%d", signo);
@ -1126,11 +1126,11 @@ void SrsServer::on_signal(int signo)
} }
if (signo == SIGINT) { if (signo == SIGINT) {
#ifdef SRS_AUTO_GPERF_MC #ifdef SRS_GPERF_MC
srs_trace("gmc is on, main cycle will terminate normally, signo=%d", signo); srs_trace("gmc is on, main cycle will terminate normally, signo=%d", signo);
signal_gmc_stop = true; signal_gmc_stop = true;
#else #else
#ifdef SRS_AUTO_MEM_WATCH #ifdef SRS_MEM_WATCH
srs_memory_report(); srs_memory_report();
#endif #endif
#endif #endif
@ -1206,7 +1206,7 @@ srs_error_t SrsServer::do_cycle()
// if user interrupt the program, exit to check mem leak. // if user interrupt the program, exit to check mem leak.
// but, if gperf, use reload to ensure main return normally, // but, if gperf, use reload to ensure main return normally,
// because directly exit will cause core-dump. // because directly exit will cause core-dump.
#ifdef SRS_AUTO_GPERF_MC #ifdef SRS_GPERF_MC
if (signal_gmc_stop) { if (signal_gmc_stop) {
srs_warn("gmc got singal to stop server."); srs_warn("gmc got singal to stop server.");
return err; return err;
@ -1359,7 +1359,7 @@ srs_error_t SrsServer::listen_http_stream()
return err; return err;
} }
#ifdef SRS_AUTO_GB28181 #ifdef SRS_GB28181
srs_error_t SrsServer::listen_gb28181_sip(SrsConfDirective* stream_caster) srs_error_t SrsServer::listen_gb28181_sip(SrsConfDirective* stream_caster)
{ {
srs_error_t err = srs_success; srs_error_t err = srs_success;
@ -1410,7 +1410,7 @@ srs_error_t SrsServer::listen_stream_caster()
} else if (srs_stream_caster_is_flv(caster)) { } else if (srs_stream_caster_is_flv(caster)) {
listener = new SrsHttpFlvListener(this, SrsListenerFlv, stream_caster); listener = new SrsHttpFlvListener(this, SrsListenerFlv, stream_caster);
} else if (srs_stream_caster_is_gb28181(caster)) { } else if (srs_stream_caster_is_gb28181(caster)) {
#ifdef SRS_AUTO_GB28181 #ifdef SRS_GB28181
//init global gb28181 manger //init global gb28181 manger
if (_srs_gb28181 == NULL){ if (_srs_gb28181 == NULL){
_srs_gb28181 = new SrsGb28181Manger(stream_caster); _srs_gb28181 = new SrsGb28181Manger(stream_caster);

View file

@ -164,7 +164,7 @@ public:
virtual ~SrsUdpCasterListener(); virtual ~SrsUdpCasterListener();
}; };
#ifdef SRS_AUTO_GB28181 #ifdef SRS_GB28181
// A UDP gb28181 listener, for sip and rtp stream mux server. // A UDP gb28181 listener, for sip and rtp stream mux server.
class SrsGb28181Listener : public SrsUdpStreamListener class SrsGb28181Listener : public SrsUdpStreamListener
@ -323,7 +323,7 @@ private:
virtual srs_error_t listen_http_api(); virtual srs_error_t listen_http_api();
virtual srs_error_t listen_http_stream(); virtual srs_error_t listen_http_stream();
virtual srs_error_t listen_stream_caster(); virtual srs_error_t listen_stream_caster();
#ifdef SRS_AUTO_GB28181 #ifdef SRS_GB28181
virtual srs_error_t listen_gb28181_sip(SrsConfDirective* c); virtual srs_error_t listen_gb28181_sip(SrsConfDirective* c);
#endif #endif
// Close the listeners for specified type, // Close the listeners for specified type,

View file

@ -50,7 +50,7 @@ using namespace std;
#include <srs_app_ng_exec.hpp> #include <srs_app_ng_exec.hpp>
#include <srs_app_dash.hpp> #include <srs_app_dash.hpp>
#include <srs_protocol_format.hpp> #include <srs_protocol_format.hpp>
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
#include <srs_app_rtc.hpp> #include <srs_app_rtc.hpp>
#endif #endif
@ -843,7 +843,7 @@ SrsSharedPtrMessage* SrsMixQueue::pop()
return msg; return msg;
} }
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
SrsRtpPacketQueue::SrsRtpPacketQueue() SrsRtpPacketQueue::SrsRtpPacketQueue()
{ {
} }
@ -905,10 +905,10 @@ SrsOriginHub::SrsOriginHub()
dash = new SrsDash(); dash = new SrsDash();
dvr = new SrsDvr(); dvr = new SrsDvr();
encoder = new SrsEncoder(); encoder = new SrsEncoder();
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
rtc = new SrsRtc(); rtc = new SrsRtc();
#endif #endif
#ifdef SRS_AUTO_HDS #ifdef SRS_HDS
hds = new SrsHds(); hds = new SrsHds();
#endif #endif
ng_exec = new SrsNgExec(); ng_exec = new SrsNgExec();
@ -936,7 +936,7 @@ SrsOriginHub::~SrsOriginHub()
srs_freep(dash); srs_freep(dash);
srs_freep(dvr); srs_freep(dvr);
srs_freep(encoder); srs_freep(encoder);
#ifdef SRS_AUTO_HDS #ifdef SRS_HDS
srs_freep(hds); srs_freep(hds);
#endif #endif
} }
@ -952,7 +952,7 @@ srs_error_t SrsOriginHub::initialize(SrsSource* s, SrsRequest* r)
return srs_error_wrap(err, "format initialize"); return srs_error_wrap(err, "format initialize");
} }
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
if ((err = rtc->initialize(this, req)) != srs_success) { if ((err = rtc->initialize(this, req)) != srs_success) {
return srs_error_wrap(err, "rtc initialize"); return srs_error_wrap(err, "rtc initialize");
} }
@ -1056,7 +1056,7 @@ srs_error_t SrsOriginHub::on_audio(SrsSharedPtrMessage* shared_audio)
srs_flv_srates[c->sound_rate]); srs_flv_srates[c->sound_rate]);
} }
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
if ((err = rtc->on_audio(msg, format)) != srs_success) { if ((err = rtc->on_audio(msg, format)) != srs_success) {
srs_warn("rtc: ignore audio error %s", srs_error_desc(err).c_str()); srs_warn("rtc: ignore audio error %s", srs_error_desc(err).c_str());
srs_error_reset(err); srs_error_reset(err);
@ -1095,7 +1095,7 @@ srs_error_t SrsOriginHub::on_audio(SrsSharedPtrMessage* shared_audio)
dvr->on_unpublish(); dvr->on_unpublish();
} }
#ifdef SRS_AUTO_HDS #ifdef SRS_HDS
if ((err = hds->on_audio(msg)) != srs_success) { if ((err = hds->on_audio(msg)) != srs_success) {
srs_warn("hds: ignore audio error %s", srs_error_desc(err).c_str()); srs_warn("hds: ignore audio error %s", srs_error_desc(err).c_str());
srs_error_reset(err); srs_error_reset(err);
@ -1157,7 +1157,7 @@ srs_error_t SrsOriginHub::on_video(SrsSharedPtrMessage* shared_video, bool is_se
return err; return err;
} }
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
// Parse RTMP message to RTP packets, in FU-A if too large. // Parse RTMP message to RTP packets, in FU-A if too large.
if ((err = rtc->on_video(msg, format)) != srs_success) { if ((err = rtc->on_video(msg, format)) != srs_success) {
// TODO: We should support more strategies. // TODO: We should support more strategies.
@ -1204,7 +1204,7 @@ srs_error_t SrsOriginHub::on_video(SrsSharedPtrMessage* shared_video, bool is_se
dvr->on_unpublish(); dvr->on_unpublish();
} }
#ifdef SRS_AUTO_HDS #ifdef SRS_HDS
if ((err = hds->on_video(msg)) != srs_success) { if ((err = hds->on_video(msg)) != srs_success) {
srs_warn("hds: ignore video error %s", srs_error_desc(err).c_str()); srs_warn("hds: ignore video error %s", srs_error_desc(err).c_str());
srs_error_reset(err); srs_error_reset(err);
@ -1240,7 +1240,7 @@ srs_error_t SrsOriginHub::on_publish()
return srs_error_wrap(err, "encoder publish"); return srs_error_wrap(err, "encoder publish");
} }
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
if ((err = rtc->on_publish()) != srs_success) { if ((err = rtc->on_publish()) != srs_success) {
return srs_error_wrap(err, "rtc publish"); return srs_error_wrap(err, "rtc publish");
} }
@ -1259,7 +1259,7 @@ srs_error_t SrsOriginHub::on_publish()
} }
// TODO: FIXME: use initialize to set req. // TODO: FIXME: use initialize to set req.
#ifdef SRS_AUTO_HDS #ifdef SRS_HDS
if ((err = hds->on_publish(req)) != srs_success) { if ((err = hds->on_publish(req)) != srs_success) {
return srs_error_wrap(err, "hds publish"); return srs_error_wrap(err, "hds publish");
} }
@ -1283,14 +1283,14 @@ void SrsOriginHub::on_unpublish()
destroy_forwarders(); destroy_forwarders();
encoder->on_unpublish(); encoder->on_unpublish();
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
rtc->on_unpublish(); rtc->on_unpublish();
#endif #endif
hls->on_unpublish(); hls->on_unpublish();
dash->on_unpublish(); dash->on_unpublish();
dvr->on_unpublish(); dvr->on_unpublish();
#ifdef SRS_AUTO_HDS #ifdef SRS_HDS
hds->on_unpublish(); hds->on_unpublish();
#endif #endif
@ -1479,7 +1479,7 @@ srs_error_t SrsOriginHub::on_reload_vhost_hds(string vhost)
// TODO: FIXME: maybe should ignore when publish already stopped? // TODO: FIXME: maybe should ignore when publish already stopped?
#ifdef SRS_AUTO_HDS #ifdef SRS_HDS
hds->on_unpublish(); hds->on_unpublish();
// Don't start HDS when source is not active. // Don't start HDS when source is not active.
@ -1947,7 +1947,7 @@ SrsSource::SrsSource()
jitter_algorithm = SrsRtmpJitterAlgorithmOFF; jitter_algorithm = SrsRtmpJitterAlgorithmOFF;
mix_correct = false; mix_correct = false;
mix_queue = new SrsMixQueue(); mix_queue = new SrsMixQueue();
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
rtp_queue = new SrsRtpPacketQueue(); rtp_queue = new SrsRtpPacketQueue();
#endif #endif
@ -1979,7 +1979,7 @@ SrsSource::~SrsSource()
srs_freep(hub); srs_freep(hub);
srs_freep(meta); srs_freep(meta);
srs_freep(mix_queue); srs_freep(mix_queue);
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
srs_freep(rtp_queue); srs_freep(rtp_queue);
#endif #endif
@ -2739,7 +2739,7 @@ string SrsSource::get_curr_origin()
return play_edge->get_curr_origin(); return play_edge->get_curr_origin();
} }
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
SrsRtpSharedPacket* SrsSource::find_rtp_packet(const uint16_t& seq) SrsRtpSharedPacket* SrsSource::find_rtp_packet(const uint16_t& seq)
{ {
return rtp_queue->find(seq); return rtp_queue->find(seq);

View file

@ -59,7 +59,7 @@ class SrsDvr;
class SrsDash; class SrsDash;
class SrsEncoder; class SrsEncoder;
class SrsBuffer; class SrsBuffer;
#ifdef SRS_AUTO_HDS #ifdef SRS_HDS
class SrsHds; class SrsHds;
#endif #endif
class SrsRtpSharedPacket; class SrsRtpSharedPacket;
@ -333,7 +333,7 @@ public:
virtual SrsSharedPtrMessage* pop(); virtual SrsSharedPtrMessage* pop();
}; };
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
// To find the RTP packet for RTX or restore. // To find the RTP packet for RTX or restore.
// TODO: FIXME: Should queue RTP packets in connection level. // TODO: FIXME: Should queue RTP packets in connection level.
class SrsRtpPacketQueue class SrsRtpPacketQueue
@ -371,7 +371,7 @@ private:
private: private:
// The format, codec information. // The format, codec information.
SrsRtmpFormat* format; SrsRtmpFormat* format;
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
// rtc handler // rtc handler
SrsRtc* rtc; SrsRtc* rtc;
#endif #endif
@ -383,7 +383,7 @@ private:
SrsDvr* dvr; SrsDvr* dvr;
// transcoding handler. // transcoding handler.
SrsEncoder* encoder; SrsEncoder* encoder;
#ifdef SRS_AUTO_HDS #ifdef SRS_HDS
// adobe hds(http dynamic streaming). // adobe hds(http dynamic streaming).
SrsHds *hds; SrsHds *hds;
#endif #endif
@ -547,7 +547,7 @@ private:
bool mix_correct; bool mix_correct;
// The mix queue to implements the mix correct algorithm. // The mix queue to implements the mix correct algorithm.
SrsMixQueue* mix_queue; SrsMixQueue* mix_queue;
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
// rtp packet queue // rtp packet queue
SrsRtpPacketQueue* rtp_queue; SrsRtpPacketQueue* rtp_queue;
#endif #endif
@ -640,7 +640,7 @@ public:
public: public:
virtual std::string get_curr_origin(); virtual std::string get_curr_origin();
public: public:
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
// Find rtp packet by sequence // Find rtp packet by sequence
SrsRtpSharedPacket* find_rtp_packet(const uint16_t& seq); SrsRtpSharedPacket* find_rtp_packet(const uint16_t& seq);
// Get the cached meta, as such the sps/pps. // Get the cached meta, as such the sps/pps.

View file

@ -35,7 +35,7 @@
#include <sys/time.h> #include <sys/time.h>
#include <math.h> #include <math.h>
#include <map> #include <map>
#ifdef SRS_AUTO_OSX #ifdef SRS_OSX
#include <sys/sysctl.h> #include <sys/sysctl.h>
#endif #endif
using namespace std; using namespace std;
@ -329,7 +329,7 @@ SrsProcSystemStat* srs_get_system_proc_stat()
bool get_proc_system_stat(SrsProcSystemStat& r) bool get_proc_system_stat(SrsProcSystemStat& r)
{ {
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
FILE* f = fopen("/proc/stat", "r"); FILE* f = fopen("/proc/stat", "r");
if (f == NULL) { if (f == NULL) {
srs_warn("open system cpu stat failed, ignore"); srs_warn("open system cpu stat failed, ignore");
@ -368,7 +368,7 @@ bool get_proc_system_stat(SrsProcSystemStat& r)
bool get_proc_self_stat(SrsProcSelfStat& r) bool get_proc_self_stat(SrsProcSelfStat& r)
{ {
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
FILE* f = fopen("/proc/self/stat", "r"); FILE* f = fopen("/proc/self/stat", "r");
if (f == NULL) { if (f == NULL) {
srs_warn("open self cpu stat failed, ignore"); srs_warn("open self cpu stat failed, ignore");
@ -491,7 +491,7 @@ SrsDiskStat* srs_get_disk_stat()
bool srs_get_disk_vmstat_stat(SrsDiskStat& r) bool srs_get_disk_vmstat_stat(SrsDiskStat& r)
{ {
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
FILE* f = fopen("/proc/vmstat", "r"); FILE* f = fopen("/proc/vmstat", "r");
if (f == NULL) { if (f == NULL) {
srs_warn("open vmstat failed, ignore"); srs_warn("open vmstat failed, ignore");
@ -523,7 +523,7 @@ bool srs_get_disk_diskstats_stat(SrsDiskStat& r)
r.ok = true; r.ok = true;
r.sample_time = srsu2ms(srs_get_system_time()); r.sample_time = srsu2ms(srs_get_system_time());
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
// if disabled, ignore all devices. // if disabled, ignore all devices.
SrsConfDirective* conf = _srs_config->get_stats_disk_device(); SrsConfDirective* conf = _srs_config->get_stats_disk_device();
if (conf == NULL) { if (conf == NULL) {
@ -687,7 +687,7 @@ void srs_update_meminfo()
{ {
SrsMemInfo& r = _srs_system_meminfo; SrsMemInfo& r = _srs_system_meminfo;
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
FILE* f = fopen("/proc/meminfo", "r"); FILE* f = fopen("/proc/meminfo", "r");
if (f == NULL) { if (f == NULL) {
srs_warn("open meminfo failed, ignore"); srs_warn("open meminfo failed, ignore");
@ -781,7 +781,7 @@ void srs_update_platform_info()
r.srs_startup_time = srsu2ms(srs_get_system_startup_time()); r.srs_startup_time = srsu2ms(srs_get_system_startup_time());
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
if (true) { if (true) {
FILE* f = fopen("/proc/uptime", "r"); FILE* f = fopen("/proc/uptime", "r");
if (f == NULL) { if (f == NULL) {
@ -893,7 +893,7 @@ int srs_get_network_devices_count()
void srs_update_network_devices() void srs_update_network_devices()
{ {
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
if (true) { if (true) {
FILE* f = fopen("/proc/net/dev", "r"); FILE* f = fopen("/proc/net/dev", "r");
if (f == NULL) { if (f == NULL) {
@ -978,7 +978,7 @@ void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps)
int nb_tcp_mem = 0; int nb_tcp_mem = 0;
int nb_udp4 = 0; int nb_udp4 = 0;
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
if (true) { if (true) {
FILE* f = fopen("/proc/net/sockstat", "r"); FILE* f = fopen("/proc/net/sockstat", "r");
if (f == NULL) { if (f == NULL) {
@ -1021,7 +1021,7 @@ void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps)
int nb_tcp_estab = 0; int nb_tcp_estab = 0;
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
if (true) { if (true) {
FILE* f = fopen("/proc/net/snmp", "r"); FILE* f = fopen("/proc/net/snmp", "r");
if (f == NULL) { if (f == NULL) {

View file

@ -33,11 +33,6 @@
// The macros generated by configure script. // The macros generated by configure script.
#include <srs_auto_headers.hpp> #include <srs_auto_headers.hpp>
// Alias for debug.
#ifdef SRS_AUTO_DEBUG
#define SRS_DEBUG
#endif
// To convert macro values to string. // To convert macro values to string.
// @see https://gcc.gnu.org/onlinedocs/cpp/Stringification.html#Stringification // @see https://gcc.gnu.org/onlinedocs/cpp/Stringification.html#Stringification
#define SRS_INTERNAL_STR(v) #v #define SRS_INTERNAL_STR(v) #v
@ -68,7 +63,7 @@
#endif #endif
// For RTC/FFMPEG build. // For RTC/FFMPEG build.
#if defined(SRS_AUTO_RTC) && !defined(__STDC_CONSTANT_MACROS) #if defined(SRS_RTC) && !defined(__STDC_CONSTANT_MACROS)
#define __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS
#endif #endif

View file

@ -23,7 +23,7 @@
#include <srs_core_mem_watch.hpp> #include <srs_core_mem_watch.hpp>
#ifdef SRS_AUTO_MEM_WATCH #ifdef SRS_MEM_WATCH
#include <map> #include <map>
#include <stdio.h> #include <stdio.h>

View file

@ -26,7 +26,7 @@
#include <srs_core.hpp> #include <srs_core.hpp>
#ifdef SRS_AUTO_MEM_WATCH #ifdef SRS_MEM_WATCH
#warning "MemoryWatch is deprecated." #warning "MemoryWatch is deprecated."

View file

@ -40,7 +40,7 @@ using namespace std;
#include <srs_kernel_utility.hpp> #include <srs_kernel_utility.hpp>
#include <srs_core_mem_watch.hpp> #include <srs_core_mem_watch.hpp>
#include <srs_core_autofree.hpp> #include <srs_core_autofree.hpp>
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
#include <srs_kernel_rtp.hpp> #include <srs_kernel_rtp.hpp>
#endif #endif
@ -164,7 +164,7 @@ SrsCommonMessage::SrsCommonMessage()
SrsCommonMessage::~SrsCommonMessage() SrsCommonMessage::~SrsCommonMessage()
{ {
#ifdef SRS_AUTO_MEM_WATCH #ifdef SRS_MEM_WATCH
srs_memory_unwatch(payload); srs_memory_unwatch(payload);
#endif #endif
srs_freepa(payload); srs_freepa(payload);
@ -177,7 +177,7 @@ void SrsCommonMessage::create_payload(int size)
payload = new char[size]; payload = new char[size];
srs_verbose("create payload for RTMP message. size=%d", size); srs_verbose("create payload for RTMP message. size=%d", size);
#ifdef SRS_AUTO_MEM_WATCH #ifdef SRS_MEM_WATCH
srs_memory_watch(payload, "RTMP.msg.payload", size); srs_memory_watch(payload, "RTMP.msg.payload", size);
#endif #endif
} }
@ -211,7 +211,7 @@ SrsSharedPtrMessage::SrsSharedPtrPayload::SrsSharedPtrPayload()
size = 0; size = 0;
shared_count = 0; shared_count = 0;
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
samples = NULL; samples = NULL;
nn_samples = 0; nn_samples = 0;
has_idr = false; has_idr = false;
@ -224,12 +224,12 @@ SrsSharedPtrMessage::SrsSharedPtrPayload::SrsSharedPtrPayload()
SrsSharedPtrMessage::SrsSharedPtrPayload::~SrsSharedPtrPayload() SrsSharedPtrMessage::SrsSharedPtrPayload::~SrsSharedPtrPayload()
{ {
#ifdef SRS_AUTO_MEM_WATCH #ifdef SRS_MEM_WATCH
srs_memory_unwatch(payload); srs_memory_unwatch(payload);
#endif #endif
srs_freepa(payload); srs_freepa(payload);
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
srs_freepa(samples); srs_freepa(samples);
for (int i = 0; i < nn_extra_payloads; i++) { for (int i = 0; i < nn_extra_payloads; i++) {
@ -376,7 +376,7 @@ SrsSharedPtrMessage* SrsSharedPtrMessage::copy()
return copy; return copy;
} }
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
void SrsSharedPtrMessage::set_extra_payloads(SrsSample* payloads, int nn_payloads) void SrsSharedPtrMessage::set_extra_payloads(SrsSample* payloads, int nn_payloads)
{ {
srs_assert(nn_payloads); srs_assert(nn_payloads);

View file

@ -302,7 +302,7 @@ private:
int size; int size;
// The reference count // The reference count
int shared_count; int shared_count;
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
public: public:
// For RTC video, we need to know the NALU structures, // For RTC video, we need to know the NALU structures,
// because the RTP STAP-A or FU-A based on NALU. // because the RTP STAP-A or FU-A based on NALU.
@ -361,7 +361,7 @@ public:
// @remark, assert object is created. // @remark, assert object is created.
virtual SrsSharedPtrMessage* copy(); virtual SrsSharedPtrMessage* copy();
public: public:
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
// Set extra samples, for example, when we transcode an AAC audio packet to OPUS, // Set extra samples, for example, when we transcode an AAC audio packet to OPUS,
// we may get more than one OPUS packets, we set these OPUS packets in extra payloads. // we may get more than one OPUS packets, we set these OPUS packets in extra payloads.
void set_extra_payloads(SrsSample* payloads, int nn_payloads); void set_extra_payloads(SrsSample* payloads, int nn_payloads);

View file

@ -129,15 +129,15 @@ extern ISrsThreadContext* _srs_context;
#endif #endif
// TODO: FIXME: Add more verbose and info logs. // TODO: FIXME: Add more verbose and info logs.
#ifndef SRS_AUTO_VERBOSE #ifndef SRS_VERBOSE
#undef srs_verbose #undef srs_verbose
#define srs_verbose(msg, ...) (void)0 #define srs_verbose(msg, ...) (void)0
#endif #endif
#ifndef SRS_AUTO_INFO #ifndef SRS_INFO
#undef srs_info #undef srs_info
#define srs_info(msg, ...) (void)0 #define srs_info(msg, ...) (void)0
#endif #endif
#ifndef SRS_AUTO_TRACE #ifndef SRS_TRACE
#undef srs_trace #undef srs_trace
#define srs_trace(msg, ...) (void)0 #define srs_trace(msg, ...) (void)0
#endif #endif

View file

@ -124,7 +124,7 @@ srs_utime_t srs_get_system_startup_time()
} }
// For utest to mock it. // For utest to mock it.
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
_srs_gettimeofday_t _srs_gettimeofday = ::gettimeofday; _srs_gettimeofday_t _srs_gettimeofday = ::gettimeofday;
#endif #endif

View file

@ -166,7 +166,7 @@ extern int srs_chunk_header_c3(int perfer_cid, uint32_t timestamp, char* cache,
// For utest to mock it. // For utest to mock it.
#include <sys/time.h> #include <sys/time.h>
#ifdef SRS_AUTO_OSX #ifdef SRS_OSX
#define _srs_gettimeofday gettimeofday #define _srs_gettimeofday gettimeofday
#else #else
typedef int (*_srs_gettimeofday_t) (struct timeval* tv, struct timezone* tz); typedef int (*_srs_gettimeofday_t) (struct timeval* tv, struct timezone* tz);

View file

@ -63,8 +63,8 @@ int main(int argc, char** argv)
srs_assert(srs_is_little_endian()); srs_assert(srs_is_little_endian());
// directly failed when compile limited. // directly failed when compile limited.
#if defined(SRS_AUTO_GPERF_MP) || defined(SRS_AUTO_GPERF_MP) \ #if defined(SRS_GPERF_MP) || defined(SRS_GPERF_MP) \
|| defined(SRS_AUTO_GPERF_MC) || defined(SRS_AUTO_GPERF_MP) || defined(SRS_GPERF_MC) || defined(SRS_GPERF_MP)
srs_error("donot support gmc/gmp/gcp/gprof"); srs_error("donot support gmc/gmp/gcp/gprof");
exit(-1); exit(-1);
#endif #endif

View file

@ -30,14 +30,14 @@
#include <sstream> #include <sstream>
using namespace std; using namespace std;
#ifdef SRS_AUTO_GPERF_MP #ifdef SRS_GPERF_MP
#include <gperftools/heap-profiler.h> #include <gperftools/heap-profiler.h>
#endif #endif
#ifdef SRS_AUTO_GPERF_CP #ifdef SRS_GPERF_CP
#include <gperftools/profiler.h> #include <gperftools/profiler.h>
#endif #endif
#ifdef SRS_AUTO_GPERF #ifdef SRS_GPERF
#include <gperftools/malloc_extension.h> #include <gperftools/malloc_extension.h>
#endif #endif
@ -54,11 +54,11 @@ using namespace std;
#include <srs_core_autofree.hpp> #include <srs_core_autofree.hpp>
#include <srs_kernel_file.hpp> #include <srs_kernel_file.hpp>
#include <srs_app_hybrid.hpp> #include <srs_app_hybrid.hpp>
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
#include <srs_app_rtc_conn.hpp> #include <srs_app_rtc_conn.hpp>
#endif #endif
#ifdef SRS_AUTO_SRT #ifdef SRS_SRT
#include <srt_server.hpp> #include <srt_server.hpp>
#endif #endif
@ -88,15 +88,15 @@ srs_error_t do_main(int argc, char** argv)
// for gperf gmp or gcp, // for gperf gmp or gcp,
// should never enable it when not enabled for performance issue. // should never enable it when not enabled for performance issue.
#ifdef SRS_AUTO_GPERF_MP #ifdef SRS_GPERF_MP
HeapProfilerStart("gperf.srs.gmp"); HeapProfilerStart("gperf.srs.gmp");
#endif #endif
#ifdef SRS_AUTO_GPERF_CP #ifdef SRS_GPERF_CP
ProfilerStart("gperf.srs.gcp"); ProfilerStart("gperf.srs.gcp");
#endif #endif
// directly compile error when these two macro defines. // directly compile error when these two macro defines.
#if defined(SRS_AUTO_GPERF_MC) && defined(SRS_AUTO_GPERF_MP) #if defined(SRS_GPERF_MC) && defined(SRS_GPERF_MP)
#error ("option --with-gmc confict with --with-gmp, " #error ("option --with-gmc confict with --with-gmp, "
"@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\n" "@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\n"
"Note that since the heap-checker uses the heap-profiling framework internally, " "Note that since the heap-checker uses the heap-profiling framework internally, "
@ -104,7 +104,7 @@ srs_error_t do_main(int argc, char** argv)
#endif #endif
// never use gmp to check memory leak. // never use gmp to check memory leak.
#ifdef SRS_AUTO_GPERF_MP #ifdef SRS_GPERF_MP
#warning "gmp is not used for memory leak, please use gmc instead." #warning "gmp is not used for memory leak, please use gmc instead."
#endif #endif
@ -132,12 +132,12 @@ srs_error_t do_main(int argc, char** argv)
// config already applied to log. // config already applied to log.
srs_trace("%s, %s", RTMP_SIG_SRS_SERVER, RTMP_SIG_SRS_LICENSE); srs_trace("%s, %s", RTMP_SIG_SRS_SERVER, RTMP_SIG_SRS_LICENSE);
srs_trace("authors: %s", RTMP_SIG_SRS_AUTHORS); srs_trace("authors: %s", RTMP_SIG_SRS_AUTHORS);
srs_trace("contributors: %s", SRS_AUTO_CONSTRIBUTORS); srs_trace("contributors: %s", SRS_CONSTRIBUTORS);
srs_trace("cwd=%s, work_dir=%s, build: %s, configure: %s, uname: %s, osx: %d", srs_trace("cwd=%s, work_dir=%s, build: %s, configure: %s, uname: %s, osx: %d",
_srs_config->cwd().c_str(), cwd.c_str(), SRS_AUTO_BUILD_DATE, SRS_AUTO_USER_CONFIGURE, SRS_AUTO_UNAME, SRS_AUTO_OSX_BOOL); _srs_config->cwd().c_str(), cwd.c_str(), SRS_BUILD_DATE, SRS_USER_CONFIGURE, SRS_UNAME, SRS_OSX_BOOL);
srs_trace("configure detail: " SRS_AUTO_CONFIGURE); srs_trace("configure detail: " SRS_CONFIGURE);
#ifdef SRS_AUTO_EMBEDED_TOOL_CHAIN #ifdef SRS_EMBEDED_TOOL_CHAIN
srs_trace("crossbuild tool chain: " SRS_AUTO_EMBEDED_TOOL_CHAIN); srs_trace("crossbuild tool chain: " SRS_EMBEDED_TOOL_CHAIN);
#endif #endif
// for memory check or detect. // for memory check or detect.
@ -157,7 +157,7 @@ srs_error_t do_main(int argc, char** argv)
ss << "glic mem-check env MALLOC_CHECK_ " << mcov << "=>" << mcnv << ", LIBC_FATAL_STDERR_ " << lfsov << "=>" << lfsnv << "."; ss << "glic mem-check env MALLOC_CHECK_ " << mcov << "=>" << mcnv << ", LIBC_FATAL_STDERR_ " << lfsov << "=>" << lfsnv << ".";
#endif #endif
#ifdef SRS_AUTO_GPERF_MC #ifdef SRS_GPERF_MC
string hcov = srs_getenv("HEAPCHECK"); string hcov = srs_getenv("HEAPCHECK");
if (hcov.empty()) { if (hcov.empty()) {
string cpath = _srs_config->config(); string cpath = _srs_config->config();
@ -167,7 +167,7 @@ srs_error_t do_main(int argc, char** argv)
} }
#endif #endif
#ifdef SRS_AUTO_GPERF_MD #ifdef SRS_GPERF_MD
char* TCMALLOC_PAGE_FENCE = getenv("TCMALLOC_PAGE_FENCE"); char* TCMALLOC_PAGE_FENCE = getenv("TCMALLOC_PAGE_FENCE");
if (!TCMALLOC_PAGE_FENCE || strcmp(TCMALLOC_PAGE_FENCE, "1")) { if (!TCMALLOC_PAGE_FENCE || strcmp(TCMALLOC_PAGE_FENCE, "1")) {
srs_warn("gmd enabled without env TCMALLOC_PAGE_FENCE=1"); srs_warn("gmd enabled without env TCMALLOC_PAGE_FENCE=1");
@ -190,7 +190,7 @@ srs_error_t do_main(int argc, char** argv)
// features // features
show_macro_features(); show_macro_features();
#ifdef SRS_AUTO_GPERF #ifdef SRS_GPERF
// For tcmalloc, use slower release rate. // For tcmalloc, use slower release rate.
if (true) { if (true) {
double trr = _srs_config->tcmalloc_release_rate(); double trr = _srs_config->tcmalloc_release_rate();
@ -233,8 +233,8 @@ void show_macro_features()
ss << ", rch:" << srs_bool2switch(true); ss << ", rch:" << srs_bool2switch(true);
ss << ", dash:" << "on"; ss << ", dash:" << "on";
ss << ", hls:" << srs_bool2switch(true); ss << ", hls:" << srs_bool2switch(true);
ss << ", hds:" << srs_bool2switch(SRS_AUTO_HDS_BOOL); ss << ", hds:" << srs_bool2switch(SRS_HDS_BOOL);
ss << ", srt:" << srs_bool2switch(SRS_AUTO_SRT_BOOL); ss << ", srt:" << srs_bool2switch(SRS_SRT_BOOL);
// hc(http callback) // hc(http callback)
ss << ", hc:" << srs_bool2switch(true); ss << ", hc:" << srs_bool2switch(true);
// ha(http api) // ha(http api)
@ -272,7 +272,7 @@ void show_macro_features()
#if defined(__aarch64__) #if defined(__aarch64__)
ss << " aarch64"; ss << " aarch64";
#endif #endif
#if defined(SRS_AUTO_CROSSBUILD) #if defined(SRS_CROSSBUILD)
ss << "(crossbuild)"; ss << "(crossbuild)";
#endif #endif
@ -345,7 +345,7 @@ void show_macro_features()
srs_trace("system default latency(ms): mw(0-%d) + mr(0-%d) + play-queue(0-%d)", srs_trace("system default latency(ms): mw(0-%d) + mr(0-%d) + play-queue(0-%d)",
srsu2msi(SRS_PERF_MW_SLEEP), possible_mr_latency, srsu2msi(SRS_PERF_PLAY_QUEUE)); srsu2msi(SRS_PERF_MW_SLEEP), possible_mr_latency, srsu2msi(SRS_PERF_PLAY_QUEUE));
#ifdef SRS_AUTO_MEM_WATCH #ifdef SRS_MEM_WATCH
#warning "srs memory watcher will hurts performance. user should kill by SIGTERM or init.d script." #warning "srs memory watcher will hurts performance. user should kill by SIGTERM or init.d script."
srs_warn("srs memory watcher will hurts performance. user should kill by SIGTERM or init.d script."); srs_warn("srs memory watcher will hurts performance. user should kill by SIGTERM or init.d script.");
#endif #endif
@ -461,11 +461,11 @@ srs_error_t run_hybrid_server()
// Create servers and register them. // Create servers and register them.
_srs_hybrid->register_server(new SrsServerAdapter()); _srs_hybrid->register_server(new SrsServerAdapter());
#ifdef SRS_AUTO_SRT #ifdef SRS_SRT
_srs_hybrid->register_server(new SrtServerAdapter()); _srs_hybrid->register_server(new SrtServerAdapter());
#endif #endif
#ifdef SRS_AUTO_RTC #ifdef SRS_RTC
_srs_hybrid->register_server(new RtcServerAdapter()); _srs_hybrid->register_server(new RtcServerAdapter());
#endif #endif

View file

@ -115,7 +115,7 @@ srs_error_t srs_fd_reuseport(int fd)
#if defined(SO_REUSEPORT) #if defined(SO_REUSEPORT)
int v = 1; int v = 1;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &v, sizeof(int)) == -1) { if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &v, sizeof(int)) == -1) {
#ifdef SRS_AUTO_CROSSBUILD #ifdef SRS_CROSSBUILD
srs_warn("SO_REUSEPORT disabled for crossbuild"); srs_warn("SO_REUSEPORT disabled for crossbuild");
return srs_success; return srs_success;
#else #else
@ -414,7 +414,7 @@ int srs_sendmsg(srs_netfd_t stfd, const struct msghdr *msg, int flags, srs_utime
int srs_sendmmsg(srs_netfd_t stfd, struct mmsghdr *msgvec, unsigned int vlen, int flags, srs_utime_t timeout) int srs_sendmmsg(srs_netfd_t stfd, struct mmsghdr *msgvec, unsigned int vlen, int flags, srs_utime_t timeout)
{ {
#if !defined(SRS_AUTO_HAS_SENDMMSG) || !defined(SRS_AUTO_SENDMMSG) #if !defined(SRS_HAS_SENDMMSG) || !defined(SRS_SENDMMSG)
// @see http://man7.org/linux/man-pages/man2/sendmmsg.2.html // @see http://man7.org/linux/man-pages/man2/sendmmsg.2.html
for (int i = 0; i < (int)vlen; ++i) { for (int i = 0; i < (int)vlen; ++i) {
struct mmsghdr* p = msgvec + i; struct mmsghdr* p = msgvec + i;

View file

@ -92,7 +92,7 @@ extern int srs_sendto(srs_netfd_t stfd, void *buf, int len, const struct sockadd
extern int srs_recvmsg(srs_netfd_t stfd, struct msghdr *msg, int flags, srs_utime_t timeout); extern int srs_recvmsg(srs_netfd_t stfd, struct msghdr *msg, int flags, srs_utime_t timeout);
extern int srs_sendmsg(srs_netfd_t stfd, const struct msghdr *msg, int flags, srs_utime_t timeout); extern int srs_sendmsg(srs_netfd_t stfd, const struct msghdr *msg, int flags, srs_utime_t timeout);
#if !defined(SRS_AUTO_HAS_SENDMMSG) #if !defined(SRS_HAS_SENDMMSG)
// @see http://man7.org/linux/man-pages/man2/sendmmsg.2.html // @see http://man7.org/linux/man-pages/man2/sendmmsg.2.html
#include <sys/socket.h> #include <sys/socket.h>
struct mmsghdr { struct mmsghdr {
@ -110,7 +110,7 @@ extern bool srs_is_never_timeout(srs_utime_t tm);
// The mutex locker. // The mutex locker.
#define SrsLocker(instance) \ #define SrsLocker(instance) \
impl__SrsLocker _srs_auto_free_##instance(&instance) impl__SrsLocker _SRS_free_##instance(&instance)
class impl__SrsLocker class impl__SrsLocker
{ {

View file

@ -41,25 +41,25 @@ VOID TEST(CoreAutoFreeTest, Free)
VOID TEST(CoreMacroseTest, Check) VOID TEST(CoreMacroseTest, Check)
{ {
#ifndef SRS_AUTO_BUILD_TS #ifndef SRS_BUILD_TS
EXPECT_TRUE(false); EXPECT_TRUE(false);
#endif #endif
#ifndef SRS_AUTO_BUILD_DATE #ifndef SRS_BUILD_DATE
EXPECT_TRUE(false); EXPECT_TRUE(false);
#endif #endif
#ifndef SRS_AUTO_UNAME #ifndef SRS_UNAME
EXPECT_TRUE(false); EXPECT_TRUE(false);
#endif #endif
#ifndef SRS_AUTO_USER_CONFIGURE #ifndef SRS_USER_CONFIGURE
EXPECT_TRUE(false); EXPECT_TRUE(false);
#endif #endif
#ifndef SRS_AUTO_CONFIGURE #ifndef SRS_CONFIGURE
EXPECT_TRUE(false); EXPECT_TRUE(false);
#endif #endif
#ifndef SRS_AUTO_PREFIX #ifndef SRS_PREFIX
EXPECT_TRUE(false); EXPECT_TRUE(false);
#endif #endif
#ifndef SRS_AUTO_CONSTRIBUTORS #ifndef SRS_CONSTRIBUTORS
EXPECT_TRUE(false); EXPECT_TRUE(false);
#endif #endif
} }

View file

@ -3843,7 +3843,7 @@ VOID TEST(KernelFileWriterTest, WriteSpecialCase)
off_t seeked = 0; off_t seeked = 0;
HELPER_EXPECT_SUCCESS(f.lseek(0, SEEK_CUR, &seeked)); HELPER_EXPECT_SUCCESS(f.lseek(0, SEEK_CUR, &seeked));
#ifdef SRS_AUTO_OSX #ifdef SRS_OSX
EXPECT_EQ(10, seeked); EXPECT_EQ(10, seeked);
#else #else
EXPECT_EQ(0, seeked); EXPECT_EQ(0, seeked);
@ -4212,7 +4212,7 @@ VOID TEST(KernelUtilityTest, CoverBitsBufferAll)
} }
} }
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
extern _srs_gettimeofday_t _srs_gettimeofday; extern _srs_gettimeofday_t _srs_gettimeofday;
int mock_gettimeofday(struct timeval* /*tp*/, struct timezone* /*tzp*/) { int mock_gettimeofday(struct timeval* /*tp*/, struct timezone* /*tzp*/) {
return -1; return -1;

View file

@ -124,7 +124,7 @@ VOID TEST(TCPServerTest, PingPong)
SrsStSocket skt; SrsStSocket skt;
srs_usleep(100 * SRS_UTIME_MILLISECONDS); srs_usleep(100 * SRS_UTIME_MILLISECONDS);
#ifdef SRS_AUTO_OSX #ifdef SRS_OSX
ASSERT_TRUE(h.fd != NULL); ASSERT_TRUE(h.fd != NULL);
#endif #endif
HELPER_EXPECT_SUCCESS(skt.initialize(h.fd)); HELPER_EXPECT_SUCCESS(skt.initialize(h.fd));
@ -146,7 +146,7 @@ VOID TEST(TCPServerTest, PingPong)
SrsStSocket skt; SrsStSocket skt;
srs_usleep(100 * SRS_UTIME_MILLISECONDS); srs_usleep(100 * SRS_UTIME_MILLISECONDS);
#ifdef SRS_AUTO_OSX #ifdef SRS_OSX
ASSERT_TRUE(h.fd != NULL); ASSERT_TRUE(h.fd != NULL);
#endif #endif
HELPER_EXPECT_SUCCESS(skt.initialize(h.fd)); HELPER_EXPECT_SUCCESS(skt.initialize(h.fd));
@ -170,7 +170,7 @@ VOID TEST(TCPServerTest, PingPong)
SrsStSocket skt; SrsStSocket skt;
srs_usleep(100 * SRS_UTIME_MILLISECONDS); srs_usleep(100 * SRS_UTIME_MILLISECONDS);
#ifdef SRS_AUTO_OSX #ifdef SRS_OSX
ASSERT_TRUE(h.fd != NULL); ASSERT_TRUE(h.fd != NULL);
#endif #endif
HELPER_EXPECT_SUCCESS(skt.initialize(h.fd)); HELPER_EXPECT_SUCCESS(skt.initialize(h.fd));
@ -205,7 +205,7 @@ VOID TEST(TCPServerTest, PingPongWithTimeout)
SrsStSocket skt; SrsStSocket skt;
srs_usleep(100 * SRS_UTIME_MILLISECONDS); srs_usleep(100 * SRS_UTIME_MILLISECONDS);
#ifdef SRS_AUTO_OSX #ifdef SRS_OSX
ASSERT_TRUE(h.fd != NULL); ASSERT_TRUE(h.fd != NULL);
#endif #endif
HELPER_EXPECT_SUCCESS(skt.initialize(h.fd)); HELPER_EXPECT_SUCCESS(skt.initialize(h.fd));
@ -227,7 +227,7 @@ VOID TEST(TCPServerTest, PingPongWithTimeout)
SrsStSocket skt; SrsStSocket skt;
srs_usleep(100 * SRS_UTIME_MILLISECONDS); srs_usleep(100 * SRS_UTIME_MILLISECONDS);
#ifdef SRS_AUTO_OSX #ifdef SRS_OSX
ASSERT_TRUE(h.fd != NULL); ASSERT_TRUE(h.fd != NULL);
#endif #endif
HELPER_EXPECT_SUCCESS(skt.initialize(h.fd)); HELPER_EXPECT_SUCCESS(skt.initialize(h.fd));
@ -249,7 +249,7 @@ VOID TEST(TCPServerTest, PingPongWithTimeout)
SrsStSocket skt; SrsStSocket skt;
srs_usleep(100 * SRS_UTIME_MILLISECONDS); srs_usleep(100 * SRS_UTIME_MILLISECONDS);
#ifdef SRS_AUTO_OSX #ifdef SRS_OSX
ASSERT_TRUE(h.fd != NULL); ASSERT_TRUE(h.fd != NULL);
#endif #endif
HELPER_EXPECT_SUCCESS(skt.initialize(h.fd)); HELPER_EXPECT_SUCCESS(skt.initialize(h.fd));
@ -382,7 +382,7 @@ VOID TEST(TCPServerTest, StringIsHex)
char* str = (char*)"!1234567890"; char* str = (char*)"!1234567890";
char* parsed = str; errno = 0; char* parsed = str; errno = 0;
EXPECT_EQ(0x0, ::strtol(str, &parsed, 16)); EXPECT_EQ(0x0, ::strtol(str, &parsed, 16));
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
EXPECT_EQ(0, errno); EXPECT_EQ(0, errno);
#endif #endif
EXPECT_EQ(str, parsed); EXPECT_EQ(str, parsed);
@ -400,7 +400,7 @@ VOID TEST(TCPServerTest, StringIsHex)
char* str = (char*)""; char* str = (char*)"";
char* parsed = str; errno = 0; char* parsed = str; errno = 0;
EXPECT_EQ(0x0, ::strtol(str, &parsed, 16)); EXPECT_EQ(0x0, ::strtol(str, &parsed, 16));
#ifndef SRS_AUTO_OSX #ifndef SRS_OSX
EXPECT_EQ(0, errno); EXPECT_EQ(0, errno);
#endif #endif
EXPECT_EQ(str, parsed); EXPECT_EQ(str, parsed);
@ -429,7 +429,7 @@ VOID TEST(TCPServerTest, WritevIOVC)
SrsStSocket skt; SrsStSocket skt;
srs_usleep(100 * SRS_UTIME_MILLISECONDS); srs_usleep(100 * SRS_UTIME_MILLISECONDS);
#ifdef SRS_AUTO_OSX #ifdef SRS_OSX
ASSERT_TRUE(h.fd != NULL); ASSERT_TRUE(h.fd != NULL);
#endif #endif
HELPER_EXPECT_SUCCESS(skt.initialize(h.fd)); HELPER_EXPECT_SUCCESS(skt.initialize(h.fd));
@ -459,7 +459,7 @@ VOID TEST(TCPServerTest, WritevIOVC)
SrsStSocket skt; SrsStSocket skt;
srs_usleep(100 * SRS_UTIME_MILLISECONDS); srs_usleep(100 * SRS_UTIME_MILLISECONDS);
#ifdef SRS_AUTO_OSX #ifdef SRS_OSX
ASSERT_TRUE(h.fd != NULL); ASSERT_TRUE(h.fd != NULL);
#endif #endif
HELPER_EXPECT_SUCCESS(skt.initialize(h.fd)); HELPER_EXPECT_SUCCESS(skt.initialize(h.fd));