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 "" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_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_AUTO_UNAME \"`uname -a`\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_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_BUILD_TS \"`date +%s`\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_BUILD_DATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_UNAME \"`uname -a`\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_USER_CONFIGURE \"${SRS_AUTO_USER_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_CONFIGURE \"${SRS_AUTO_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H
echo "" >> $SRS_AUTO_HEADERS_H
function srs_define_macro()
@ -62,73 +62,73 @@ echo "" >> $SRS_AUTO_HEADERS_H
#####################################################################################
# auto headers in depends.
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
srs_undefine_macro "SRS_AUTO_HDS" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_HDS" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_SRT" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_SRT" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_RTC" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_RTC" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_GB28181" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_GB28181" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_MEM_WATCH" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_MEM_WATCH" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_UTEST" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_UTEST" $SRS_AUTO_HEADERS_H
fi
# whatever the FFMPEG tools, if transcode and ingest specified,
# srs always compile the FFMPEG tool stub which used to start the FFMPEG process.
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
srs_undefine_macro "SRS_AUTO_FFMPEG_STUB" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_FFMPEG_STUB" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_GPERF" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_GPERF" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_GPERF_MC" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_GPERF_MC" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_GPERF_MD" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_GPERF_MD" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_GPERF_MP" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_GPERF_MP" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_GPERF_CP" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_GPERF_CP" $SRS_AUTO_HEADERS_H
fi
#####################################################################################
@ -136,50 +136,50 @@ fi
#####################################################################################
# for log level compile settings
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
srs_undefine_macro "SRS_AUTO_VERBOSE" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_VERBOSE" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_INFO" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_INFO" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_TRACE" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_TRACE" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_CROSSBUILD" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_CROSSBUILD" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_OSX" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_OSX" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_SENDMMSG" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_SENDMMSG" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_HAS_SENDMMSG" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_HAS_SENDMMSG" $SRS_AUTO_HEADERS_H
fi
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
srs_undefine_macro "SRS_AUTO_DEBUG" $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_DEBUG" $SRS_AUTO_HEADERS_H
fi
# prefix
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
@ -188,13 +188,13 @@ echo "" >> $SRS_AUTO_HEADERS_H
#####################################################################################
if [[ -f ../AUTHORS.txt ]]; then
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
echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H
done
echo "\"" >> $SRS_AUTO_HEADERS_H
else
echo "#define SRS_AUTO_CONSTRIBUTORS \"ossrs\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_CONSTRIBUTORS \"ossrs\"" >> $SRS_AUTO_HEADERS_H
fi
# 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()
{
#if !defined(SRS_AUTO_HAS_SENDMMSG) || !defined(SRS_AUTO_SENDMMSG)
#if !defined(SRS_HAS_SENDMMSG) || !defined(SRS_SENDMMSG)
return 1;
#else
static int DEFAULT = 256;

View file

@ -45,7 +45,7 @@ using namespace std;
#include <srs_core_autofree.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_NO_VIDEO "vn"

View file

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

View file

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

View file

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

View file

@ -55,7 +55,7 @@ using namespace std;
// drop the segment when duration of ts too small.
// 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.
#define SRS_HLS_FLOOR_REAP_PERCENT 0.3
@ -498,7 +498,7 @@ bool SrsHlsMuxer::is_segment_overflow()
srs_assert(current);
// 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;
}
@ -518,7 +518,7 @@ bool SrsHlsMuxer::is_segment_absolutely_overflow()
srs_assert(current);
// 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;
}
@ -619,7 +619,7 @@ srs_error_t SrsHlsMuxer::do_segment_close()
// when too small, it maybe not enough data to play.
// when too large, it maybe timestamp corrupt.
// 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;
if (matchMinDuration && matchMaxDuration) {
// 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_utility.hpp>
#include <srs_app_coworkers.hpp>
#ifdef SRS_AUTO_RTC
#ifdef SRS_RTC
#include <srs_app_rtc_conn.hpp>
#endif
@ -556,7 +556,7 @@ srs_error_t SrsGoApiAuthors::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa
obj->set("data", data);
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());
}
@ -582,17 +582,17 @@ srs_error_t SrsGoApiFeatures::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
SrsJsonObject* data = SrsJsonAny::object();
obj->set("data", data);
data->set("options", SrsJsonAny::str(SRS_AUTO_USER_CONFIGURE));
data->set("options2", SrsJsonAny::str(SRS_AUTO_CONFIGURE));
data->set("build", SrsJsonAny::str(SRS_AUTO_BUILD_DATE));
data->set("build2", SrsJsonAny::str(SRS_AUTO_BUILD_TS));
data->set("options", SrsJsonAny::str(SRS_USER_CONFIGURE));
data->set("options2", SrsJsonAny::str(SRS_CONFIGURE));
data->set("build", SrsJsonAny::str(SRS_BUILD_DATE));
data->set("build2", SrsJsonAny::str(SRS_BUILD_TS));
SrsJsonObject* features = SrsJsonAny::object();
data->set("features", features);
features->set("ssl", SrsJsonAny::boolean(true));
features->set("hls", SrsJsonAny::boolean(true));
#ifdef SRS_AUTO_HDS
#ifdef SRS_HDS
features->set("hds", SrsJsonAny::boolean(true));
#else
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());
}
#ifdef SRS_AUTO_RTC
#ifdef SRS_RTC
uint32_t SrsGoApiRtcPlay::ssrc_num = 0;
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);
}
#ifdef SRS_AUTO_GB28181
#ifdef SRS_GB28181
SrsGoApiGb28181::SrsGoApiGb28181()
{
}
@ -2228,7 +2228,7 @@ srs_error_t SrsGoApiGb28181::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMe
}
#endif
#ifdef SRS_AUTO_GPERF
#ifdef SRS_GPERF
#include <gperftools/malloc_extension.h>
SrsGoApiTcmalloc::SrsGoApiTcmalloc()

View file

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

View file

@ -194,7 +194,7 @@ void SrsIngester::fast_kill()
// when error, ingester sleep for a while and retry.
// 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()
{
@ -212,7 +212,7 @@ srs_error_t SrsIngester::cycle()
srs_freep(err);
}
srs_usleep(SRS_AUTO_INGESTER_CIMS);
srs_usleep(SRS_INGESTER_CIMS);
}
return err;

View file

@ -890,7 +890,7 @@ srs_error_t SrsRtcSenderThread::send_messages(
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 (packets.use_gso) {
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_controllen = 0;
#ifndef SRS_AUTO_OSX
#ifndef SRS_OSX
if (using_gso) {
mhdr->msg_hdr.msg_controllen = CMSG_SPACE(sizeof(uint16_t));
if (!mhdr->msg_hdr.msg_control) {
@ -2273,7 +2273,7 @@ srs_error_t SrsRtcSession::on_stun(SrsUdpMuxSocket* skt, SrsStunPacket* stun_req
return err;
}
#ifdef SRS_AUTO_OSX
#ifdef SRS_OSX
// These functions are similar to the older byteorder(3) family of functions.
// For example, be32toh() is identical to ntohl().
// @see https://linux.die.net/man/3/be32toh

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -33,11 +33,6 @@
// The macros generated by configure script.
#include <srs_auto_headers.hpp>
// 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
@ -68,7 +63,7 @@
#endif
// 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
#endif

View file

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

View file

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

View file

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

View file

@ -302,7 +302,7 @@ private:
int size;
// The reference count
int shared_count;
#ifdef SRS_AUTO_RTC
#ifdef SRS_RTC
public:
// For RTC video, we need to know the NALU structures,
// because the RTP STAP-A or FU-A based on NALU.
@ -361,7 +361,7 @@ public:
// @remark, assert object is created.
virtual SrsSharedPtrMessage* copy();
public:
#ifdef SRS_AUTO_RTC
#ifdef SRS_RTC
// 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.
void set_extra_payloads(SrsSample* payloads, int nn_payloads);

View file

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

View file

@ -124,7 +124,7 @@ srs_utime_t srs_get_system_startup_time()
}
// For utest to mock it.
#ifndef SRS_AUTO_OSX
#ifndef SRS_OSX
_srs_gettimeofday_t _srs_gettimeofday = ::gettimeofday;
#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.
#include <sys/time.h>
#ifdef SRS_AUTO_OSX
#ifdef SRS_OSX
#define _srs_gettimeofday gettimeofday
#else
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());
// directly failed when compile limited.
#if defined(SRS_AUTO_GPERF_MP) || defined(SRS_AUTO_GPERF_MP) \
|| defined(SRS_AUTO_GPERF_MC) || defined(SRS_AUTO_GPERF_MP)
#if defined(SRS_GPERF_MP) || defined(SRS_GPERF_MP) \
|| defined(SRS_GPERF_MC) || defined(SRS_GPERF_MP)
srs_error("donot support gmc/gmp/gcp/gprof");
exit(-1);
#endif

View file

@ -30,14 +30,14 @@
#include <sstream>
using namespace std;
#ifdef SRS_AUTO_GPERF_MP
#ifdef SRS_GPERF_MP
#include <gperftools/heap-profiler.h>
#endif
#ifdef SRS_AUTO_GPERF_CP
#ifdef SRS_GPERF_CP
#include <gperftools/profiler.h>
#endif
#ifdef SRS_AUTO_GPERF
#ifdef SRS_GPERF
#include <gperftools/malloc_extension.h>
#endif
@ -54,11 +54,11 @@ using namespace std;
#include <srs_core_autofree.hpp>
#include <srs_kernel_file.hpp>
#include <srs_app_hybrid.hpp>
#ifdef SRS_AUTO_RTC
#ifdef SRS_RTC
#include <srs_app_rtc_conn.hpp>
#endif
#ifdef SRS_AUTO_SRT
#ifdef SRS_SRT
#include <srt_server.hpp>
#endif
@ -88,15 +88,15 @@ srs_error_t do_main(int argc, char** argv)
// for gperf gmp or gcp,
// should never enable it when not enabled for performance issue.
#ifdef SRS_AUTO_GPERF_MP
#ifdef SRS_GPERF_MP
HeapProfilerStart("gperf.srs.gmp");
#endif
#ifdef SRS_AUTO_GPERF_CP
#ifdef SRS_GPERF_CP
ProfilerStart("gperf.srs.gcp");
#endif
// 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, "
"@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, "
@ -104,7 +104,7 @@ srs_error_t do_main(int argc, char** argv)
#endif
// 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."
#endif
@ -132,12 +132,12 @@ srs_error_t do_main(int argc, char** argv)
// config already applied to log.
srs_trace("%s, %s", RTMP_SIG_SRS_SERVER, RTMP_SIG_SRS_LICENSE);
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_config->cwd().c_str(), cwd.c_str(), SRS_AUTO_BUILD_DATE, SRS_AUTO_USER_CONFIGURE, SRS_AUTO_UNAME, SRS_AUTO_OSX_BOOL);
srs_trace("configure detail: " SRS_AUTO_CONFIGURE);
#ifdef SRS_AUTO_EMBEDED_TOOL_CHAIN
srs_trace("crossbuild tool chain: " SRS_AUTO_EMBEDED_TOOL_CHAIN);
_srs_config->cwd().c_str(), cwd.c_str(), SRS_BUILD_DATE, SRS_USER_CONFIGURE, SRS_UNAME, SRS_OSX_BOOL);
srs_trace("configure detail: " SRS_CONFIGURE);
#ifdef SRS_EMBEDED_TOOL_CHAIN
srs_trace("crossbuild tool chain: " SRS_EMBEDED_TOOL_CHAIN);
#endif
// 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 << ".";
#endif
#ifdef SRS_AUTO_GPERF_MC
#ifdef SRS_GPERF_MC
string hcov = srs_getenv("HEAPCHECK");
if (hcov.empty()) {
string cpath = _srs_config->config();
@ -167,7 +167,7 @@ srs_error_t do_main(int argc, char** argv)
}
#endif
#ifdef SRS_AUTO_GPERF_MD
#ifdef SRS_GPERF_MD
char* TCMALLOC_PAGE_FENCE = getenv("TCMALLOC_PAGE_FENCE");
if (!TCMALLOC_PAGE_FENCE || strcmp(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
show_macro_features();
#ifdef SRS_AUTO_GPERF
#ifdef SRS_GPERF
// For tcmalloc, use slower release rate.
if (true) {
double trr = _srs_config->tcmalloc_release_rate();
@ -233,8 +233,8 @@ void show_macro_features()
ss << ", rch:" << srs_bool2switch(true);
ss << ", dash:" << "on";
ss << ", hls:" << srs_bool2switch(true);
ss << ", hds:" << srs_bool2switch(SRS_AUTO_HDS_BOOL);
ss << ", srt:" << srs_bool2switch(SRS_AUTO_SRT_BOOL);
ss << ", hds:" << srs_bool2switch(SRS_HDS_BOOL);
ss << ", srt:" << srs_bool2switch(SRS_SRT_BOOL);
// hc(http callback)
ss << ", hc:" << srs_bool2switch(true);
// ha(http api)
@ -272,7 +272,7 @@ void show_macro_features()
#if defined(__aarch64__)
ss << " aarch64";
#endif
#if defined(SRS_AUTO_CROSSBUILD)
#if defined(SRS_CROSSBUILD)
ss << "(crossbuild)";
#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)",
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."
srs_warn("srs memory watcher will hurts performance. user should kill by SIGTERM or init.d script.");
#endif
@ -461,11 +461,11 @@ srs_error_t run_hybrid_server()
// Create servers and register them.
_srs_hybrid->register_server(new SrsServerAdapter());
#ifdef SRS_AUTO_SRT
#ifdef SRS_SRT
_srs_hybrid->register_server(new SrtServerAdapter());
#endif
#ifdef SRS_AUTO_RTC
#ifdef SRS_RTC
_srs_hybrid->register_server(new RtcServerAdapter());
#endif

View file

@ -115,7 +115,7 @@ srs_error_t srs_fd_reuseport(int fd)
#if defined(SO_REUSEPORT)
int v = 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");
return srs_success;
#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)
{
#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
for (int i = 0; i < (int)vlen; ++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_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
#include <sys/socket.h>
struct mmsghdr {
@ -110,7 +110,7 @@ extern bool srs_is_never_timeout(srs_utime_t tm);
// The mutex locker.
#define SrsLocker(instance) \
impl__SrsLocker _srs_auto_free_##instance(&instance)
impl__SrsLocker _SRS_free_##instance(&instance)
class impl__SrsLocker
{

View file

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

View file

@ -3843,7 +3843,7 @@ VOID TEST(KernelFileWriterTest, WriteSpecialCase)
off_t seeked = 0;
HELPER_EXPECT_SUCCESS(f.lseek(0, SEEK_CUR, &seeked));
#ifdef SRS_AUTO_OSX
#ifdef SRS_OSX
EXPECT_EQ(10, seeked);
#else
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;
int mock_gettimeofday(struct timeval* /*tp*/, struct timezone* /*tzp*/) {
return -1;

View file

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