From f2f30dcc528654079a0ea56dd46d199344912921 Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 10 Apr 2014 14:12:22 +0800 Subject: [PATCH] add utility, change log to trace --- trunk/configure | 2 +- trunk/src/app/srs_app_utility.cpp | 24 +++++++++++++++++++++ trunk/src/app/srs_app_utility.hpp | 33 +++++++++++++++++++++++++++++ trunk/src/kernel/srs_kernel_log.hpp | 4 ++-- trunk/src/main/srs_main_server.cpp | 26 ++++++++++++----------- trunk/src/srs/srs.upp | 6 ++++-- 6 files changed, 78 insertions(+), 17 deletions(-) create mode 100644 trunk/src/app/srs_app_utility.cpp create mode 100644 trunk/src/app/srs_app_utility.hpp diff --git a/trunk/configure b/trunk/configure index 720ae4728..df1709d5b 100755 --- a/trunk/configure +++ b/trunk/configure @@ -436,7 +436,7 @@ MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_socke "srs_app_http" "srs_app_thread" "srs_app_bandwidth" "srs_app_st" "srs_app_log" "srs_app_config" "srs_app_pithy_print" "srs_app_reload" "srs_app_http_api" "srs_app_http_conn" "srs_app_http_hooks" "srs_app_json" "srs_app_ingest" - "srs_app_ffmpeg") + "srs_app_ffmpeg" "srs_app_utility") APP_INCS="src/app"; MODULE_DIR=${APP_INCS} . auto/modules.sh APP_OBJS="${MODULE_OBJS[@]}" # diff --git a/trunk/src/app/srs_app_utility.cpp b/trunk/src/app/srs_app_utility.cpp new file mode 100644 index 000000000..faba0f788 --- /dev/null +++ b/trunk/src/app/srs_app_utility.cpp @@ -0,0 +1,24 @@ +/* +The MIT License (MIT) + +Copyright (c) 2013-2014 winlin + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include diff --git a/trunk/src/app/srs_app_utility.hpp b/trunk/src/app/srs_app_utility.hpp new file mode 100644 index 000000000..990a52673 --- /dev/null +++ b/trunk/src/app/srs_app_utility.hpp @@ -0,0 +1,33 @@ +/* +The MIT License (MIT) + +Copyright (c) 2013-2014 winlin + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef SRS_APP_UTILITY_HPP +#define SRS_APP_UTILITY_HPP + +/* +#include +*/ + +#include + +#endif diff --git a/trunk/src/kernel/srs_kernel_log.hpp b/trunk/src/kernel/srs_kernel_log.hpp index 65d7cf19b..7574c25ba 100644 --- a/trunk/src/kernel/srs_kernel_log.hpp +++ b/trunk/src/kernel/srs_kernel_log.hpp @@ -131,11 +131,11 @@ extern ISrsThreadContext* _srs_context; #define srs_error(msg, ...) _srs_log->error(__PRETTY_FUNCTION__, _srs_context->get_id(), msg, ##__VA_ARGS__) #endif -#if 0 +#if 1 #undef srs_verbose #define srs_verbose(msg, ...) (void)0 #endif -#if 0 +#if 1 #undef srs_info #define srs_info(msg, ...) (void)0 #endif diff --git a/trunk/src/main/srs_main_server.cpp b/trunk/src/main/srs_main_server.cpp index 2888c3ace..6c0960541 100644 --- a/trunk/src/main/srs_main_server.cpp +++ b/trunk/src/main/srs_main_server.cpp @@ -21,18 +21,7 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include -#include -#include -#include - -// kernel module. -ISrsLog* _srs_log = new SrsFastLog(); -ISrsThreadContext* _srs_context = new SrsThreadContext(); -// app module. -SrsConfig* _srs_config = new SrsConfig(); -SrsServer* _srs_server = new SrsServer(); +#include #include #include @@ -47,6 +36,19 @@ SrsServer* _srs_server = new SrsServer(); #include #endif +#include +#include +#include +#include +#include + +// kernel module. +ISrsLog* _srs_log = new SrsFastLog(); +ISrsThreadContext* _srs_context = new SrsThreadContext(); +// app module. +SrsConfig* _srs_config = new SrsConfig(); +SrsServer* _srs_server = new SrsServer(); + void handler(int signo) { srs_trace("get a signal, signo=%d", signo); diff --git a/trunk/src/srs/srs.upp b/trunk/src/srs/srs.upp index 5ac43944f..d582fe6ed 100755 --- a/trunk/src/srs/srs.upp +++ b/trunk/src/srs/srs.upp @@ -77,8 +77,6 @@ file ..\app\srs_app_rtmp_conn.cpp, ..\app\srs_app_pithy_print.hpp, ..\app\srs_app_pithy_print.cpp, - ..\app\srs_app_thread.hpp, - ..\app\srs_app_thread.cpp, ..\app\srs_app_server.hpp, ..\app\srs_app_server.cpp, ..\app\srs_app_st.hpp, @@ -87,6 +85,10 @@ file ..\app\srs_app_socket.cpp, ..\app\srs_app_source.hpp, ..\app\srs_app_source.cpp, + ..\app\srs_app_thread.hpp, + ..\app\srs_app_thread.cpp, + ..\app\srs_app_utility.hpp, + ..\app\srs_app_utility.cpp, utest readonly separator, ..\utest\srs_utest.hpp, ..\utest\srs_utest.cpp,