1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +00:00

refine the startup logs.

This commit is contained in:
winlin 2015-09-24 12:15:12 +08:00
parent 3ab0ccaa27
commit f187a7deef
10 changed files with 273 additions and 243 deletions

147
trunk/auto/auto_headers.sh Normal file → Executable file
View file

@ -18,24 +18,45 @@ echo "#define SRS_AUTO_USER_CONFIGURE \"${SRS_AUTO_USER_CONFIGURE}\"" >> $SRS_AU
echo "#define SRS_AUTO_CONFIGURE \"${SRS_AUTO_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H
echo "" >> $SRS_AUTO_HEADERS_H
function srs_define_macro()
{
macro=$1 && file=$2
echo "#define $macro" >> $file
echo "#define ${macro}_BOOL true" >> $file
}
function srs_define_macro_value()
{
macro=$1 && value=$2 && file=$3
echo "#define $macro $value" >> $file
echo "#define ${macro}_BOOL true" >> $file
}
function srs_undefine_macro()
{
macro=$1 && file=$2
echo "#undef $macro" >> $file
echo "#define ${macro}_BOOL false" >> $file
}
# export the preset.
if [ $SRS_OSX = YES ]; then
echo "#define SRS_OSX" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_OSX" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_X86_X64 = YES ]; then
echo "#define SRS_X86_X64" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_X86_X64" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_ARM_UBUNTU12 = YES ]; then
echo "#define SRS_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_ARM_UBUNTU12" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_MIPS_UBUNTU12 = YES ]; then
echo "#define SRS_MIPS_UBUNTU12" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_MIPS_UBUNTU12" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_PI = YES ]; then
echo "#define SRS_PI" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_PI" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_CUBIE = YES ]; then
echo "#define SRS_CUBIE" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_CUBIE" $SRS_AUTO_HEADERS_H
fi
echo "" >> $SRS_AUTO_HEADERS_H
@ -45,180 +66,180 @@ echo "" >> $SRS_AUTO_HEADERS_H
#####################################################################################
# write to source file
if [ $SRS_CROSS_BUILD = YES ]; then
echo "cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB"
echo "#define SRS_AUTO_EMBEDED_TOOL_CHAIN \"cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB\"" >> $SRS_AUTO_HEADERS_H
__TOOL_CHAIN="cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB" && echo "$__TOOL_CHAIN"
srs_define_macro_value "SRS_AUTO_EMBEDED_TOOL_CHAIN" "\"$__TOOL_CHAIN\"" $SRS_AUTO_HEADERS_H
else
echo "#define SRS_AUTO_EMBEDED_TOOL_CHAIN \"normal x86/x64 gcc\"" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_EMBEDED_TOOL_CHAIN" $SRS_AUTO_HEADERS_H
fi
echo "" >> $SRS_AUTO_HEADERS_H
# auto headers in depends.
if [ $SRS_HTTP_CORE = YES ]; then
echo "#define SRS_AUTO_HTTP_CORE" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_HTTP_CORE" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_HTTP_CORE" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_HTTP_CORE" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_HTTP_SERVER = YES ]; then
echo "#define SRS_AUTO_HTTP_SERVER" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_HTTP_SERVER" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_HTTP_SERVER" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_HTTP_SERVER" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_STREAM_CASTER = YES ]; then
echo "#define SRS_AUTO_STREAM_CASTER" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_STREAM_CASTER" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_STREAM_CASTER" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_STREAM_CASTER" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_KAFKA = YES ]; then
echo "#define SRS_AUTO_KAFKA" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_KAFKA" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_KAFKA" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_KAFKA" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_HTTP_API = YES ]; then
echo "#define SRS_AUTO_HTTP_API" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_HTTP_API" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_HTTP_API" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_HTTP_API" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_NGINX = YES ]; then
echo "#define SRS_AUTO_NGINX" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_NGINX" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_NGINX" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_NGINX" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_DVR = YES ]; then
echo "#define SRS_AUTO_DVR" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_DVR" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_DVR" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_DVR" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_HLS = YES ]; then
echo "#define SRS_AUTO_HLS" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_HLS" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_HLS" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_HLS" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_HDS = YES ]; then
echo "#define SRS_AUTO_HDS" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_HDS" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_HDS" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_HDS" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_HTTP_CALLBACK = YES ]; then
echo "#define SRS_AUTO_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_HTTP_CALLBACK" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_HTTP_CALLBACK" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_SSL = YES ]; then
echo "#define SRS_AUTO_SSL" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_SSL" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_SSL" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_SSL" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_MEM_WATCH = YES ]; then
echo "#define SRS_AUTO_MEM_WATCH" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_MEM_WATCH" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_MEM_WATCH" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_MEM_WATCH" $SRS_AUTO_HEADERS_H
fi
# whether compile ffmpeg tool
if [ $SRS_FFMPEG_TOOL = YES ]; then
echo "#define SRS_AUTO_FFMPEG_TOOL" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_FFMPEG_TOOL" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_FFMPEG_TOOL" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_FFMPEG_TOOL" $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
echo "#define SRS_AUTO_FFMPEG_STUB" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_FFMPEG_STUB" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_FFMPEG_STUB" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_FFMPEG_STUB" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_TRANSCODE = YES ]; then
echo "#define SRS_AUTO_TRANSCODE" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_TRANSCODE" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_TRANSCODE" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_TRANSCODE" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_INGEST = YES ]; then
echo "#define SRS_AUTO_INGEST" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_INGEST" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_INGEST" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_INGEST" $SRS_AUTO_HEADERS_H
fi
# for statistic.
if [ $SRS_STAT = YES ]; then
echo "#define SRS_AUTO_STAT" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_STAT" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_STAT" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_STAT" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_GPERF = YES ]; then
echo "#define SRS_AUTO_GPERF" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_GPERF" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_GPERF" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_GPERF" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_GPERF_MC = YES ]; then
echo "#define SRS_AUTO_GPERF_MC" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_GPERF_MC" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_GPERF_MC" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_GPERF_MC" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_GPERF_MP = YES ]; then
echo "#define SRS_AUTO_GPERF_MP" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_GPERF_MP" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_GPERF_MP" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_GPERF_MP" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_GPERF_CP = YES ]; then
echo "#define SRS_AUTO_GPERF_CP" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_GPERF_CP" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_GPERF_CP" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_GPERF_CP" $SRS_AUTO_HEADERS_H
fi
#####################################################################################
# for embeded.
#####################################################################################
if [ $SRS_CROSS_BUILD = YES ]; then
echo "#define SRS_AUTO_EMBEDED_CPU" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_EMBEDED_CPU" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_EMBEDED_CPU" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_EMBEDED_CPU" $SRS_AUTO_HEADERS_H
fi
# arm
if [ $SRS_ARM_UBUNTU12 = YES ]; then
echo "#define SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_ARM_UBUNTU12" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_ARM_UBUNTU12" $SRS_AUTO_HEADERS_H
fi
# mips
if [ $SRS_MIPS_UBUNTU12 = YES ]; then
echo "#define SRS_AUTO_MIPS_UBUNTU12" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_MIPS_UBUNTU12" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_MIPS_UBUNTU12" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_MIPS_UBUNTU12" $SRS_AUTO_HEADERS_H
fi
echo "" >> $SRS_AUTO_HEADERS_H
# for log level compile settings
if [ $SRS_LOG_VERBOSE = YES ]; then
echo "#define SRS_AUTO_VERBOSE" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_VERBOSE" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_VERBOSE" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_VERBOSE" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_LOG_INFO = YES ]; then
echo "#define SRS_AUTO_INFO" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_INFO" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_INFO" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_INFO" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_LOG_TRACE = YES ]; then
echo "#define SRS_AUTO_TRACE" >> $SRS_AUTO_HEADERS_H
srs_define_macro "SRS_AUTO_TRACE" $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_TRACE" >> $SRS_AUTO_HEADERS_H
srs_undefine_macro "SRS_AUTO_TRACE" $SRS_AUTO_HEADERS_H
fi
# prefix

View file

@ -44,7 +44,13 @@ int SrsKafkaProducer::initialize()
{
int ret = ERROR_SUCCESS;
srs_trace("initialize kafka producer ok.");
// when kafka enabled, request metadata when startup.
if (_srs_config->get_kafka_enabled() && (ret = request_metadata()) != ERROR_SUCCESS) {
srs_error("request kafka metadata failed. ret=%d", ret);
return ret;
}
srs_info("initialize kafka producer ok.");
return ret;
}
@ -58,7 +64,7 @@ int SrsKafkaProducer::start()
return ret;
}
srs_trace("start kafka async worker ok.");
srs_trace("kafka worker ok, enabled:%d", _srs_config->get_kafka_enabled());
return ret;
}
@ -68,5 +74,14 @@ void SrsKafkaProducer::stop()
worker->stop();
}
int SrsKafkaProducer::request_metadata()
{
int ret = ERROR_SUCCESS;
srs_info("update kafka metadata ok");
return ret;
}
#endif

View file

@ -47,6 +47,8 @@ public:
virtual int initialize();
virtual int start();
virtual void stop();
private:
virtual int request_metadata();
};
#endif

View file

@ -440,7 +440,8 @@ int SrsSignalManager::start()
sa.sa_flags = 0;
sigaction(SRS_SIGNAL_PERSISTENCE_CONFIG, &sa, NULL);
srs_trace("signal installed");
srs_trace("signal installed, reload=%d, dispose=%d, persistence=%d, grace_quit=%d",
SRS_SIGNAL_RELOAD, SRS_SIGNAL_DISPOSE, SRS_SIGNAL_PERSISTENCE_CONFIG, SRS_SIGNAL_GRACEFULLY_QUIT);
return pthread->start();
}

View file

@ -443,7 +443,7 @@ int srs_st_init()
srs_error("st_set_eventsys use %s failed. ret=%d", st_get_eventsys_name(), ret);
return ret;
}
srs_trace("st_set_eventsys to %s", st_get_eventsys_name());
srs_info("st_set_eventsys to %s", st_get_eventsys_name());
if(st_init() != 0){
ret = ERROR_ST_INITIALIZE;

View file

@ -230,6 +230,10 @@ void srs_parse_endpoint(string ip_port, string& ip, int& port)
port = ::atoi(the_port.c_str());
}
string srs_bool2switch(bool v) {
return v? "on" : "off";
}
int srs_kill_forced(int& pid)
{
int ret = ERROR_SUCCESS;
@ -490,7 +494,7 @@ void srs_update_proc_stat()
static int user_hz = 0;
if (user_hz <= 0) {
user_hz = (int)sysconf(_SC_CLK_TCK);
srs_trace("USER_HZ=%d", user_hz);
srs_info("USER_HZ=%d", user_hz);
srs_assert(user_hz > 0);
}
@ -1234,6 +1238,12 @@ void retrieve_local_ipv4_ips()
return;
}
stringstream ss0;
ss0 << "ips";
stringstream ss1;
ss1 << "devices";
ifaddrs* p = ifap;
while (p != NULL) {
ifaddrs* cur = p;
@ -1257,20 +1267,23 @@ void retrieve_local_ipv4_ips()
std::string ip = buf;
if (ip != SRS_CONSTS_LOCALHOST) {
srs_trace("retrieve local ipv4 ip=%s, index=%d", ip.c_str(), (int)ips.size());
ss0 << ", local[" << (int)ips.size() << "] ipv4 " << ip;
ips.push_back(ip);
}
// set the device internet status.
if (!srs_net_device_is_internet(inaddr->s_addr)) {
srs_trace("detect intranet address: %s, ifname=%s", ip.c_str(), cur->ifa_name);
ss1 << ", intranet ";
_srs_device_ifs[cur->ifa_name] = false;
} else {
srs_trace("detect internet address: %s, ifname=%s", ip.c_str(), cur->ifa_name);
ss1 << ", internet ";
_srs_device_ifs[cur->ifa_name] = true;
}
ss1 << cur->ifa_name << " " << ip;
}
}
srs_trace(ss0.str().c_str());
srs_trace(ss1.str().c_str());
freeifaddrs(ifap);
}

View file

@ -82,6 +82,11 @@ extern std::string srs_path_build_timestamp(std::string template_path);
extern void srs_parse_endpoint(std::string ip_port, std::string& ip, std::string& port);
extern void srs_parse_endpoint(std::string ip_port, std::string& ip, int& port);
/**
* convert bool to switch value, true to "on", false to "off".
*/
extern std::string srs_bool2switch(bool v);
/**
* kill the pid by SIGINT, then wait to quit,
* kill the pid by SIGKILL again when exceed the timeout.

View file

@ -27,6 +27,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <sys/types.h>
#include <sys/wait.h>
#include <sstream>
using namespace std;
#ifdef SRS_AUTO_GPERF_MP
#include <gperftools/heap-profiler.h>
#endif
@ -40,6 +43,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_log.hpp>
#include <srs_kernel_utility.hpp>
#include <srs_core_performance.hpp>
#include <srs_app_utility.hpp>
// pre-declare
int run();
@ -60,185 +64,161 @@ SrsServer* _srs_server = new SrsServer();
*/
void show_macro_features()
{
#ifdef SRS_AUTO_SSL
srs_trace("check feature rtmp handshake: on");
#else
srs_warn("check feature rtmp handshake: off");
#endif
#ifdef SRS_AUTO_HLS
srs_trace("check feature hls: on");
#else
srs_warn("check feature hls: off");
#endif
#ifdef SRS_AUTO_HDS
srs_trace("check feature hds: on");
#else
srs_warn("check feature hds: off");
#endif
#ifdef SRS_AUTO_HTTP_CALLBACK
srs_trace("check feature http callback: on");
#else
srs_warn("check feature http callback: off");
#endif
#ifdef SRS_AUTO_HTTP_API
srs_trace("check feature http api: on");
#else
srs_warn("check feature http api: off");
#endif
#ifdef SRS_AUTO_HTTP_SERVER
srs_trace("check feature http server: on");
#else
srs_warn("check feature http server: off");
#endif
#ifdef SRS_AUTO_HTTP_CORE
srs_trace("check feature http parser: on");
#else
srs_warn("check feature http parser: off");
#endif
#ifdef SRS_AUTO_DVR
srs_trace("check feature dvr: on");
#else
srs_warn("check feature dvr: off");
#endif
#ifdef SRS_AUTO_TRANSCODE
srs_trace("check feature transcode: on");
#else
srs_warn("check feature transcode: off");
#endif
#ifdef SRS_AUTO_INGEST
srs_trace("check feature ingest: on");
#else
srs_warn("check feature ingest: off");
#endif
#ifdef SRS_AUTO_STAT
srs_trace("check feature system stat: on");
#else
srs_warn("check feature system stat: off");
#endif
#ifdef SRS_AUTO_NGINX
srs_trace("check feature compile nginx: on");
#else
srs_warn("check feature compile nginx: off");
#endif
#ifdef SRS_AUTO_FFMPEG_TOOL
srs_trace("check feature compile ffmpeg: on");
#else
srs_warn("check feature compile ffmpeg: off");
#endif
#ifdef SRS_AUTO_STREAM_CASTER
srs_trace("stream caster: on");
#else
srs_warn("stream caster: off");
#endif
#ifdef SRS_PERF_MERGED_READ
srs_trace("MR(merged-read): on, @see %s", RTMP_SIG_SRS_ISSUES(241));
#else
srs_warn("MR(merged-read): off, @see %s", RTMP_SIG_SRS_ISSUES(241));
#endif
srs_trace("MR(merged-read) default %d sleep %d", SRS_PERF_MR_ENABLED, SRS_PERF_MR_SLEEP);
srs_trace("MW(merged-write) default sleep %d", SRS_PERF_MW_SLEEP);
srs_trace("read chunk stream cache cid [0, %d)", SRS_PERF_CHUNK_STREAM_CACHE);
srs_trace("default gop cache %d, play queue %ds", SRS_PERF_GOP_CACHE, SRS_PERF_PLAY_QUEUE);
if (true) {
stringstream ss;
ss << "features";
// rch(rtmp complex handshake)
ss << ", rch:" << srs_bool2switch(SRS_AUTO_SSL_BOOL);
ss << ", hls:" << srs_bool2switch(SRS_AUTO_HLS_BOOL);
ss << ", hds:" << srs_bool2switch(SRS_AUTO_HDS_BOOL);
// hc(http callback)
ss << ", hc:" << srs_bool2switch(SRS_AUTO_HTTP_CALLBACK_BOOL);
// ha(http api)
ss << ", ha:" << srs_bool2switch(SRS_AUTO_HTTP_API_BOOL);
// hs(http server)
ss << ", hs:" << srs_bool2switch(SRS_AUTO_HTTP_SERVER_BOOL);
// hp(http parser)
ss << ", hp:" << srs_bool2switch(SRS_AUTO_HTTP_CORE_BOOL);
ss << ", dvr:" << srs_bool2switch(SRS_AUTO_DVR_BOOL);
// trans(transcode)
ss << ", trans:" << srs_bool2switch(SRS_AUTO_TRANSCODE_BOOL);
// inge(ingest)
ss << ", inge:" << srs_bool2switch(SRS_AUTO_INGEST_BOOL);
ss << ", kafka:" << srs_bool2switch(SRS_AUTO_KAFKA_BOOL);
ss << ", stat:" << srs_bool2switch(SRS_AUTO_STAT_BOOL);
ss << ", nginx:" << srs_bool2switch(SRS_AUTO_NGINX_BOOL);
// ff(ffmpeg)
ss << ", ff:" << srs_bool2switch(SRS_AUTO_FFMPEG_TOOL_BOOL);
// sc(stream-caster)
ss << ", sc:" << srs_bool2switch(SRS_AUTO_STREAM_CASTER_BOOL);
srs_trace(ss.str().c_str());
}
if (true) {
stringstream ss;
ss << "SRS on ";
#ifdef SRS_OSX
ss << "OSX";
#endif
#ifdef SRS_PI
ss << "RespberryPi";
#endif
#ifdef SRS_CUBIE
ss << "CubieBoard";
#endif
#ifdef SRS_ARM_UBUNTU12
ss << "ARM(build on ubuntu)";
#endif
#ifdef SRS_MIPS_UBUNTU12
ss << "MIPS(build on ubuntu)";
#endif
#if defined(__amd64__)
ss << " amd64";
#endif
#if defined(__x86_64__)
ss << " x86_64";
#endif
#if defined(__i386__)
ss << " i386";
#endif
#if defined(__arm__)
ss << "arm";
#endif
#ifndef SRS_OSX
ss << ", glibc" << (int)__GLIBC__ << "." (int)__GLIBC_MINOR__;
#endif
ss << ", conf:" << _srs_config->config() << ", limit:" << _srs_config->get_max_connections()
<< ", writev:" << sysconf(_SC_IOV_MAX) << ", encoding:" << (srs_is_little_endian()? "little-endian":"big-endian")
<< ", HZ:" << (int)sysconf(_SC_CLK_TCK);
srs_trace(ss.str().c_str());
}
if (true) {
stringstream ss;
// mw(merged-write)
ss << "mw sleep:" << SRS_PERF_MW_SLEEP << "ms";
// mr(merged-read)
ss << ". mr ";
#ifdef SRS_PERF_MERGED_READ
ss << "enabled:on";
#else
ss << "enabled:off";
#endif
ss << ", default:" << SRS_PERF_MR_ENABLED << ", sleep:" << SRS_PERF_MR_SLEEP << "ms";
ss << ", @see " << RTMP_SIG_SRS_ISSUES(241);
srs_trace(ss.str().c_str());
}
if (true) {
stringstream ss;
// gc(gop-cache)
ss << "gc:" << srs_bool2switch(SRS_PERF_GOP_CACHE);
// pq(play-queue)
ss << ", pq:" << SRS_PERF_PLAY_QUEUE << "s";
// cscc(chunk stream cache cid)
ss << ", cscc:[0," << SRS_PERF_CHUNK_STREAM_CACHE << ")";
// csa(complex send algorithm)
ss << ", csa:";
#ifndef SRS_PERF_COMPLEX_SEND
srs_warn("complex send algorithm disabled.");
ss << "off";
#else
srs_trace("complex send algorithm enabled.");
ss << "on";
#endif
// tn(TCP_NODELAY)
ss << ", tn:";
#ifdef SRS_PERF_TCP_NODELAY
srs_warn("TCP_NODELAY enabled, may hurts performance.");
ss << "on(may hurts performance)";
#else
srs_trace("TCP_NODELAY disabled.");
ss << "off";
#endif
// ss(SO_SENDBUF)
ss << ", ss:";
#ifdef SRS_PERF_SO_SNDBUF_SIZE
srs_warn("socket send buffer size %d", SRS_PERF_SO_SNDBUF_SIZE);
ss << SRS_PERF_SO_SNDBUF_SIZE;
#else
srs_trace("auto guess socket send buffer by merged write");
ss << "auto(guess by merged write)";
#endif
srs_trace(ss.str().c_str());
}
// others
int possible_mr_latency = 0;
#ifdef SRS_PERF_MERGED_READ
possible_mr_latency = SRS_PERF_MR_SLEEP;
#endif
srs_trace("system default latency in ms: mw(0-%d) + mr(0-%d) + play-queue(0-%d)",
SRS_PERF_MW_SLEEP, possible_mr_latency, SRS_PERF_PLAY_QUEUE*1000);
}
void check_macro_features()
{
// important preset.
#ifdef SRS_OSX
srs_trace("SRS for OSX");
#endif
#ifdef SRS_PI
srs_trace("SRS for pi");
#endif
#ifdef SRS_CUBIE
srs_trace("SRS for cubieboard");
#endif
#ifdef SRS_ARM_UBUNTU12
srs_trace("SRS for arm(build on ubuntu)");
#endif
#ifdef SRS_MIPS_UBUNTU12
srs_trace("SRS for mips(build on ubuntu)");
#endif
// for special features.
#ifndef SRS_PERF_MERGED_READ
srs_warn("MR(merged-read) is disabled, hurts read performance. @see %s", RTMP_SIG_SRS_ISSUES(241));
#endif
srs_trace("writev limits write %d iovs a time", sysconf(_SC_IOV_MAX));
#if VERSION_MAJOR > VERSION_STABLE
#warning "current branch is not stable, please use stable branch instead."
srs_warn("SRS %s is not stable, please use stable branch %s instead", RTMP_SIG_SRS_VERSION, VERSION_STABLE_BRANCH);
#endif
SRS_PERF_MW_SLEEP, possible_mr_latency, SRS_PERF_PLAY_QUEUE*1000);
#ifdef SRS_AUTO_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
#if defined(SRS_AUTO_STREAM_CASTER)
#warning "stream caster is experiment feature."
srs_warn("stream caster is experiment feature.");
#endif
#if defined(SRS_PERF_SO_SNDBUF_SIZE) && !defined(SRS_PERF_MW_SO_SNDBUF)
#error "SRS_PERF_SO_SNDBUF_SIZE depends on SRS_PERF_MW_SO_SNDBUF"
#if VERSION_MAJOR > VERSION_STABLE
#warning "current branch is not stable, please use stable branch instead."
srs_warn("SRS %s is not stable, please use stable branch %s instead", RTMP_SIG_SRS_VERSION, VERSION_STABLE_BRANCH);
#endif
#ifndef SRS_OSX
#if defined(__amd64__)
srs_trace("cpu is amd64, glibc %d.%d", (int)__GLIBC__, (int)__GLIBC_MINOR__);
#endif
#if defined(__x86_64__)
srs_trace("cpu is x86_64, glibc %d.%d", (int)__GLIBC__, (int)__GLIBC_MINOR__);
#endif
#if defined(__i386__)
srs_trace("cpu is i386, glibc %d.%d", (int)__GLIBC__, (int)__GLIBC_MINOR__);
#endif
#if defined(__arm__)
srs_trace("cpu is arm, glibc %d.%d", (int)__GLIBC__, (int)__GLIBC_MINOR__);
#endif
#if defined(SRS_PERF_SO_SNDBUF_SIZE) && !defined(SRS_PERF_MW_SO_SNDBUF)
#error "SRS_PERF_SO_SNDBUF_SIZE depends on SRS_PERF_MW_SO_SNDBUF"
#endif
}
@ -284,28 +264,24 @@ int main(int argc, char** argv)
if ((ret = _srs_log->initialize()) != ERROR_SUCCESS) {
return ret;
}
// config already applied to log.
srs_trace("srs(simple-rtmp-server) "RTMP_SIG_SRS_VERSION", stable is "RTMP_SIG_SRS_PRIMARY);
srs_trace("license: "RTMP_SIG_SRS_LICENSE", "RTMP_SIG_SRS_COPYRIGHT);
srs_trace("authors: "RTMP_SIG_SRS_AUTHROS);
srs_trace("contributors: "SRS_AUTO_CONSTRIBUTORS);
srs_trace("build: %s, configure:%s, uname: %s", SRS_AUTO_BUILD_DATE, SRS_AUTO_USER_CONFIGURE, SRS_AUTO_UNAME);
srs_trace("configure detail: "SRS_AUTO_CONFIGURE);
#ifdef SRS_AUTO_EMBEDED_TOOL_CHAIN
srs_trace("crossbuild tool chain: "SRS_AUTO_EMBEDED_TOOL_CHAIN);
#endif
// we check the config when the log initialized.
if ((ret = _srs_config->check_config()) != ERROR_SUCCESS) {
return ret;
}
srs_trace("srs(simple-rtmp-server) "RTMP_SIG_SRS_VERSION);
srs_trace("license: "RTMP_SIG_SRS_LICENSE", "RTMP_SIG_SRS_COPYRIGHT);
srs_trace("primary/master: "RTMP_SIG_SRS_PRIMARY);
srs_trace("authors: "RTMP_SIG_SRS_AUTHROS);
srs_trace("contributors: "SRS_AUTO_CONSTRIBUTORS);
srs_trace("uname: "SRS_AUTO_UNAME);
srs_trace("build: %s, %s", SRS_AUTO_BUILD_DATE, srs_is_little_endian()? "little-endian":"big-endian");
srs_trace("configure: "SRS_AUTO_USER_CONFIGURE);
srs_trace("features: "SRS_AUTO_CONFIGURE);
#ifdef SRS_AUTO_ARM_UBUNTU12
srs_trace("arm tool chain: "SRS_AUTO_EMBEDED_TOOL_CHAIN);
#endif
srs_trace("conf: %s, limit: %d", _srs_config->config().c_str(), _srs_config->get_max_connections());
// features
check_macro_features();
show_macro_features();
/**

View file

@ -41,7 +41,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| IBufferReader | | IStatistic | | IBufferWriter |
+---------------+ +--------------------+ +---------------+
| + read() | | + get_recv_bytes() | | + write() |
+------+--------+ | + get_recv_bytes() | | + writev() |
+------+--------+ | + get_send_bytes() | | + writev() |
/ \ +---+--------------+-+ +-------+-------+
| / \ / \ / \
| | | |

View file

@ -58,9 +58,6 @@ VOID TEST(CoreMacroseTest, Check)
#ifndef SRS_AUTO_CONFIGURE
EXPECT_TRUE(false);
#endif
#ifndef SRS_AUTO_EMBEDED_TOOL_CHAIN
EXPECT_TRUE(false);
#endif
#ifndef SRS_AUTO_PREFIX
EXPECT_TRUE(false);
#endif