winlin

add utility, change log to trace

@@ -436,7 +436,7 @@ MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_socke @@ -436,7 +436,7 @@ MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_socke
436 "srs_app_http" "srs_app_thread" "srs_app_bandwidth" "srs_app_st" "srs_app_log" 436 "srs_app_http" "srs_app_thread" "srs_app_bandwidth" "srs_app_st" "srs_app_log"
437 "srs_app_config" "srs_app_pithy_print" "srs_app_reload" "srs_app_http_api" 437 "srs_app_config" "srs_app_pithy_print" "srs_app_reload" "srs_app_http_api"
438 "srs_app_http_conn" "srs_app_http_hooks" "srs_app_json" "srs_app_ingest" 438 "srs_app_http_conn" "srs_app_http_hooks" "srs_app_json" "srs_app_ingest"
439 - "srs_app_ffmpeg") 439 + "srs_app_ffmpeg" "srs_app_utility")
440 APP_INCS="src/app"; MODULE_DIR=${APP_INCS} . auto/modules.sh 440 APP_INCS="src/app"; MODULE_DIR=${APP_INCS} . auto/modules.sh
441 APP_OBJS="${MODULE_OBJS[@]}" 441 APP_OBJS="${MODULE_OBJS[@]}"
442 # 442 #
  1 +/*
  2 +The MIT License (MIT)
  3 +
  4 +Copyright (c) 2013-2014 winlin
  5 +
  6 +Permission is hereby granted, free of charge, to any person obtaining a copy of
  7 +this software and associated documentation files (the "Software"), to deal in
  8 +the Software without restriction, including without limitation the rights to
  9 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  10 +the Software, and to permit persons to whom the Software is furnished to do so,
  11 +subject to the following conditions:
  12 +
  13 +The above copyright notice and this permission notice shall be included in all
  14 +copies or substantial portions of the Software.
  15 +
  16 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18 +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19 +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20 +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21 +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22 +*/
  23 +
  24 +#include <srs_app_utility.hpp>
  1 +/*
  2 +The MIT License (MIT)
  3 +
  4 +Copyright (c) 2013-2014 winlin
  5 +
  6 +Permission is hereby granted, free of charge, to any person obtaining a copy of
  7 +this software and associated documentation files (the "Software"), to deal in
  8 +the Software without restriction, including without limitation the rights to
  9 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  10 +the Software, and to permit persons to whom the Software is furnished to do so,
  11 +subject to the following conditions:
  12 +
  13 +The above copyright notice and this permission notice shall be included in all
  14 +copies or substantial portions of the Software.
  15 +
  16 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18 +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19 +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20 +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21 +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22 +*/
  23 +
  24 +#ifndef SRS_APP_UTILITY_HPP
  25 +#define SRS_APP_UTILITY_HPP
  26 +
  27 +/*
  28 +#include <srs_app_utility.hpp>
  29 +*/
  30 +
  31 +#include <srs_core.hpp>
  32 +
  33 +#endif
@@ -131,11 +131,11 @@ extern ISrsThreadContext* _srs_context; @@ -131,11 +131,11 @@ extern ISrsThreadContext* _srs_context;
131 #define srs_error(msg, ...) _srs_log->error(__PRETTY_FUNCTION__, _srs_context->get_id(), msg, ##__VA_ARGS__) 131 #define srs_error(msg, ...) _srs_log->error(__PRETTY_FUNCTION__, _srs_context->get_id(), msg, ##__VA_ARGS__)
132 #endif 132 #endif
133 133
134 -#if 0 134 +#if 1
135 #undef srs_verbose 135 #undef srs_verbose
136 #define srs_verbose(msg, ...) (void)0 136 #define srs_verbose(msg, ...) (void)0
137 #endif 137 #endif
138 -#if 0 138 +#if 1
139 #undef srs_info 139 #undef srs_info
140 #define srs_info(msg, ...) (void)0 140 #define srs_info(msg, ...) (void)0
141 #endif 141 #endif
@@ -21,18 +21,7 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN @@ -21,18 +21,7 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */ 22 */
23 23
24 -#include <srs_kernel_log.hpp>  
25 -#include <srs_kernel_error.hpp>  
26 -#include <srs_app_server.hpp>  
27 -#include <srs_app_config.hpp>  
28 -#include <srs_app_log.hpp>  
29 -  
30 -// kernel module.  
31 -ISrsLog* _srs_log = new SrsFastLog();  
32 -ISrsThreadContext* _srs_context = new SrsThreadContext();  
33 -// app module.  
34 -SrsConfig* _srs_config = new SrsConfig();  
35 -SrsServer* _srs_server = new SrsServer(); 24 +#include <srs_core.hpp>
36 25
37 #include <stdlib.h> 26 #include <stdlib.h>
38 #include <signal.h> 27 #include <signal.h>
@@ -47,6 +36,19 @@ SrsServer* _srs_server = new SrsServer(); @@ -47,6 +36,19 @@ SrsServer* _srs_server = new SrsServer();
47 #include <gperftools/profiler.h> 36 #include <gperftools/profiler.h>
48 #endif 37 #endif
49 38
  39 +#include <srs_kernel_error.hpp>
  40 +#include <srs_app_server.hpp>
  41 +#include <srs_app_config.hpp>
  42 +#include <srs_app_log.hpp>
  43 +#include <srs_app_utility.hpp>
  44 +
  45 +// kernel module.
  46 +ISrsLog* _srs_log = new SrsFastLog();
  47 +ISrsThreadContext* _srs_context = new SrsThreadContext();
  48 +// app module.
  49 +SrsConfig* _srs_config = new SrsConfig();
  50 +SrsServer* _srs_server = new SrsServer();
  51 +
50 void handler(int signo) 52 void handler(int signo)
51 { 53 {
52 srs_trace("get a signal, signo=%d", signo); 54 srs_trace("get a signal, signo=%d", signo);
@@ -77,8 +77,6 @@ file @@ -77,8 +77,6 @@ file
77 ..\app\srs_app_rtmp_conn.cpp, 77 ..\app\srs_app_rtmp_conn.cpp,
78 ..\app\srs_app_pithy_print.hpp, 78 ..\app\srs_app_pithy_print.hpp,
79 ..\app\srs_app_pithy_print.cpp, 79 ..\app\srs_app_pithy_print.cpp,
80 - ..\app\srs_app_thread.hpp,  
81 - ..\app\srs_app_thread.cpp,  
82 ..\app\srs_app_server.hpp, 80 ..\app\srs_app_server.hpp,
83 ..\app\srs_app_server.cpp, 81 ..\app\srs_app_server.cpp,
84 ..\app\srs_app_st.hpp, 82 ..\app\srs_app_st.hpp,
@@ -87,6 +85,10 @@ file @@ -87,6 +85,10 @@ file
87 ..\app\srs_app_socket.cpp, 85 ..\app\srs_app_socket.cpp,
88 ..\app\srs_app_source.hpp, 86 ..\app\srs_app_source.hpp,
89 ..\app\srs_app_source.cpp, 87 ..\app\srs_app_source.cpp,
  88 + ..\app\srs_app_thread.hpp,
  89 + ..\app\srs_app_thread.cpp,
  90 + ..\app\srs_app_utility.hpp,
  91 + ..\app\srs_app_utility.cpp,
90 utest readonly separator, 92 utest readonly separator,
91 ..\utest\srs_utest.hpp, 93 ..\utest\srs_utest.hpp,
92 ..\utest\srs_utest.cpp, 94 ..\utest\srs_utest.cpp,