正在显示
10 个修改的文件
包含
246 行增加
和
216 行删除
trunk/auto/auto_headers.sh
100644 → 100755
| @@ -18,24 +18,45 @@ echo "#define SRS_AUTO_USER_CONFIGURE \"${SRS_AUTO_USER_CONFIGURE}\"" >> $SRS_AU | @@ -18,24 +18,45 @@ echo "#define SRS_AUTO_USER_CONFIGURE \"${SRS_AUTO_USER_CONFIGURE}\"" >> $SRS_AU | ||
| 18 | echo "#define SRS_AUTO_CONFIGURE \"${SRS_AUTO_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H | 18 | echo "#define SRS_AUTO_CONFIGURE \"${SRS_AUTO_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H |
| 19 | echo "" >> $SRS_AUTO_HEADERS_H | 19 | echo "" >> $SRS_AUTO_HEADERS_H |
| 20 | 20 | ||
| 21 | +function srs_define_macro() | ||
| 22 | +{ | ||
| 23 | + macro=$1 && file=$2 | ||
| 24 | + echo "#define $macro" >> $file | ||
| 25 | + echo "#define ${macro}_BOOL true" >> $file | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +function srs_define_macro_value() | ||
| 29 | +{ | ||
| 30 | + macro=$1 && value=$2 && file=$3 | ||
| 31 | + echo "#define $macro $value" >> $file | ||
| 32 | + echo "#define ${macro}_BOOL true" >> $file | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +function srs_undefine_macro() | ||
| 36 | +{ | ||
| 37 | + macro=$1 && file=$2 | ||
| 38 | + echo "#undef $macro" >> $file | ||
| 39 | + echo "#define ${macro}_BOOL false" >> $file | ||
| 40 | +} | ||
| 41 | + | ||
| 21 | # export the preset. | 42 | # export the preset. |
| 22 | if [ $SRS_OSX = YES ]; then | 43 | if [ $SRS_OSX = YES ]; then |
| 23 | - echo "#define SRS_OSX" >> $SRS_AUTO_HEADERS_H | 44 | + srs_define_macro "SRS_OSX" $SRS_AUTO_HEADERS_H |
| 24 | fi | 45 | fi |
| 25 | if [ $SRS_X86_X64 = YES ]; then | 46 | if [ $SRS_X86_X64 = YES ]; then |
| 26 | - echo "#define SRS_X86_X64" >> $SRS_AUTO_HEADERS_H | 47 | + srs_define_macro "SRS_X86_X64" $SRS_AUTO_HEADERS_H |
| 27 | fi | 48 | fi |
| 28 | if [ $SRS_ARM_UBUNTU12 = YES ]; then | 49 | if [ $SRS_ARM_UBUNTU12 = YES ]; then |
| 29 | - echo "#define SRS_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H | 50 | + srs_define_macro "SRS_ARM_UBUNTU12" $SRS_AUTO_HEADERS_H |
| 30 | fi | 51 | fi |
| 31 | if [ $SRS_MIPS_UBUNTU12 = YES ]; then | 52 | if [ $SRS_MIPS_UBUNTU12 = YES ]; then |
| 32 | - echo "#define SRS_MIPS_UBUNTU12" >> $SRS_AUTO_HEADERS_H | 53 | + srs_define_macro "SRS_MIPS_UBUNTU12" $SRS_AUTO_HEADERS_H |
| 33 | fi | 54 | fi |
| 34 | if [ $SRS_PI = YES ]; then | 55 | if [ $SRS_PI = YES ]; then |
| 35 | - echo "#define SRS_PI" >> $SRS_AUTO_HEADERS_H | 56 | + srs_define_macro "SRS_PI" $SRS_AUTO_HEADERS_H |
| 36 | fi | 57 | fi |
| 37 | if [ $SRS_CUBIE = YES ]; then | 58 | if [ $SRS_CUBIE = YES ]; then |
| 38 | - echo "#define SRS_CUBIE" >> $SRS_AUTO_HEADERS_H | 59 | + srs_define_macro "SRS_CUBIE" $SRS_AUTO_HEADERS_H |
| 39 | fi | 60 | fi |
| 40 | 61 | ||
| 41 | echo "" >> $SRS_AUTO_HEADERS_H | 62 | echo "" >> $SRS_AUTO_HEADERS_H |
| @@ -45,180 +66,180 @@ echo "" >> $SRS_AUTO_HEADERS_H | @@ -45,180 +66,180 @@ echo "" >> $SRS_AUTO_HEADERS_H | ||
| 45 | ##################################################################################### | 66 | ##################################################################################### |
| 46 | # write to source file | 67 | # write to source file |
| 47 | if [ $SRS_CROSS_BUILD = YES ]; then | 68 | if [ $SRS_CROSS_BUILD = YES ]; then |
| 48 | - echo "cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB" | ||
| 49 | - echo "#define SRS_AUTO_EMBEDED_TOOL_CHAIN \"cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB\"" >> $SRS_AUTO_HEADERS_H | 69 | + __TOOL_CHAIN="cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB" && echo "$__TOOL_CHAIN" |
| 70 | + srs_define_macro_value "SRS_AUTO_EMBEDED_TOOL_CHAIN" "\"$__TOOL_CHAIN\"" $SRS_AUTO_HEADERS_H | ||
| 50 | else | 71 | else |
| 51 | - echo "#define SRS_AUTO_EMBEDED_TOOL_CHAIN \"normal x86/x64 gcc\"" >> $SRS_AUTO_HEADERS_H | 72 | + srs_undefine_macro "SRS_AUTO_EMBEDED_TOOL_CHAIN" $SRS_AUTO_HEADERS_H |
| 52 | fi | 73 | fi |
| 53 | echo "" >> $SRS_AUTO_HEADERS_H | 74 | echo "" >> $SRS_AUTO_HEADERS_H |
| 54 | 75 | ||
| 55 | # auto headers in depends. | 76 | # auto headers in depends. |
| 56 | if [ $SRS_HTTP_CORE = YES ]; then | 77 | if [ $SRS_HTTP_CORE = YES ]; then |
| 57 | - echo "#define SRS_AUTO_HTTP_CORE" >> $SRS_AUTO_HEADERS_H | 78 | + srs_define_macro "SRS_AUTO_HTTP_CORE" $SRS_AUTO_HEADERS_H |
| 58 | else | 79 | else |
| 59 | - echo "#undef SRS_AUTO_HTTP_CORE" >> $SRS_AUTO_HEADERS_H | 80 | + srs_undefine_macro "SRS_AUTO_HTTP_CORE" $SRS_AUTO_HEADERS_H |
| 60 | fi | 81 | fi |
| 61 | 82 | ||
| 62 | if [ $SRS_HTTP_SERVER = YES ]; then | 83 | if [ $SRS_HTTP_SERVER = YES ]; then |
| 63 | - echo "#define SRS_AUTO_HTTP_SERVER" >> $SRS_AUTO_HEADERS_H | 84 | + srs_define_macro "SRS_AUTO_HTTP_SERVER" $SRS_AUTO_HEADERS_H |
| 64 | else | 85 | else |
| 65 | - echo "#undef SRS_AUTO_HTTP_SERVER" >> $SRS_AUTO_HEADERS_H | 86 | + srs_undefine_macro "SRS_AUTO_HTTP_SERVER" $SRS_AUTO_HEADERS_H |
| 66 | fi | 87 | fi |
| 67 | 88 | ||
| 68 | if [ $SRS_STREAM_CASTER = YES ]; then | 89 | if [ $SRS_STREAM_CASTER = YES ]; then |
| 69 | - echo "#define SRS_AUTO_STREAM_CASTER" >> $SRS_AUTO_HEADERS_H | 90 | + srs_define_macro "SRS_AUTO_STREAM_CASTER" $SRS_AUTO_HEADERS_H |
| 70 | else | 91 | else |
| 71 | - echo "#undef SRS_AUTO_STREAM_CASTER" >> $SRS_AUTO_HEADERS_H | 92 | + srs_undefine_macro "SRS_AUTO_STREAM_CASTER" $SRS_AUTO_HEADERS_H |
| 72 | fi | 93 | fi |
| 73 | 94 | ||
| 74 | if [ $SRS_KAFKA = YES ]; then | 95 | if [ $SRS_KAFKA = YES ]; then |
| 75 | - echo "#define SRS_AUTO_KAFKA" >> $SRS_AUTO_HEADERS_H | 96 | + srs_define_macro "SRS_AUTO_KAFKA" $SRS_AUTO_HEADERS_H |
| 76 | else | 97 | else |
| 77 | - echo "#undef SRS_AUTO_KAFKA" >> $SRS_AUTO_HEADERS_H | 98 | + srs_undefine_macro "SRS_AUTO_KAFKA" $SRS_AUTO_HEADERS_H |
| 78 | fi | 99 | fi |
| 79 | 100 | ||
| 80 | if [ $SRS_HTTP_API = YES ]; then | 101 | if [ $SRS_HTTP_API = YES ]; then |
| 81 | - echo "#define SRS_AUTO_HTTP_API" >> $SRS_AUTO_HEADERS_H | 102 | + srs_define_macro "SRS_AUTO_HTTP_API" $SRS_AUTO_HEADERS_H |
| 82 | else | 103 | else |
| 83 | - echo "#undef SRS_AUTO_HTTP_API" >> $SRS_AUTO_HEADERS_H | 104 | + srs_undefine_macro "SRS_AUTO_HTTP_API" $SRS_AUTO_HEADERS_H |
| 84 | fi | 105 | fi |
| 85 | 106 | ||
| 86 | if [ $SRS_NGINX = YES ]; then | 107 | if [ $SRS_NGINX = YES ]; then |
| 87 | - echo "#define SRS_AUTO_NGINX" >> $SRS_AUTO_HEADERS_H | 108 | + srs_define_macro "SRS_AUTO_NGINX" $SRS_AUTO_HEADERS_H |
| 88 | else | 109 | else |
| 89 | - echo "#undef SRS_AUTO_NGINX" >> $SRS_AUTO_HEADERS_H | 110 | + srs_undefine_macro "SRS_AUTO_NGINX" $SRS_AUTO_HEADERS_H |
| 90 | fi | 111 | fi |
| 91 | 112 | ||
| 92 | if [ $SRS_DVR = YES ]; then | 113 | if [ $SRS_DVR = YES ]; then |
| 93 | - echo "#define SRS_AUTO_DVR" >> $SRS_AUTO_HEADERS_H | 114 | + srs_define_macro "SRS_AUTO_DVR" $SRS_AUTO_HEADERS_H |
| 94 | else | 115 | else |
| 95 | - echo "#undef SRS_AUTO_DVR" >> $SRS_AUTO_HEADERS_H | 116 | + srs_undefine_macro "SRS_AUTO_DVR" $SRS_AUTO_HEADERS_H |
| 96 | fi | 117 | fi |
| 97 | 118 | ||
| 98 | if [ $SRS_HLS = YES ]; then | 119 | if [ $SRS_HLS = YES ]; then |
| 99 | - echo "#define SRS_AUTO_HLS" >> $SRS_AUTO_HEADERS_H | 120 | + srs_define_macro "SRS_AUTO_HLS" $SRS_AUTO_HEADERS_H |
| 100 | else | 121 | else |
| 101 | - echo "#undef SRS_AUTO_HLS" >> $SRS_AUTO_HEADERS_H | 122 | + srs_undefine_macro "SRS_AUTO_HLS" $SRS_AUTO_HEADERS_H |
| 102 | fi | 123 | fi |
| 103 | 124 | ||
| 104 | if [ $SRS_HDS = YES ]; then | 125 | if [ $SRS_HDS = YES ]; then |
| 105 | - echo "#define SRS_AUTO_HDS" >> $SRS_AUTO_HEADERS_H | 126 | + srs_define_macro "SRS_AUTO_HDS" $SRS_AUTO_HEADERS_H |
| 106 | else | 127 | else |
| 107 | - echo "#undef SRS_AUTO_HDS" >> $SRS_AUTO_HEADERS_H | 128 | + srs_undefine_macro "SRS_AUTO_HDS" $SRS_AUTO_HEADERS_H |
| 108 | fi | 129 | fi |
| 109 | 130 | ||
| 110 | if [ $SRS_HTTP_CALLBACK = YES ]; then | 131 | if [ $SRS_HTTP_CALLBACK = YES ]; then |
| 111 | - echo "#define SRS_AUTO_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H | 132 | + srs_define_macro "SRS_AUTO_HTTP_CALLBACK" $SRS_AUTO_HEADERS_H |
| 112 | else | 133 | else |
| 113 | - echo "#undef SRS_AUTO_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H | 134 | + srs_undefine_macro "SRS_AUTO_HTTP_CALLBACK" $SRS_AUTO_HEADERS_H |
| 114 | fi | 135 | fi |
| 115 | 136 | ||
| 116 | if [ $SRS_SSL = YES ]; then | 137 | if [ $SRS_SSL = YES ]; then |
| 117 | - echo "#define SRS_AUTO_SSL" >> $SRS_AUTO_HEADERS_H | 138 | + srs_define_macro "SRS_AUTO_SSL" $SRS_AUTO_HEADERS_H |
| 118 | else | 139 | else |
| 119 | - echo "#undef SRS_AUTO_SSL" >> $SRS_AUTO_HEADERS_H | 140 | + srs_undefine_macro "SRS_AUTO_SSL" $SRS_AUTO_HEADERS_H |
| 120 | fi | 141 | fi |
| 121 | 142 | ||
| 122 | if [ $SRS_MEM_WATCH = YES ]; then | 143 | if [ $SRS_MEM_WATCH = YES ]; then |
| 123 | - echo "#define SRS_AUTO_MEM_WATCH" >> $SRS_AUTO_HEADERS_H | 144 | + srs_define_macro "SRS_AUTO_MEM_WATCH" $SRS_AUTO_HEADERS_H |
| 124 | else | 145 | else |
| 125 | - echo "#undef SRS_AUTO_MEM_WATCH" >> $SRS_AUTO_HEADERS_H | 146 | + srs_undefine_macro "SRS_AUTO_MEM_WATCH" $SRS_AUTO_HEADERS_H |
| 126 | fi | 147 | fi |
| 127 | 148 | ||
| 128 | # whether compile ffmpeg tool | 149 | # whether compile ffmpeg tool |
| 129 | if [ $SRS_FFMPEG_TOOL = YES ]; then | 150 | if [ $SRS_FFMPEG_TOOL = YES ]; then |
| 130 | - echo "#define SRS_AUTO_FFMPEG_TOOL" >> $SRS_AUTO_HEADERS_H | 151 | + srs_define_macro "SRS_AUTO_FFMPEG_TOOL" $SRS_AUTO_HEADERS_H |
| 131 | else | 152 | else |
| 132 | - echo "#undef SRS_AUTO_FFMPEG_TOOL" >> $SRS_AUTO_HEADERS_H | 153 | + srs_undefine_macro "SRS_AUTO_FFMPEG_TOOL" $SRS_AUTO_HEADERS_H |
| 133 | fi | 154 | fi |
| 134 | 155 | ||
| 135 | # whatever the FFMPEG tools, if transcode and ingest specified, | 156 | # whatever the FFMPEG tools, if transcode and ingest specified, |
| 136 | # srs always compile the FFMPEG tool stub which used to start the FFMPEG process. | 157 | # srs always compile the FFMPEG tool stub which used to start the FFMPEG process. |
| 137 | if [ $SRS_FFMPEG_STUB = YES ]; then | 158 | if [ $SRS_FFMPEG_STUB = YES ]; then |
| 138 | - echo "#define SRS_AUTO_FFMPEG_STUB" >> $SRS_AUTO_HEADERS_H | 159 | + srs_define_macro "SRS_AUTO_FFMPEG_STUB" $SRS_AUTO_HEADERS_H |
| 139 | else | 160 | else |
| 140 | - echo "#undef SRS_AUTO_FFMPEG_STUB" >> $SRS_AUTO_HEADERS_H | 161 | + srs_undefine_macro "SRS_AUTO_FFMPEG_STUB" $SRS_AUTO_HEADERS_H |
| 141 | fi | 162 | fi |
| 142 | 163 | ||
| 143 | if [ $SRS_TRANSCODE = YES ]; then | 164 | if [ $SRS_TRANSCODE = YES ]; then |
| 144 | - echo "#define SRS_AUTO_TRANSCODE" >> $SRS_AUTO_HEADERS_H | 165 | + srs_define_macro "SRS_AUTO_TRANSCODE" $SRS_AUTO_HEADERS_H |
| 145 | else | 166 | else |
| 146 | - echo "#undef SRS_AUTO_TRANSCODE" >> $SRS_AUTO_HEADERS_H | 167 | + srs_undefine_macro "SRS_AUTO_TRANSCODE" $SRS_AUTO_HEADERS_H |
| 147 | fi | 168 | fi |
| 148 | 169 | ||
| 149 | if [ $SRS_INGEST = YES ]; then | 170 | if [ $SRS_INGEST = YES ]; then |
| 150 | - echo "#define SRS_AUTO_INGEST" >> $SRS_AUTO_HEADERS_H | 171 | + srs_define_macro "SRS_AUTO_INGEST" $SRS_AUTO_HEADERS_H |
| 151 | else | 172 | else |
| 152 | - echo "#undef SRS_AUTO_INGEST" >> $SRS_AUTO_HEADERS_H | 173 | + srs_undefine_macro "SRS_AUTO_INGEST" $SRS_AUTO_HEADERS_H |
| 153 | fi | 174 | fi |
| 154 | 175 | ||
| 155 | # for statistic. | 176 | # for statistic. |
| 156 | if [ $SRS_STAT = YES ]; then | 177 | if [ $SRS_STAT = YES ]; then |
| 157 | - echo "#define SRS_AUTO_STAT" >> $SRS_AUTO_HEADERS_H | 178 | + srs_define_macro "SRS_AUTO_STAT" $SRS_AUTO_HEADERS_H |
| 158 | else | 179 | else |
| 159 | - echo "#undef SRS_AUTO_STAT" >> $SRS_AUTO_HEADERS_H | 180 | + srs_undefine_macro "SRS_AUTO_STAT" $SRS_AUTO_HEADERS_H |
| 160 | fi | 181 | fi |
| 161 | 182 | ||
| 162 | if [ $SRS_GPERF = YES ]; then | 183 | if [ $SRS_GPERF = YES ]; then |
| 163 | - echo "#define SRS_AUTO_GPERF" >> $SRS_AUTO_HEADERS_H | 184 | + srs_define_macro "SRS_AUTO_GPERF" $SRS_AUTO_HEADERS_H |
| 164 | else | 185 | else |
| 165 | - echo "#undef SRS_AUTO_GPERF" >> $SRS_AUTO_HEADERS_H | 186 | + srs_undefine_macro "SRS_AUTO_GPERF" $SRS_AUTO_HEADERS_H |
| 166 | fi | 187 | fi |
| 167 | if [ $SRS_GPERF_MC = YES ]; then | 188 | if [ $SRS_GPERF_MC = YES ]; then |
| 168 | - echo "#define SRS_AUTO_GPERF_MC" >> $SRS_AUTO_HEADERS_H | 189 | + srs_define_macro "SRS_AUTO_GPERF_MC" $SRS_AUTO_HEADERS_H |
| 169 | else | 190 | else |
| 170 | - echo "#undef SRS_AUTO_GPERF_MC" >> $SRS_AUTO_HEADERS_H | 191 | + srs_undefine_macro "SRS_AUTO_GPERF_MC" $SRS_AUTO_HEADERS_H |
| 171 | fi | 192 | fi |
| 172 | if [ $SRS_GPERF_MP = YES ]; then | 193 | if [ $SRS_GPERF_MP = YES ]; then |
| 173 | - echo "#define SRS_AUTO_GPERF_MP" >> $SRS_AUTO_HEADERS_H | 194 | + srs_define_macro "SRS_AUTO_GPERF_MP" $SRS_AUTO_HEADERS_H |
| 174 | else | 195 | else |
| 175 | - echo "#undef SRS_AUTO_GPERF_MP" >> $SRS_AUTO_HEADERS_H | 196 | + srs_undefine_macro "SRS_AUTO_GPERF_MP" $SRS_AUTO_HEADERS_H |
| 176 | fi | 197 | fi |
| 177 | if [ $SRS_GPERF_CP = YES ]; then | 198 | if [ $SRS_GPERF_CP = YES ]; then |
| 178 | - echo "#define SRS_AUTO_GPERF_CP" >> $SRS_AUTO_HEADERS_H | 199 | + srs_define_macro "SRS_AUTO_GPERF_CP" $SRS_AUTO_HEADERS_H |
| 179 | else | 200 | else |
| 180 | - echo "#undef SRS_AUTO_GPERF_CP" >> $SRS_AUTO_HEADERS_H | 201 | + srs_undefine_macro "SRS_AUTO_GPERF_CP" $SRS_AUTO_HEADERS_H |
| 181 | fi | 202 | fi |
| 182 | 203 | ||
| 183 | ##################################################################################### | 204 | ##################################################################################### |
| 184 | # for embeded. | 205 | # for embeded. |
| 185 | ##################################################################################### | 206 | ##################################################################################### |
| 186 | if [ $SRS_CROSS_BUILD = YES ]; then | 207 | if [ $SRS_CROSS_BUILD = YES ]; then |
| 187 | - echo "#define SRS_AUTO_EMBEDED_CPU" >> $SRS_AUTO_HEADERS_H | 208 | + srs_define_macro "SRS_AUTO_EMBEDED_CPU" $SRS_AUTO_HEADERS_H |
| 188 | else | 209 | else |
| 189 | - echo "#undef SRS_AUTO_EMBEDED_CPU" >> $SRS_AUTO_HEADERS_H | 210 | + srs_undefine_macro "SRS_AUTO_EMBEDED_CPU" $SRS_AUTO_HEADERS_H |
| 190 | fi | 211 | fi |
| 191 | 212 | ||
| 192 | # arm | 213 | # arm |
| 193 | if [ $SRS_ARM_UBUNTU12 = YES ]; then | 214 | if [ $SRS_ARM_UBUNTU12 = YES ]; then |
| 194 | - echo "#define SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H | 215 | + srs_define_macro "SRS_AUTO_ARM_UBUNTU12" $SRS_AUTO_HEADERS_H |
| 195 | else | 216 | else |
| 196 | - echo "#undef SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H | 217 | + srs_undefine_macro "SRS_AUTO_ARM_UBUNTU12" $SRS_AUTO_HEADERS_H |
| 197 | fi | 218 | fi |
| 198 | 219 | ||
| 199 | # mips | 220 | # mips |
| 200 | if [ $SRS_MIPS_UBUNTU12 = YES ]; then | 221 | if [ $SRS_MIPS_UBUNTU12 = YES ]; then |
| 201 | - echo "#define SRS_AUTO_MIPS_UBUNTU12" >> $SRS_AUTO_HEADERS_H | 222 | + srs_define_macro "SRS_AUTO_MIPS_UBUNTU12" $SRS_AUTO_HEADERS_H |
| 202 | else | 223 | else |
| 203 | - echo "#undef SRS_AUTO_MIPS_UBUNTU12" >> $SRS_AUTO_HEADERS_H | 224 | + srs_undefine_macro "SRS_AUTO_MIPS_UBUNTU12" $SRS_AUTO_HEADERS_H |
| 204 | fi | 225 | fi |
| 205 | 226 | ||
| 206 | echo "" >> $SRS_AUTO_HEADERS_H | 227 | echo "" >> $SRS_AUTO_HEADERS_H |
| 207 | # for log level compile settings | 228 | # for log level compile settings |
| 208 | if [ $SRS_LOG_VERBOSE = YES ]; then | 229 | if [ $SRS_LOG_VERBOSE = YES ]; then |
| 209 | - echo "#define SRS_AUTO_VERBOSE" >> $SRS_AUTO_HEADERS_H | 230 | + srs_define_macro "SRS_AUTO_VERBOSE" $SRS_AUTO_HEADERS_H |
| 210 | else | 231 | else |
| 211 | - echo "#undef SRS_AUTO_VERBOSE" >> $SRS_AUTO_HEADERS_H | 232 | + srs_undefine_macro "SRS_AUTO_VERBOSE" $SRS_AUTO_HEADERS_H |
| 212 | fi | 233 | fi |
| 213 | if [ $SRS_LOG_INFO = YES ]; then | 234 | if [ $SRS_LOG_INFO = YES ]; then |
| 214 | - echo "#define SRS_AUTO_INFO" >> $SRS_AUTO_HEADERS_H | 235 | + srs_define_macro "SRS_AUTO_INFO" $SRS_AUTO_HEADERS_H |
| 215 | else | 236 | else |
| 216 | - echo "#undef SRS_AUTO_INFO" >> $SRS_AUTO_HEADERS_H | 237 | + srs_undefine_macro "SRS_AUTO_INFO" $SRS_AUTO_HEADERS_H |
| 217 | fi | 238 | fi |
| 218 | if [ $SRS_LOG_TRACE = YES ]; then | 239 | if [ $SRS_LOG_TRACE = YES ]; then |
| 219 | - echo "#define SRS_AUTO_TRACE" >> $SRS_AUTO_HEADERS_H | 240 | + srs_define_macro "SRS_AUTO_TRACE" $SRS_AUTO_HEADERS_H |
| 220 | else | 241 | else |
| 221 | - echo "#undef SRS_AUTO_TRACE" >> $SRS_AUTO_HEADERS_H | 242 | + srs_undefine_macro "SRS_AUTO_TRACE" $SRS_AUTO_HEADERS_H |
| 222 | fi | 243 | fi |
| 223 | 244 | ||
| 224 | # prefix | 245 | # prefix |
| @@ -44,7 +44,13 @@ int SrsKafkaProducer::initialize() | @@ -44,7 +44,13 @@ int SrsKafkaProducer::initialize() | ||
| 44 | { | 44 | { |
| 45 | int ret = ERROR_SUCCESS; | 45 | int ret = ERROR_SUCCESS; |
| 46 | 46 | ||
| 47 | - srs_trace("initialize kafka producer ok."); | 47 | + // when kafka enabled, request metadata when startup. |
| 48 | + if (_srs_config->get_kafka_enabled() && (ret = request_metadata()) != ERROR_SUCCESS) { | ||
| 49 | + srs_error("request kafka metadata failed. ret=%d", ret); | ||
| 50 | + return ret; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + srs_info("initialize kafka producer ok."); | ||
| 48 | 54 | ||
| 49 | return ret; | 55 | return ret; |
| 50 | } | 56 | } |
| @@ -58,7 +64,7 @@ int SrsKafkaProducer::start() | @@ -58,7 +64,7 @@ int SrsKafkaProducer::start() | ||
| 58 | return ret; | 64 | return ret; |
| 59 | } | 65 | } |
| 60 | 66 | ||
| 61 | - srs_trace("start kafka async worker ok."); | 67 | + srs_trace("kafka worker ok, enabled:%d", _srs_config->get_kafka_enabled()); |
| 62 | 68 | ||
| 63 | return ret; | 69 | return ret; |
| 64 | } | 70 | } |
| @@ -68,5 +74,14 @@ void SrsKafkaProducer::stop() | @@ -68,5 +74,14 @@ void SrsKafkaProducer::stop() | ||
| 68 | worker->stop(); | 74 | worker->stop(); |
| 69 | } | 75 | } |
| 70 | 76 | ||
| 77 | +int SrsKafkaProducer::request_metadata() | ||
| 78 | +{ | ||
| 79 | + int ret = ERROR_SUCCESS; | ||
| 80 | + | ||
| 81 | + srs_info("update kafka metadata ok"); | ||
| 82 | + | ||
| 83 | + return ret; | ||
| 84 | +} | ||
| 85 | + | ||
| 71 | #endif | 86 | #endif |
| 72 | 87 |
| @@ -440,7 +440,8 @@ int SrsSignalManager::start() | @@ -440,7 +440,8 @@ int SrsSignalManager::start() | ||
| 440 | sa.sa_flags = 0; | 440 | sa.sa_flags = 0; |
| 441 | sigaction(SRS_SIGNAL_PERSISTENCE_CONFIG, &sa, NULL); | 441 | sigaction(SRS_SIGNAL_PERSISTENCE_CONFIG, &sa, NULL); |
| 442 | 442 | ||
| 443 | - srs_trace("signal installed"); | 443 | + srs_trace("signal installed, reload=%d, dispose=%d, persistence=%d, grace_quit=%d", |
| 444 | + SRS_SIGNAL_RELOAD, SRS_SIGNAL_DISPOSE, SRS_SIGNAL_PERSISTENCE_CONFIG, SRS_SIGNAL_GRACEFULLY_QUIT); | ||
| 444 | 445 | ||
| 445 | return pthread->start(); | 446 | return pthread->start(); |
| 446 | } | 447 | } |
| @@ -443,7 +443,7 @@ int srs_st_init() | @@ -443,7 +443,7 @@ int srs_st_init() | ||
| 443 | srs_error("st_set_eventsys use %s failed. ret=%d", st_get_eventsys_name(), ret); | 443 | srs_error("st_set_eventsys use %s failed. ret=%d", st_get_eventsys_name(), ret); |
| 444 | return ret; | 444 | return ret; |
| 445 | } | 445 | } |
| 446 | - srs_trace("st_set_eventsys to %s", st_get_eventsys_name()); | 446 | + srs_info("st_set_eventsys to %s", st_get_eventsys_name()); |
| 447 | 447 | ||
| 448 | if(st_init() != 0){ | 448 | if(st_init() != 0){ |
| 449 | ret = ERROR_ST_INITIALIZE; | 449 | ret = ERROR_ST_INITIALIZE; |
| @@ -230,6 +230,10 @@ void srs_parse_endpoint(string ip_port, string& ip, int& port) | @@ -230,6 +230,10 @@ void srs_parse_endpoint(string ip_port, string& ip, int& port) | ||
| 230 | port = ::atoi(the_port.c_str()); | 230 | port = ::atoi(the_port.c_str()); |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | +string srs_bool2switch(bool v) { | ||
| 234 | + return v? "on" : "off"; | ||
| 235 | +} | ||
| 236 | + | ||
| 233 | int srs_kill_forced(int& pid) | 237 | int srs_kill_forced(int& pid) |
| 234 | { | 238 | { |
| 235 | int ret = ERROR_SUCCESS; | 239 | int ret = ERROR_SUCCESS; |
| @@ -490,7 +494,7 @@ void srs_update_proc_stat() | @@ -490,7 +494,7 @@ void srs_update_proc_stat() | ||
| 490 | static int user_hz = 0; | 494 | static int user_hz = 0; |
| 491 | if (user_hz <= 0) { | 495 | if (user_hz <= 0) { |
| 492 | user_hz = (int)sysconf(_SC_CLK_TCK); | 496 | user_hz = (int)sysconf(_SC_CLK_TCK); |
| 493 | - srs_trace("USER_HZ=%d", user_hz); | 497 | + srs_info("USER_HZ=%d", user_hz); |
| 494 | srs_assert(user_hz > 0); | 498 | srs_assert(user_hz > 0); |
| 495 | } | 499 | } |
| 496 | 500 | ||
| @@ -1234,6 +1238,12 @@ void retrieve_local_ipv4_ips() | @@ -1234,6 +1238,12 @@ void retrieve_local_ipv4_ips() | ||
| 1234 | return; | 1238 | return; |
| 1235 | } | 1239 | } |
| 1236 | 1240 | ||
| 1241 | + stringstream ss0; | ||
| 1242 | + ss0 << "ips"; | ||
| 1243 | + | ||
| 1244 | + stringstream ss1; | ||
| 1245 | + ss1 << "devices"; | ||
| 1246 | + | ||
| 1237 | ifaddrs* p = ifap; | 1247 | ifaddrs* p = ifap; |
| 1238 | while (p != NULL) { | 1248 | while (p != NULL) { |
| 1239 | ifaddrs* cur = p; | 1249 | ifaddrs* cur = p; |
| @@ -1257,20 +1267,23 @@ void retrieve_local_ipv4_ips() | @@ -1257,20 +1267,23 @@ void retrieve_local_ipv4_ips() | ||
| 1257 | 1267 | ||
| 1258 | std::string ip = buf; | 1268 | std::string ip = buf; |
| 1259 | if (ip != SRS_CONSTS_LOCALHOST) { | 1269 | if (ip != SRS_CONSTS_LOCALHOST) { |
| 1260 | - srs_trace("retrieve local ipv4 ip=%s, index=%d", ip.c_str(), (int)ips.size()); | 1270 | + ss0 << ", local[" << (int)ips.size() << "] ipv4 " << ip; |
| 1261 | ips.push_back(ip); | 1271 | ips.push_back(ip); |
| 1262 | } | 1272 | } |
| 1263 | 1273 | ||
| 1264 | // set the device internet status. | 1274 | // set the device internet status. |
| 1265 | if (!srs_net_device_is_internet(inaddr->s_addr)) { | 1275 | if (!srs_net_device_is_internet(inaddr->s_addr)) { |
| 1266 | - srs_trace("detect intranet address: %s, ifname=%s", ip.c_str(), cur->ifa_name); | 1276 | + ss1 << ", intranet "; |
| 1267 | _srs_device_ifs[cur->ifa_name] = false; | 1277 | _srs_device_ifs[cur->ifa_name] = false; |
| 1268 | } else { | 1278 | } else { |
| 1269 | - srs_trace("detect internet address: %s, ifname=%s", ip.c_str(), cur->ifa_name); | 1279 | + ss1 << ", internet "; |
| 1270 | _srs_device_ifs[cur->ifa_name] = true; | 1280 | _srs_device_ifs[cur->ifa_name] = true; |
| 1271 | } | 1281 | } |
| 1282 | + ss1 << cur->ifa_name << " " << ip; | ||
| 1272 | } | 1283 | } |
| 1273 | } | 1284 | } |
| 1285 | + srs_trace(ss0.str().c_str()); | ||
| 1286 | + srs_trace(ss1.str().c_str()); | ||
| 1274 | 1287 | ||
| 1275 | freeifaddrs(ifap); | 1288 | freeifaddrs(ifap); |
| 1276 | } | 1289 | } |
| @@ -83,6 +83,11 @@ extern void srs_parse_endpoint(std::string ip_port, std::string& ip, std::string | @@ -83,6 +83,11 @@ extern void srs_parse_endpoint(std::string ip_port, std::string& ip, std::string | ||
| 83 | extern void srs_parse_endpoint(std::string ip_port, std::string& ip, int& port); | 83 | extern void srs_parse_endpoint(std::string ip_port, std::string& ip, int& port); |
| 84 | 84 | ||
| 85 | /** | 85 | /** |
| 86 | + * convert bool to switch value, true to "on", false to "off". | ||
| 87 | + */ | ||
| 88 | +extern std::string srs_bool2switch(bool v); | ||
| 89 | + | ||
| 90 | +/** | ||
| 86 | * kill the pid by SIGINT, then wait to quit, | 91 | * kill the pid by SIGINT, then wait to quit, |
| 87 | * kill the pid by SIGKILL again when exceed the timeout. | 92 | * kill the pid by SIGKILL again when exceed the timeout. |
| 88 | * @param pid the pid to kill. ignore for -1. set to -1 when killed. | 93 | * @param pid the pid to kill. ignore for -1. set to -1 when killed. |
| @@ -27,6 +27,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -27,6 +27,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 27 | #include <sys/types.h> | 27 | #include <sys/types.h> |
| 28 | #include <sys/wait.h> | 28 | #include <sys/wait.h> |
| 29 | 29 | ||
| 30 | +#include <sstream> | ||
| 31 | +using namespace std; | ||
| 32 | + | ||
| 30 | #ifdef SRS_AUTO_GPERF_MP | 33 | #ifdef SRS_AUTO_GPERF_MP |
| 31 | #include <gperftools/heap-profiler.h> | 34 | #include <gperftools/heap-profiler.h> |
| 32 | #endif | 35 | #endif |
| @@ -40,6 +43,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -40,6 +43,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 40 | #include <srs_app_log.hpp> | 43 | #include <srs_app_log.hpp> |
| 41 | #include <srs_kernel_utility.hpp> | 44 | #include <srs_kernel_utility.hpp> |
| 42 | #include <srs_core_performance.hpp> | 45 | #include <srs_core_performance.hpp> |
| 46 | +#include <srs_app_utility.hpp> | ||
| 43 | 47 | ||
| 44 | // pre-declare | 48 | // pre-declare |
| 45 | int run(); | 49 | int run(); |
| @@ -60,157 +64,143 @@ SrsServer* _srs_server = new SrsServer(); | @@ -60,157 +64,143 @@ SrsServer* _srs_server = new SrsServer(); | ||
| 60 | */ | 64 | */ |
| 61 | void show_macro_features() | 65 | void show_macro_features() |
| 62 | { | 66 | { |
| 63 | -#ifdef SRS_AUTO_SSL | ||
| 64 | - srs_trace("check feature rtmp handshake: on"); | ||
| 65 | -#else | ||
| 66 | - srs_warn("check feature rtmp handshake: off"); | ||
| 67 | -#endif | 67 | + if (true) { |
| 68 | + stringstream ss; | ||
| 69 | + | ||
| 70 | + ss << "features"; | ||
| 71 | + | ||
| 72 | + // rch(rtmp complex handshake) | ||
| 73 | + ss << ", rch:" << srs_bool2switch(SRS_AUTO_SSL_BOOL); | ||
| 74 | + ss << ", hls:" << srs_bool2switch(SRS_AUTO_HLS_BOOL); | ||
| 75 | + ss << ", hds:" << srs_bool2switch(SRS_AUTO_HDS_BOOL); | ||
| 76 | + // hc(http callback) | ||
| 77 | + ss << ", hc:" << srs_bool2switch(SRS_AUTO_HTTP_CALLBACK_BOOL); | ||
| 78 | + // ha(http api) | ||
| 79 | + ss << ", ha:" << srs_bool2switch(SRS_AUTO_HTTP_API_BOOL); | ||
| 80 | + // hs(http server) | ||
| 81 | + ss << ", hs:" << srs_bool2switch(SRS_AUTO_HTTP_SERVER_BOOL); | ||
| 82 | + // hp(http parser) | ||
| 83 | + ss << ", hp:" << srs_bool2switch(SRS_AUTO_HTTP_CORE_BOOL); | ||
| 84 | + ss << ", dvr:" << srs_bool2switch(SRS_AUTO_DVR_BOOL); | ||
| 85 | + // trans(transcode) | ||
| 86 | + ss << ", trans:" << srs_bool2switch(SRS_AUTO_TRANSCODE_BOOL); | ||
| 87 | + // inge(ingest) | ||
| 88 | + ss << ", inge:" << srs_bool2switch(SRS_AUTO_INGEST_BOOL); | ||
| 89 | + ss << ", kafka:" << srs_bool2switch(SRS_AUTO_KAFKA_BOOL); | ||
| 90 | + ss << ", stat:" << srs_bool2switch(SRS_AUTO_STAT_BOOL); | ||
| 91 | + ss << ", nginx:" << srs_bool2switch(SRS_AUTO_NGINX_BOOL); | ||
| 92 | + // ff(ffmpeg) | ||
| 93 | + ss << ", ff:" << srs_bool2switch(SRS_AUTO_FFMPEG_TOOL_BOOL); | ||
| 94 | + // sc(stream-caster) | ||
| 95 | + ss << ", sc:" << srs_bool2switch(SRS_AUTO_STREAM_CASTER_BOOL); | ||
| 96 | + srs_trace(ss.str().c_str()); | ||
| 97 | + } | ||
| 68 | 98 | ||
| 69 | -#ifdef SRS_AUTO_HLS | ||
| 70 | - srs_trace("check feature hls: on"); | ||
| 71 | -#else | ||
| 72 | - srs_warn("check feature hls: off"); | 99 | + if (true) { |
| 100 | + stringstream ss; | ||
| 101 | + ss << "SRS on "; | ||
| 102 | +#ifdef SRS_OSX | ||
| 103 | + ss << "OSX"; | ||
| 73 | #endif | 104 | #endif |
| 74 | - | ||
| 75 | -#ifdef SRS_AUTO_HDS | ||
| 76 | - srs_trace("check feature hds: on"); | ||
| 77 | -#else | ||
| 78 | - srs_warn("check feature hds: off"); | 105 | +#ifdef SRS_PI |
| 106 | + ss << "RespberryPi"; | ||
| 79 | #endif | 107 | #endif |
| 80 | - | ||
| 81 | -#ifdef SRS_AUTO_HTTP_CALLBACK | ||
| 82 | - srs_trace("check feature http callback: on"); | ||
| 83 | -#else | ||
| 84 | - srs_warn("check feature http callback: off"); | 108 | +#ifdef SRS_CUBIE |
| 109 | + ss << "CubieBoard"; | ||
| 85 | #endif | 110 | #endif |
| 86 | - | ||
| 87 | -#ifdef SRS_AUTO_HTTP_API | ||
| 88 | - srs_trace("check feature http api: on"); | ||
| 89 | -#else | ||
| 90 | - srs_warn("check feature http api: off"); | 111 | +#ifdef SRS_ARM_UBUNTU12 |
| 112 | + ss << "ARM(build on ubuntu)"; | ||
| 91 | #endif | 113 | #endif |
| 92 | - | ||
| 93 | -#ifdef SRS_AUTO_HTTP_SERVER | ||
| 94 | - srs_trace("check feature http server: on"); | ||
| 95 | -#else | ||
| 96 | - srs_warn("check feature http server: off"); | 114 | +#ifdef SRS_MIPS_UBUNTU12 |
| 115 | + ss << "MIPS(build on ubuntu)"; | ||
| 97 | #endif | 116 | #endif |
| 98 | 117 | ||
| 99 | -#ifdef SRS_AUTO_HTTP_CORE | ||
| 100 | - srs_trace("check feature http parser: on"); | ||
| 101 | -#else | ||
| 102 | - srs_warn("check feature http parser: off"); | 118 | +#if defined(__amd64__) |
| 119 | + ss << " amd64"; | ||
| 103 | #endif | 120 | #endif |
| 104 | - | ||
| 105 | -#ifdef SRS_AUTO_DVR | ||
| 106 | - srs_trace("check feature dvr: on"); | ||
| 107 | -#else | ||
| 108 | - srs_warn("check feature dvr: off"); | 121 | +#if defined(__x86_64__) |
| 122 | + ss << " x86_64"; | ||
| 109 | #endif | 123 | #endif |
| 110 | - | ||
| 111 | -#ifdef SRS_AUTO_TRANSCODE | ||
| 112 | - srs_trace("check feature transcode: on"); | ||
| 113 | -#else | ||
| 114 | - srs_warn("check feature transcode: off"); | 124 | +#if defined(__i386__) |
| 125 | + ss << " i386"; | ||
| 115 | #endif | 126 | #endif |
| 116 | - | ||
| 117 | -#ifdef SRS_AUTO_INGEST | ||
| 118 | - srs_trace("check feature ingest: on"); | ||
| 119 | -#else | ||
| 120 | - srs_warn("check feature ingest: off"); | 127 | +#if defined(__arm__) |
| 128 | + ss << "arm"; | ||
| 121 | #endif | 129 | #endif |
| 122 | 130 | ||
| 123 | -#ifdef SRS_AUTO_STAT | ||
| 124 | - srs_trace("check feature system stat: on"); | ||
| 125 | -#else | ||
| 126 | - srs_warn("check feature system stat: off"); | 131 | +#ifndef SRS_OSX |
| 132 | + ss << ", glibc" << (int)__GLIBC__ << "." (int)__GLIBC_MINOR__; | ||
| 127 | #endif | 133 | #endif |
| 128 | 134 | ||
| 129 | -#ifdef SRS_AUTO_NGINX | ||
| 130 | - srs_trace("check feature compile nginx: on"); | ||
| 131 | -#else | ||
| 132 | - srs_warn("check feature compile nginx: off"); | ||
| 133 | -#endif | 135 | + ss << ", conf:" << _srs_config->config() << ", limit:" << _srs_config->get_max_connections() |
| 136 | + << ", writev:" << sysconf(_SC_IOV_MAX) << ", encoding:" << (srs_is_little_endian()? "little-endian":"big-endian") | ||
| 137 | + << ", HZ:" << (int)sysconf(_SC_CLK_TCK); | ||
| 134 | 138 | ||
| 135 | -#ifdef SRS_AUTO_FFMPEG_TOOL | ||
| 136 | - srs_trace("check feature compile ffmpeg: on"); | ||
| 137 | -#else | ||
| 138 | - srs_warn("check feature compile ffmpeg: off"); | ||
| 139 | -#endif | 139 | + srs_trace(ss.str().c_str()); |
| 140 | + } | ||
| 140 | 141 | ||
| 141 | -#ifdef SRS_AUTO_STREAM_CASTER | ||
| 142 | - srs_trace("stream caster: on"); | ||
| 143 | -#else | ||
| 144 | - srs_warn("stream caster: off"); | ||
| 145 | -#endif | 142 | + if (true) { |
| 143 | + stringstream ss; | ||
| 144 | + | ||
| 145 | + // mw(merged-write) | ||
| 146 | + ss << "mw sleep:" << SRS_PERF_MW_SLEEP << "ms"; | ||
| 146 | 147 | ||
| 148 | + // mr(merged-read) | ||
| 149 | + ss << ". mr "; | ||
| 147 | #ifdef SRS_PERF_MERGED_READ | 150 | #ifdef SRS_PERF_MERGED_READ |
| 148 | - srs_trace("MR(merged-read): on, @see %s", RTMP_SIG_SRS_ISSUES(241)); | 151 | + ss << "enabled:on"; |
| 149 | #else | 152 | #else |
| 150 | - srs_warn("MR(merged-read): off, @see %s", RTMP_SIG_SRS_ISSUES(241)); | 153 | + ss << "enabled:off"; |
| 151 | #endif | 154 | #endif |
| 155 | + ss << ", default:" << SRS_PERF_MR_ENABLED << ", sleep:" << SRS_PERF_MR_SLEEP << "ms"; | ||
| 156 | + ss << ", @see " << RTMP_SIG_SRS_ISSUES(241); | ||
| 152 | 157 | ||
| 153 | - srs_trace("MR(merged-read) default %d sleep %d", SRS_PERF_MR_ENABLED, SRS_PERF_MR_SLEEP); | ||
| 154 | - srs_trace("MW(merged-write) default sleep %d", SRS_PERF_MW_SLEEP); | ||
| 155 | - srs_trace("read chunk stream cache cid [0, %d)", SRS_PERF_CHUNK_STREAM_CACHE); | ||
| 156 | - srs_trace("default gop cache %d, play queue %ds", SRS_PERF_GOP_CACHE, SRS_PERF_PLAY_QUEUE); | 158 | + srs_trace(ss.str().c_str()); |
| 159 | + } | ||
| 157 | 160 | ||
| 161 | + if (true) { | ||
| 162 | + stringstream ss; | ||
| 163 | + | ||
| 164 | + // gc(gop-cache) | ||
| 165 | + ss << "gc:" << srs_bool2switch(SRS_PERF_GOP_CACHE); | ||
| 166 | + // pq(play-queue) | ||
| 167 | + ss << ", pq:" << SRS_PERF_PLAY_QUEUE << "s"; | ||
| 168 | + // cscc(chunk stream cache cid) | ||
| 169 | + ss << ", cscc:[0," << SRS_PERF_CHUNK_STREAM_CACHE << ")"; | ||
| 170 | + // csa(complex send algorithm) | ||
| 171 | + ss << ", csa:"; | ||
| 158 | #ifndef SRS_PERF_COMPLEX_SEND | 172 | #ifndef SRS_PERF_COMPLEX_SEND |
| 159 | - srs_warn("complex send algorithm disabled."); | 173 | + ss << "off"; |
| 160 | #else | 174 | #else |
| 161 | - srs_trace("complex send algorithm enabled."); | 175 | + ss << "on"; |
| 162 | #endif | 176 | #endif |
| 163 | 177 | ||
| 178 | + // tn(TCP_NODELAY) | ||
| 179 | + ss << ", tn:"; | ||
| 164 | #ifdef SRS_PERF_TCP_NODELAY | 180 | #ifdef SRS_PERF_TCP_NODELAY |
| 165 | - srs_warn("TCP_NODELAY enabled, may hurts performance."); | 181 | + ss << "on(may hurts performance)"; |
| 166 | #else | 182 | #else |
| 167 | - srs_trace("TCP_NODELAY disabled."); | 183 | + ss << "off"; |
| 168 | #endif | 184 | #endif |
| 169 | 185 | ||
| 186 | + // ss(SO_SENDBUF) | ||
| 187 | + ss << ", ss:"; | ||
| 170 | #ifdef SRS_PERF_SO_SNDBUF_SIZE | 188 | #ifdef SRS_PERF_SO_SNDBUF_SIZE |
| 171 | - srs_warn("socket send buffer size %d", SRS_PERF_SO_SNDBUF_SIZE); | 189 | + ss << SRS_PERF_SO_SNDBUF_SIZE; |
| 172 | #else | 190 | #else |
| 173 | - srs_trace("auto guess socket send buffer by merged write"); | 191 | + ss << "auto(guess by merged write)"; |
| 174 | #endif | 192 | #endif |
| 175 | 193 | ||
| 194 | + srs_trace(ss.str().c_str()); | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + // others | ||
| 176 | int possible_mr_latency = 0; | 198 | int possible_mr_latency = 0; |
| 177 | #ifdef SRS_PERF_MERGED_READ | 199 | #ifdef SRS_PERF_MERGED_READ |
| 178 | possible_mr_latency = SRS_PERF_MR_SLEEP; | 200 | possible_mr_latency = SRS_PERF_MR_SLEEP; |
| 179 | #endif | 201 | #endif |
| 180 | srs_trace("system default latency in ms: mw(0-%d) + mr(0-%d) + play-queue(0-%d)", | 202 | srs_trace("system default latency in ms: mw(0-%d) + mr(0-%d) + play-queue(0-%d)", |
| 181 | SRS_PERF_MW_SLEEP, possible_mr_latency, SRS_PERF_PLAY_QUEUE*1000); | 203 | SRS_PERF_MW_SLEEP, possible_mr_latency, SRS_PERF_PLAY_QUEUE*1000); |
| 182 | -} | ||
| 183 | - | ||
| 184 | -void check_macro_features() | ||
| 185 | -{ | ||
| 186 | - // important preset. | ||
| 187 | -#ifdef SRS_OSX | ||
| 188 | - srs_trace("SRS for OSX"); | ||
| 189 | -#endif | ||
| 190 | -#ifdef SRS_PI | ||
| 191 | - srs_trace("SRS for pi"); | ||
| 192 | -#endif | ||
| 193 | -#ifdef SRS_CUBIE | ||
| 194 | - srs_trace("SRS for cubieboard"); | ||
| 195 | -#endif | ||
| 196 | -#ifdef SRS_ARM_UBUNTU12 | ||
| 197 | - srs_trace("SRS for arm(build on ubuntu)"); | ||
| 198 | -#endif | ||
| 199 | -#ifdef SRS_MIPS_UBUNTU12 | ||
| 200 | - srs_trace("SRS for mips(build on ubuntu)"); | ||
| 201 | -#endif | ||
| 202 | - | ||
| 203 | - // for special features. | ||
| 204 | -#ifndef SRS_PERF_MERGED_READ | ||
| 205 | - srs_warn("MR(merged-read) is disabled, hurts read performance. @see %s", RTMP_SIG_SRS_ISSUES(241)); | ||
| 206 | -#endif | ||
| 207 | - | ||
| 208 | - srs_trace("writev limits write %d iovs a time", sysconf(_SC_IOV_MAX)); | ||
| 209 | - | ||
| 210 | -#if VERSION_MAJOR > VERSION_STABLE | ||
| 211 | - #warning "current branch is not stable, please use stable branch instead." | ||
| 212 | - srs_warn("SRS %s is not stable, please use stable branch %s instead", RTMP_SIG_SRS_VERSION, VERSION_STABLE_BRANCH); | ||
| 213 | -#endif | ||
| 214 | 204 | ||
| 215 | #ifdef SRS_AUTO_MEM_WATCH | 205 | #ifdef SRS_AUTO_MEM_WATCH |
| 216 | #warning "srs memory watcher will hurts performance. user should kill by SIGTERM or init.d script." | 206 | #warning "srs memory watcher will hurts performance. user should kill by SIGTERM or init.d script." |
| @@ -222,23 +212,13 @@ void check_macro_features() | @@ -222,23 +212,13 @@ void check_macro_features() | ||
| 222 | srs_warn("stream caster is experiment feature."); | 212 | srs_warn("stream caster is experiment feature."); |
| 223 | #endif | 213 | #endif |
| 224 | 214 | ||
| 225 | -#if defined(SRS_PERF_SO_SNDBUF_SIZE) && !defined(SRS_PERF_MW_SO_SNDBUF) | ||
| 226 | - #error "SRS_PERF_SO_SNDBUF_SIZE depends on SRS_PERF_MW_SO_SNDBUF" | 215 | +#if VERSION_MAJOR > VERSION_STABLE |
| 216 | + #warning "current branch is not stable, please use stable branch instead." | ||
| 217 | + srs_warn("SRS %s is not stable, please use stable branch %s instead", RTMP_SIG_SRS_VERSION, VERSION_STABLE_BRANCH); | ||
| 227 | #endif | 218 | #endif |
| 228 | 219 | ||
| 229 | -#ifndef SRS_OSX | ||
| 230 | - #if defined(__amd64__) | ||
| 231 | - srs_trace("cpu is amd64, glibc %d.%d", (int)__GLIBC__, (int)__GLIBC_MINOR__); | ||
| 232 | - #endif | ||
| 233 | - #if defined(__x86_64__) | ||
| 234 | - srs_trace("cpu is x86_64, glibc %d.%d", (int)__GLIBC__, (int)__GLIBC_MINOR__); | ||
| 235 | - #endif | ||
| 236 | - #if defined(__i386__) | ||
| 237 | - srs_trace("cpu is i386, glibc %d.%d", (int)__GLIBC__, (int)__GLIBC_MINOR__); | ||
| 238 | - #endif | ||
| 239 | - #if defined(__arm__) | ||
| 240 | - srs_trace("cpu is arm, glibc %d.%d", (int)__GLIBC__, (int)__GLIBC_MINOR__); | ||
| 241 | - #endif | 220 | +#if defined(SRS_PERF_SO_SNDBUF_SIZE) && !defined(SRS_PERF_MW_SO_SNDBUF) |
| 221 | + #error "SRS_PERF_SO_SNDBUF_SIZE depends on SRS_PERF_MW_SO_SNDBUF" | ||
| 242 | #endif | 222 | #endif |
| 243 | } | 223 | } |
| 244 | 224 | ||
| @@ -285,27 +265,23 @@ int main(int argc, char** argv) | @@ -285,27 +265,23 @@ int main(int argc, char** argv) | ||
| 285 | return ret; | 265 | return ret; |
| 286 | } | 266 | } |
| 287 | 267 | ||
| 288 | - // we check the config when the log initialized. | ||
| 289 | - if ((ret = _srs_config->check_config()) != ERROR_SUCCESS) { | ||
| 290 | - return ret; | ||
| 291 | - } | ||
| 292 | - | ||
| 293 | - srs_trace("srs(simple-rtmp-server) "RTMP_SIG_SRS_VERSION); | 268 | + // config already applied to log. |
| 269 | + srs_trace("srs(simple-rtmp-server) "RTMP_SIG_SRS_VERSION", stable is "RTMP_SIG_SRS_PRIMARY); | ||
| 294 | srs_trace("license: "RTMP_SIG_SRS_LICENSE", "RTMP_SIG_SRS_COPYRIGHT); | 270 | srs_trace("license: "RTMP_SIG_SRS_LICENSE", "RTMP_SIG_SRS_COPYRIGHT); |
| 295 | - srs_trace("primary/master: "RTMP_SIG_SRS_PRIMARY); | ||
| 296 | srs_trace("authors: "RTMP_SIG_SRS_AUTHROS); | 271 | srs_trace("authors: "RTMP_SIG_SRS_AUTHROS); |
| 297 | srs_trace("contributors: "SRS_AUTO_CONSTRIBUTORS); | 272 | srs_trace("contributors: "SRS_AUTO_CONSTRIBUTORS); |
| 298 | - srs_trace("uname: "SRS_AUTO_UNAME); | ||
| 299 | - srs_trace("build: %s, %s", SRS_AUTO_BUILD_DATE, srs_is_little_endian()? "little-endian":"big-endian"); | ||
| 300 | - srs_trace("configure: "SRS_AUTO_USER_CONFIGURE); | ||
| 301 | - srs_trace("features: "SRS_AUTO_CONFIGURE); | ||
| 302 | -#ifdef SRS_AUTO_ARM_UBUNTU12 | ||
| 303 | - srs_trace("arm tool chain: "SRS_AUTO_EMBEDED_TOOL_CHAIN); | 273 | + srs_trace("build: %s, configure:%s, uname: %s", SRS_AUTO_BUILD_DATE, SRS_AUTO_USER_CONFIGURE, SRS_AUTO_UNAME); |
| 274 | + srs_trace("configure detail: "SRS_AUTO_CONFIGURE); | ||
| 275 | +#ifdef SRS_AUTO_EMBEDED_TOOL_CHAIN | ||
| 276 | + srs_trace("crossbuild tool chain: "SRS_AUTO_EMBEDED_TOOL_CHAIN); | ||
| 304 | #endif | 277 | #endif |
| 305 | - srs_trace("conf: %s, limit: %d", _srs_config->config().c_str(), _srs_config->get_max_connections()); | 278 | + |
| 279 | + // we check the config when the log initialized. | ||
| 280 | + if ((ret = _srs_config->check_config()) != ERROR_SUCCESS) { | ||
| 281 | + return ret; | ||
| 282 | + } | ||
| 306 | 283 | ||
| 307 | // features | 284 | // features |
| 308 | - check_macro_features(); | ||
| 309 | show_macro_features(); | 285 | show_macro_features(); |
| 310 | 286 | ||
| 311 | /** | 287 | /** |
| @@ -41,7 +41,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -41,7 +41,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 41 | | IBufferReader | | IStatistic | | IBufferWriter | | 41 | | IBufferReader | | IStatistic | | IBufferWriter | |
| 42 | +---------------+ +--------------------+ +---------------+ | 42 | +---------------+ +--------------------+ +---------------+ |
| 43 | | + read() | | + get_recv_bytes() | | + write() | | 43 | | + read() | | + get_recv_bytes() | | + write() | |
| 44 | -+------+--------+ | + get_recv_bytes() | | + writev() | | 44 | ++------+--------+ | + get_send_bytes() | | + writev() | |
| 45 | / \ +---+--------------+-+ +-------+-------+ | 45 | / \ +---+--------------+-+ +-------+-------+ |
| 46 | | / \ / \ / \ | 46 | | / \ / \ / \ |
| 47 | | | | | | 47 | | | | | |
| @@ -58,9 +58,6 @@ VOID TEST(CoreMacroseTest, Check) | @@ -58,9 +58,6 @@ VOID TEST(CoreMacroseTest, Check) | ||
| 58 | #ifndef SRS_AUTO_CONFIGURE | 58 | #ifndef SRS_AUTO_CONFIGURE |
| 59 | EXPECT_TRUE(false); | 59 | EXPECT_TRUE(false); |
| 60 | #endif | 60 | #endif |
| 61 | -#ifndef SRS_AUTO_EMBEDED_TOOL_CHAIN | ||
| 62 | - EXPECT_TRUE(false); | ||
| 63 | -#endif | ||
| 64 | #ifndef SRS_AUTO_PREFIX | 61 | #ifndef SRS_AUTO_PREFIX |
| 65 | EXPECT_TRUE(false); | 62 | EXPECT_TRUE(false); |
| 66 | #endif | 63 | #endif |
-
请 注册 或 登录 后发表评论