winlin

Merge branch 'srs.master'

@@ -228,7 +228,7 @@ Supported operating systems and hardware: @@ -228,7 +228,7 @@ Supported operating systems and hardware:
228 * 2013-10-17, Created.<br/> 228 * 2013-10-17, Created.<br/>
229 229
230 ## History 230 ## History
231 -* v2.0, 2014-11-08, fix [#191](https://github.com/winlinvip/simple-rtmp-server/issues/191), configure --export-librtmp. 2.0.10. 231 +* v2.0, 2014-11-08, fix [#191](https://github.com/winlinvip/simple-rtmp-server/issues/191), configure --export-librtmp-project and --export-librtmp-single. 2.0.11.
232 * v2.0, 2014-11-08, fix [#66](https://github.com/winlinvip/simple-rtmp-server/issues/66), srs-librtmp support write h264 raw packet. 2.0.9. 232 * v2.0, 2014-11-08, fix [#66](https://github.com/winlinvip/simple-rtmp-server/issues/66), srs-librtmp support write h264 raw packet. 2.0.9.
233 * v2.0, 2014-10-25, fix [#185](https://github.com/winlinvip/simple-rtmp-server/issues/185), AMF0 support 0x0B the date type codec. 2.0.7. 233 * v2.0, 2014-10-25, fix [#185](https://github.com/winlinvip/simple-rtmp-server/issues/185), AMF0 support 0x0B the date type codec. 2.0.7.
234 * v2.0, 2014-10-24, fix [#186](https://github.com/winlinvip/simple-rtmp-server/issues/186), hotfix for bug #186, drop connect args when not object. 2.0.6. 234 * v2.0, 2014-10-24, fix [#186](https://github.com/winlinvip/simple-rtmp-server/issues/186), hotfix for bug #186, drop connect args when not object. 2.0.6.
@@ -126,7 +126,7 @@ function Ubuntu_prepare() @@ -126,7 +126,7 @@ function Ubuntu_prepare()
126 return 0 126 return 0
127 } 127 }
128 # donot prepare tools, for srs-librtmp depends only gcc and g++. 128 # donot prepare tools, for srs-librtmp depends only gcc and g++.
129 -if [ $SRS_EXPORT_LIBRTMP = NO ]; then 129 +if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
130 Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Ubuntu prepare failed, ret=$ret"; exit $ret; fi 130 Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Ubuntu prepare failed, ret=$ret"; exit $ret; fi
131 fi 131 fi
132 ##################################################################################### 132 #####################################################################################
@@ -217,14 +217,14 @@ function Centos_prepare() @@ -217,14 +217,14 @@ function Centos_prepare()
217 return 0 217 return 0
218 } 218 }
219 # donot prepare tools, for srs-librtmp depends only gcc and g++. 219 # donot prepare tools, for srs-librtmp depends only gcc and g++.
220 -if [ $SRS_EXPORT_LIBRTMP = NO ]; then 220 +if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
221 Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "CentOS prepare failed, ret=$ret"; exit $ret; fi 221 Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "CentOS prepare failed, ret=$ret"; exit $ret; fi
222 fi 222 fi
223 223
224 ##################################################################################### 224 #####################################################################################
225 # st-1.9 225 # st-1.9
226 ##################################################################################### 226 #####################################################################################
227 -if [ $SRS_EXPORT_LIBRTMP = NO ]; then 227 +if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
228 # check the arm flag file, if flag changed, need to rebuild the st. 228 # check the arm flag file, if flag changed, need to rebuild the st.
229 _ST_MAKE=linux-debug 229 _ST_MAKE=linux-debug
230 if [ $SRS_EMBEDED_CPU = YES ]; then 230 if [ $SRS_EMBEDED_CPU = YES ]; then
@@ -343,7 +343,7 @@ function write_nginx_html5() @@ -343,7 +343,7 @@ function write_nginx_html5()
343 END 343 END
344 } 344 }
345 # create the nginx dir, for http-server if not build nginx 345 # create the nginx dir, for http-server if not build nginx
346 -if [ $SRS_EXPORT_LIBRTMP = NO ]; then 346 +if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
347 mkdir -p ${SRS_OBJS}/nginx 347 mkdir -p ${SRS_OBJS}/nginx
348 fi 348 fi
349 # make nginx 349 # make nginx
@@ -372,7 +372,7 @@ if [ $__SRS_BUILD_NGINX = YES ]; then @@ -372,7 +372,7 @@ if [ $__SRS_BUILD_NGINX = YES ]; then
372 fi 372 fi
373 373
374 # the demo dir. 374 # the demo dir.
375 -if [ $SRS_EXPORT_LIBRTMP = NO ]; then 375 +if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
376 # create forward dir 376 # create forward dir
377 mkdir -p ${SRS_OBJS}/nginx/html/live && 377 mkdir -p ${SRS_OBJS}/nginx/html/live &&
378 mkdir -p ${SRS_OBJS}/nginx/html/forward/live 378 mkdir -p ${SRS_OBJS}/nginx/html/forward/live
@@ -595,7 +595,7 @@ fi @@ -595,7 +595,7 @@ fi
595 ##################################################################################### 595 #####################################################################################
596 # build research code, librtmp 596 # build research code, librtmp
597 ##################################################################################### 597 #####################################################################################
598 -if [ $SRS_EXPORT_LIBRTMP = NO ]; then 598 +if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
599 if [ $SRS_RESEARCH = YES ]; then 599 if [ $SRS_RESEARCH = YES ]; then
600 mkdir -p ${SRS_OBJS}/research 600 mkdir -p ${SRS_OBJS}/research
601 601
  1 +#!/bin/bash
  2 +
  3 +# when export srs-librtmp project
  4 +# set the SRS_WORKDIR and SRS_OBJS,
  5 +# then copy the srs-librtmp needed files.
  6 +#
  7 +# params:
  8 +# $SRS_WORKDIR the work dir. ie. .
  9 +# $SRS_OBJS the objs directory to store the Makefile. ie. ./objs
  10 +# $SRS_OBJS_DIR the objs directory for Makefile. ie. objs
  11 +# $SRS_EXPORT_LIBRTMP_PROJECT the export srs-librtmp project path. ie. srs-librtmp
  12 +#
  13 +
  14 +if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
  15 + if [[ -d ${SRS_EXPORT_LIBRTMP_PROJECT} ]]; then
  16 + echo -e "${RED}srs-librtmp target dir exists: ${SRS_EXPORT_LIBRTMP_PROJECT}. ${BLACK}"
  17 + exit 1
  18 + fi
  19 + # create target
  20 + SRS_WORKDIR=${SRS_EXPORT_LIBRTMP_PROJECT} && SRS_OBJS=${SRS_WORKDIR}/${SRS_OBJS_DIR} && mkdir -p ${SRS_OBJS} &&
  21 + # copy src to target
  22 + _CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/research/librtmp && mkdir -p ${_CPT} && cp research/librtmp/*.c research/librtmp/Makefile ${_CPT} &&
  23 + _CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/auto && mkdir -p ${_CPT} && cp auto/generate_header.sh auto/generate-srs-librtmp-single.sh ${_CPT} &&
  24 + _CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/src/core && mkdir -p ${_CPT} && cp src/core/* ${_CPT} &&
  25 + _CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/src/kernel && mkdir -p ${_CPT} && cp src/kernel/* ${_CPT} &&
  26 + _CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/src/rtmp && mkdir -p ${_CPT} && cp src/rtmp/* ${_CPT} &&
  27 + _CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/src/libs && mkdir -p ${_CPT} && cp src/libs/* ${_CPT}
  28 + # check ret
  29 + ret=$?; if [[ $ret -ne 0 ]]; then echo "export src failed, ret=$ret"; exit $ret; fi
  30 +fi
  1 +#!/bin/bash
  2 +
  3 +# when export srs-librtmp single files
  4 +# package the whole project to srs_librtmp.h and srs_librtmp.cpp
  5 +#
  6 +# params:
  7 +# $SRS_OBJS_DIR the objs directory for Makefile. ie. objs
  8 +# $SRS_EXPORT_LIBRTMP_SINGLE the export srs-librtmp single path. ie. srs-librtmp
  9 +#
  10 +
  11 +# the target dir must created
  12 +if [[ ! -d $SRS_EXPORT_LIBRTMP_SINGLE ]]; then
  13 + echo -e "${RED}error, target dir not created: $SRS_EXPORT_LIBRTMP_SINGLE${BLACK}"
  14 + exit -1
  15 +fi
  16 +
  17 +# generate the srs_librtmp.h
  18 +cp $SRS_EXPORT_LIBRTMP_SINGLE/src/libs/srs_librtmp.hpp $SRS_EXPORT_LIBRTMP_SINGLE/srs_librtmp.h
  19 +
  20 +# create srs_librtmp.cpp
  21 +FILE=$SRS_EXPORT_LIBRTMP_SINGLE/srs_librtmp.cpp
  22 +cat << END >$FILE
  23 +/*
  24 +The MIT License (MIT)
  25 +
  26 +Copyright (c) 2013-2014 winlin
  27 +
  28 +Permission is hereby granted, free of charge, to any person obtaining a copy of
  29 +this software and associated documentation files (the "Software"), to deal in
  30 +the Software without restriction, including without limitation the rights to
  31 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  32 +the Software, and to permit persons to whom the Software is furnished to do so,
  33 +subject to the following conditions:
  34 +
  35 +The above copyright notice and this permission notice shall be included in all
  36 +copies or substantial portions of the Software.
  37 +
  38 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  40 +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  41 +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  42 +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  43 +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  44 +*/
  45 +
  46 +#include "srs_librtmp.h"
  47 +
  48 +END
  49 +# build objs auto files to cpp
  50 +cat $SRS_EXPORT_LIBRTMP_SINGLE/$SRS_OBJS_DIR/srs_auto_headers.hpp >>$FILE
  51 +ret=$?; if [[ $ret -ne 0 ]]; then
  52 + echo -e "${RED}failed to generate the srs_librtmp.cpp${BLACK}"
  53 + exit $ret
  54 +fi
  55 +# module to cpp files.
  56 +function build_module_hpp()
  57 +{
  58 + echo "build files ${SRS_LIBRTMP_OBJS} to $FILE"
  59 + for item in ${SRS_LIBRTMP_OBJS[*]}; do
  60 + FILE_NAME="${item%.*}"
  61 + echo "// following is generated by ${FILE_NAME}.hpp" >> $FILE &&
  62 + sed -i "s|#include <srs_|//#include <srs_|g" $SRS_EXPORT_LIBRTMP_SINGLE/${FILE_NAME}.hpp &&
  63 + cat $SRS_EXPORT_LIBRTMP_SINGLE/${FILE_NAME}.hpp >>$FILE
  64 + ret=$?; if [[ $ret -ne 0 ]]; then
  65 + echo -e "${RED}failed to generate the srs_librtmp.cpp by ${FILE_NAME}.hpp. {${BLACK}"
  66 + exit $ret
  67 + fi
  68 + done
  69 +}
  70 +SRS_LIBRTMP_OBJS="${CORE_OBJS[@]}" && build_module_hpp
  71 +SRS_LIBRTMP_OBJS="${KERNEL_OBJS[@]}" && build_module_hpp
  72 +SRS_LIBRTMP_OBJS="${RTMP_OBJS[@]}" && build_module_hpp
  73 +SRS_LIBRTMP_OBJS="${LIBS_OBJS[@]}" && build_module_hpp
  74 +# module to cpp files.
  75 +function build_module_cpp()
  76 +{
  77 + echo "build files ${SRS_LIBRTMP_OBJS} to $FILE"
  78 + for item in ${SRS_LIBRTMP_OBJS[*]}; do
  79 + FILE_NAME="${item%.*}"
  80 + echo "// following is generated by ${FILE_NAME}.cpp" >> $FILE &&
  81 + sed -i "s|#include <srs_|//#include <srs_|g" $SRS_EXPORT_LIBRTMP_SINGLE/${FILE_NAME}.cpp &&
  82 + cat $SRS_EXPORT_LIBRTMP_SINGLE/${FILE_NAME}.cpp >>$FILE
  83 + ret=$?; if [[ $ret -ne 0 ]]; then
  84 + echo -e "${RED}failed to generate the srs_librtmp.cpp by ${FILE_NAME}.cpp. {${BLACK}"
  85 + exit $ret
  86 + fi
  87 + done
  88 +}
  89 +SRS_LIBRTMP_OBJS="${CORE_OBJS[@]}" && build_module_cpp
  90 +SRS_LIBRTMP_OBJS="${KERNEL_OBJS[@]}" && build_module_cpp
  91 +SRS_LIBRTMP_OBJS="${RTMP_OBJS[@]}" && build_module_cpp
  92 +SRS_LIBRTMP_OBJS="${LIBS_OBJS[@]}" && build_module_cpp
  93 +
  94 +# create example.cpp
  95 +FILE=$SRS_EXPORT_LIBRTMP_SINGLE/example.c
  96 +COMPILE='gcc example.c srs_librtmp.cpp -g -O0 -lstdc++ -o example'
  97 +cat << END >$FILE
  98 +/**
  99 +# Example to use srs-librtmp
  100 +# see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_SrsLibrtmp
  101 +${COMPILE}
  102 +*/
  103 +#include <stdio.h>
  104 +#include "srs_librtmp.h"
  105 +
  106 +int main(int argc, char** argv)
  107 +{
  108 + printf("Example for srs-librtmp\n");
  109 + printf("SRS(simple-rtmp-server) client librtmp library.\n");
  110 + printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision());
  111 +
  112 + srs_rtmp_t rtmp = srs_rtmp_create("rtmp://ossrs.net/live/livestream");
  113 + srs_trace("create rtmp success");
  114 + srs_rtmp_destroy(rtmp);
  115 +
  116 + return 0;
  117 +}
  118 +
  119 +END
  120 +
  121 +# compile the example
  122 +(cd $SRS_EXPORT_LIBRTMP_SINGLE && `${COMPILE}` && ./example && rm -f example)
  123 +ret=$?; if [[ $ret -ne 0 ]]; then
  124 + echo "(cd $SRS_EXPORT_LIBRTMP_SINGLE && ${COMPILE} && ./example && rm -f example)"
  125 + echo -e "${RED}failed to compile example.${BLACK}"
  126 + exit $ret
  127 +fi
  128 +
  129 +# clear the files for srs-librtmp project, generated by generate-srs-librtmp-project.sh
  130 +(cd $SRS_EXPORT_LIBRTMP_SINGLE && rm -rf auto $SRS_OBJS_DIR research src Makefile)
@@ -58,8 +58,10 @@ SRS_LOG_TRACE=RESERVED @@ -58,8 +58,10 @@ SRS_LOG_TRACE=RESERVED
58 # experts 58 # experts
59 # donot compile ssl, use system ssl(-lssl) if required. 59 # donot compile ssl, use system ssl(-lssl) if required.
60 SRS_USE_SYS_SSL=NO 60 SRS_USE_SYS_SSL=NO
61 -# export the srs-librtmp to specified path, NO to disable it.  
62 -SRS_EXPORT_LIBRTMP=NO 61 +# export the srs-librtmp to specified project, NO to disable it.
  62 +SRS_EXPORT_LIBRTMP_PROJECT=NO
  63 +# export the srs-librtmp to a single .h and .c, NO to disable it.
  64 +SRS_EXPORT_LIBRTMP_SINGLE=NO
63 # 65 #
64 ################################################################ 66 ################################################################
65 # presets 67 # presets
@@ -184,7 +186,8 @@ Conflicts: @@ -184,7 +186,8 @@ Conflicts:
184 186
185 Experts: 187 Experts:
186 --use-sys-ssl donot compile ssl, use system ssl(-lssl) if required. 188 --use-sys-ssl donot compile ssl, use system ssl(-lssl) if required.
187 - --export-librtmp=<path> export srs-librtmp to specified path. 189 + --export-librtmp-project=<path> export srs-librtmp to specified project in path.
  190 + --export-librtmp-single=<path> export srs-librtmp to a single file(.h+.cpp) in path.
188 191
189 Workflow: 192 Workflow:
190 1. apply "Presets". if not specified, use default preset. 193 1. apply "Presets". if not specified, use default preset.
@@ -266,7 +269,8 @@ function parse_user_option() { @@ -266,7 +269,8 @@ function parse_user_option() {
266 --full) SRS_ENABLE_ALL=YES ;; 269 --full) SRS_ENABLE_ALL=YES ;;
267 270
268 --use-sys-ssl) SRS_USE_SYS_SSL=YES ;; 271 --use-sys-ssl) SRS_USE_SYS_SSL=YES ;;
269 - --export-librtmp) SRS_EXPORT_LIBRTMP=${value} ;; 272 + --export-librtmp-project) SRS_EXPORT_LIBRTMP_PROJECT=${value} ;;
  273 + --export-librtmp-single) SRS_EXPORT_LIBRTMP_SINGLE=${value} ;;
270 274
271 *) 275 *)
272 echo "$0: error: invalid option \"$option\"" 276 echo "$0: error: invalid option \"$option\""
@@ -701,8 +705,13 @@ function apply_user_detail_options() { @@ -701,8 +705,13 @@ function apply_user_detail_options() {
701 export SRS_JOBS="--jobs=${SRS_JOBS}" 705 export SRS_JOBS="--jobs=${SRS_JOBS}"
702 fi 706 fi
703 707
  708 + # if specified export single file, export project first.
  709 + if [ $SRS_EXPORT_LIBRTMP_SINGLE != NO ]; then
  710 + SRS_EXPORT_LIBRTMP_PROJECT=$SRS_EXPORT_LIBRTMP_SINGLE
  711 + fi
  712 +
704 # disable almost all features for export srs-librtmp. 713 # disable almost all features for export srs-librtmp.
705 - if [ $SRS_EXPORT_LIBRTMP != NO ]; then 714 + if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
706 SRS_HLS=NO 715 SRS_HLS=NO
707 SRS_DVR=NO 716 SRS_DVR=NO
708 SRS_NGINX=NO 717 SRS_NGINX=NO
@@ -21,7 +21,7 @@ SrsGperfMPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_MP = YES ]; then @@ -21,7 +21,7 @@ SrsGperfMPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_MP = YES ]; then
21 SrsGperfCPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_CP = YES ]; then SrsGperfCPSummaryColor="\${YELLOW}"; fi 21 SrsGperfCPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_CP = YES ]; then SrsGperfCPSummaryColor="\${YELLOW}"; fi
22 SrsGprofSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPROF = YES ]; then SrsGprofSummaryColor="\${YELLOW}"; fi 22 SrsGprofSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPROF = YES ]; then SrsGprofSummaryColor="\${YELLOW}"; fi
23 23
24 -if [ $SRS_EXPORT_LIBRTMP = NO ]; then 24 +if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
25 cat <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY} 25 cat <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
26 #!/bin/bash 26 #!/bin/bash
27 27
@@ -25,30 +25,14 @@ BLACK="\\e[0m" @@ -25,30 +25,14 @@ BLACK="\\e[0m"
25 . auto/options.sh 25 . auto/options.sh
26 26
27 # for export srs-librtmp, change target to it. 27 # for export srs-librtmp, change target to it.
28 -if [ $SRS_EXPORT_LIBRTMP != NO ]; then  
29 - if [[ -d ${SRS_EXPORT_LIBRTMP} ]]; then  
30 - echo -e "${RED}srs-librtmp target dir exists: ${SRS_EXPORT_LIBRTMP}. ${BLACK}"  
31 - exit 1  
32 - fi  
33 - # create target  
34 - SRS_WORKDIR=${SRS_EXPORT_LIBRTMP} && SRS_OBJS=${SRS_WORKDIR}/${SRS_OBJS_DIR} && mkdir -p ${SRS_OBJS} &&  
35 - # copy src to target  
36 - _CPT=${SRS_EXPORT_LIBRTMP}/research/librtmp && mkdir -p ${_CPT} && cp research/librtmp/*.c research/librtmp/Makefile ${_CPT} &&  
37 - _CPT=${SRS_EXPORT_LIBRTMP}/auto && mkdir -p ${_CPT} && cp auto/generate_header.sh ${_CPT} &&  
38 - _CPT=${SRS_EXPORT_LIBRTMP}/src/core && mkdir -p ${_CPT} && cp src/core/* ${_CPT} &&  
39 - _CPT=${SRS_EXPORT_LIBRTMP}/src/kernel && mkdir -p ${_CPT} && cp src/kernel/* ${_CPT} &&  
40 - _CPT=${SRS_EXPORT_LIBRTMP}/src/rtmp && mkdir -p ${_CPT} && cp src/rtmp/* ${_CPT} &&  
41 - _CPT=${SRS_EXPORT_LIBRTMP}/src/libs && mkdir -p ${_CPT} && cp src/libs/* ${_CPT}  
42 - # check ret  
43 - ret=$?; if [[ $ret -ne 0 ]]; then echo "export src failed, ret=$ret"; exit $ret; fi  
44 -fi 28 +. auto/generate-srs-librtmp-project.sh
45 29
46 # the auto generated variables. 30 # the auto generated variables.
47 SRS_AUTO_HEADERS_H="${SRS_OBJS}/srs_auto_headers.hpp" 31 SRS_AUTO_HEADERS_H="${SRS_OBJS}/srs_auto_headers.hpp"
48 32
49 # clean the exists, when not export srs-librtmp. 33 # clean the exists, when not export srs-librtmp.
50 # do this only when the options is ok. 34 # do this only when the options is ok.
51 -if [ $SRS_EXPORT_LIBRTMP = NO ]; then 35 +if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
52 if [[ -f Makefile ]]; then 36 if [[ -f Makefile ]]; then
53 make clean 37 make clean
54 fi 38 fi
@@ -186,7 +170,7 @@ clean: @@ -186,7 +170,7 @@ clean:
186 END 170 END
187 171
188 # if export librtmp, donot build the srs server. 172 # if export librtmp, donot build the srs server.
189 -if [ $SRS_EXPORT_LIBRTMP != NO ]; then 173 +if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
190 cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE} 174 cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
191 server: _prepare_dir 175 server: _prepare_dir
192 @echo "donot build the srs(simple rtmp server) for srs-librtmp" 176 @echo "donot build the srs(simple rtmp server) for srs-librtmp"
@@ -202,7 +186,7 @@ END @@ -202,7 +186,7 @@ END
202 fi 186 fi
203 187
204 # disable install entry for srs-librtmp 188 # disable install entry for srs-librtmp
205 -if [ $SRS_EXPORT_LIBRTMP != NO ]; then 189 +if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
206 cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE} 190 cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
207 uninstall: 191 uninstall:
208 @echo "disable uninstall for srs-librtmp" 192 @echo "disable uninstall for srs-librtmp"
@@ -395,7 +379,7 @@ RTMP_INCS="src/rtmp"; MODULE_DIR=${RTMP_INCS} . auto/modules.sh @@ -395,7 +379,7 @@ RTMP_INCS="src/rtmp"; MODULE_DIR=${RTMP_INCS} . auto/modules.sh
395 RTMP_OBJS="${MODULE_OBJS[@]}" 379 RTMP_OBJS="${MODULE_OBJS[@]}"
396 # 380 #
397 #App Module 381 #App Module
398 -if [ $SRS_EXPORT_LIBRTMP = NO ]; then 382 +if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
399 MODULE_ID="APP" 383 MODULE_ID="APP"
400 MODULE_DEPENDS=("CORE" "KERNEL" "RTMP") 384 MODULE_DEPENDS=("CORE" "KERNEL" "RTMP")
401 ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot} ${SRS_OBJS_DIR}) 385 ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot} ${SRS_OBJS_DIR})
@@ -418,7 +402,7 @@ LIBS_INCS="src/libs"; MODULE_DIR=${LIBS_INCS} . auto/modules.sh @@ -418,7 +402,7 @@ LIBS_INCS="src/libs"; MODULE_DIR=${LIBS_INCS} . auto/modules.sh
418 LIBS_OBJS="${MODULE_OBJS[@]}" 402 LIBS_OBJS="${MODULE_OBJS[@]}"
419 # 403 #
420 #Main Module 404 #Main Module
421 -if [ $SRS_EXPORT_LIBRTMP = NO ]; then 405 +if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
422 MODULE_ID="MAIN" 406 MODULE_ID="MAIN"
423 MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP") 407 MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP")
424 ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot}) 408 ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot})
@@ -432,7 +416,7 @@ fi @@ -432,7 +416,7 @@ fi
432 # then link to a binary, for example, objs/srs 416 # then link to a binary, for example, objs/srs
433 # 417 #
434 # disable all app when export librtmp 418 # disable all app when export librtmp
435 -if [ $SRS_EXPORT_LIBRTMP = NO ]; then 419 +if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
436 # all main entrances 420 # all main entrances
437 MAIN_ENTRANCES=("srs_main_server") 421 MAIN_ENTRANCES=("srs_main_server")
438 # 422 #
@@ -464,13 +448,27 @@ if [ $SRS_UTEST = YES ]; then @@ -464,13 +448,27 @@ if [ $SRS_UTEST = YES ]; then
464 LINK_OPTIONS="-lpthread ${SrsLinkOptions}" MODULE_DIR="src/utest" APP_NAME="srs_utest" . auto/utest.sh 448 LINK_OPTIONS="-lpthread ${SrsLinkOptions}" MODULE_DIR="src/utest" APP_NAME="srs_utest" . auto/utest.sh
465 fi 449 fi
466 450
  451 +# for srs-librtmp single file,
  452 +# package the whole project to srs_librtmp.h and srs_librtmp.cpp
  453 +if [ $SRS_EXPORT_LIBRTMP_SINGLE != NO ]; then
  454 + echo "package the whole project to srs_librtmp.h and srs_librtmp.cpp"
  455 + . $SRS_EXPORT_LIBRTMP_SINGLE/auto/generate-srs-librtmp-single.sh
  456 + echo -e "${GREEN}Please use the srs-librtmp files: ${BLACK}"
  457 + echo -e "${GREEN} $SRS_EXPORT_LIBRTMP_PROJECT/srs_librtmp.h ${BLACK}"
  458 + echo -e "${GREEN} $SRS_EXPORT_LIBRTMP_PROJECT/srs_librtmp.cpp ${BLACK}"
  459 + echo -e "${GREEN} $SRS_EXPORT_LIBRTMP_PROJECT/example.c ${BLACK}"
  460 +elif [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
  461 + echo -e "${GREEN}Please use the srs-librtmp project: ${BLACK}"
  462 + echo -e "${GREEN} cd $SRS_EXPORT_LIBRTMP_PROJECT && make ${BLACK}"
  463 +fi
  464 +
467 echo 'configure ok! ' 465 echo 'configure ok! '
468 466
469 ##################################################################################### 467 #####################################################################################
470 # when configure success, prepare build 468 # when configure success, prepare build
471 ##################################################################################### 469 #####################################################################################
472 # create objs/logs for ffmpeg to write log. 470 # create objs/logs for ffmpeg to write log.
473 -if [ $SRS_EXPORT_LIBRTMP = NO ]; then 471 +if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
474 mkdir -p ${SRS_OBJS}/logs 472 mkdir -p ${SRS_OBJS}/logs
475 fi 473 fi
476 474
@@ -478,127 +476,131 @@ fi @@ -478,127 +476,131 @@ fi
478 # configure summary 476 # configure summary
479 ##################################################################################### 477 #####################################################################################
480 # summary 478 # summary
481 -echo ""  
482 -echo "configure summary:"  
483 -echo " ${SRS_AUTO_USER_CONFIGURE}"  
484 -echo " ${SRS_AUTO_CONFIGURE}"  
485 -if [ $SRS_HLS = YES ]; then 479 +if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
  480 + echo ""
  481 + echo "configure summary:"
  482 + echo " ${SRS_AUTO_USER_CONFIGURE}"
  483 + echo " ${SRS_AUTO_CONFIGURE}"
  484 + if [ $SRS_HLS = YES ]; then
486 echo -e "${GREEN}HLS is enabled${BLACK}" 485 echo -e "${GREEN}HLS is enabled${BLACK}"
487 -else 486 + else
488 echo -e "${YELLOW}warning: without HLS support${BLACK}" 487 echo -e "${YELLOW}warning: without HLS support${BLACK}"
489 -fi  
490 -if [ $SRS_NGINX = YES ]; then 488 + fi
  489 + if [ $SRS_NGINX = YES ]; then
491 echo -e "${GREEN}Nginx http server is enabled${BLACK}" 490 echo -e "${GREEN}Nginx http server is enabled${BLACK}"
492 -else 491 + else
493 echo -e "${GREEN}note: Nginx http server is disabled${BLACK}" 492 echo -e "${GREEN}note: Nginx http server is disabled${BLACK}"
494 -fi  
495 -if [ $SRS_DVR = YES ]; then 493 + fi
  494 + if [ $SRS_DVR = YES ]; then
496 echo -e "${GREEN}DVR is enabled${BLACK}" 495 echo -e "${GREEN}DVR is enabled${BLACK}"
497 -else 496 + else
498 echo -e "${YELLOW}warning: without DVR support${BLACK}" 497 echo -e "${YELLOW}warning: without DVR support${BLACK}"
499 -fi  
500 -if [ $SRS_SSL = YES ]; then 498 + fi
  499 + if [ $SRS_SSL = YES ]; then
501 echo -e "${GREEN}rtmp complex handshake is enabled${BLACK}" 500 echo -e "${GREEN}rtmp complex handshake is enabled${BLACK}"
502 -else 501 + else
503 echo -e "${YELLOW}warning: without rtmp complex handshake support, donot support h264/aac to adobe flash player${BLACK}" 502 echo -e "${YELLOW}warning: without rtmp complex handshake support, donot support h264/aac to adobe flash player${BLACK}"
504 -fi  
505 -if [ $SRS_FFMPEG_TOOL = YES ]; then 503 + fi
  504 + if [ $SRS_FFMPEG_TOOL = YES ]; then
506 echo -e "${GREEN}transcode/mux/ingest tool FFMPEG is enabled${BLACK}" 505 echo -e "${GREEN}transcode/mux/ingest tool FFMPEG is enabled${BLACK}"
507 -else 506 + else
508 echo -e "${YELLOW}warning: without transcode/mux/ingest tool FFMPEG support${BLACK}" 507 echo -e "${YELLOW}warning: without transcode/mux/ingest tool FFMPEG support${BLACK}"
509 -fi  
510 -if [ $SRS_TRANSCODE = YES ]; then 508 + fi
  509 + if [ $SRS_TRANSCODE = YES ]; then
511 echo -e "${GREEN}transcoding RTMP stream is enabled${BLACK}" 510 echo -e "${GREEN}transcoding RTMP stream is enabled${BLACK}"
512 -else 511 + else
513 echo -e "${YELLOW}warning: without transcoding RTMP stream support${BLACK}" 512 echo -e "${YELLOW}warning: without transcoding RTMP stream support${BLACK}"
514 -fi  
515 -if [ $SRS_INGEST = YES ]; then 513 + fi
  514 + if [ $SRS_INGEST = YES ]; then
516 echo -e "${GREEN}ingest file/stream/device is enabled${BLACK}" 515 echo -e "${GREEN}ingest file/stream/device is enabled${BLACK}"
517 -else 516 + else
518 echo -e "${YELLOW}warning: without ingest file/stream/device support${BLACK}" 517 echo -e "${YELLOW}warning: without ingest file/stream/device support${BLACK}"
519 -fi  
520 -if [ $SRS_HTTP_CALLBACK = YES ]; then 518 + fi
  519 + if [ $SRS_HTTP_CALLBACK = YES ]; then
521 echo -e "${GREEN}http hooks callback over CherryPy is enabled${BLACK}" 520 echo -e "${GREEN}http hooks callback over CherryPy is enabled${BLACK}"
522 -else 521 + else
523 echo -e "${YELLOW}warning: without http hooks callback over CherryPy support${BLACK}" 522 echo -e "${YELLOW}warning: without http hooks callback over CherryPy support${BLACK}"
524 -fi  
525 -if [ $SRS_HTTP_SERVER = YES ]; then 523 + fi
  524 + if [ $SRS_HTTP_SERVER = YES ]; then
526 echo -e "${GREEN}http server to delivery http stream is enabled${BLACK}" 525 echo -e "${GREEN}http server to delivery http stream is enabled${BLACK}"
527 -else 526 + else
528 echo -e "${YELLOW}warning: without http server to delivery http stream support${BLACK}" 527 echo -e "${YELLOW}warning: without http server to delivery http stream support${BLACK}"
529 -fi  
530 -if [ $SRS_HTTP_API = YES ]; then 528 + fi
  529 + if [ $SRS_HTTP_API = YES ]; then
531 echo -e "${GREEN}http api to manage server is enabled${BLACK}" 530 echo -e "${GREEN}http api to manage server is enabled${BLACK}"
532 -else 531 + else
533 echo -e "${YELLOW}warning: without http api to manage server support${BLACK}" 532 echo -e "${YELLOW}warning: without http api to manage server support${BLACK}"
534 -fi  
535 -if [ $SRS_LIBRTMP = YES ]; then 533 + fi
  534 + if [ $SRS_LIBRTMP = YES ]; then
536 echo -e "${GREEN}srs-librtmp for client is enabled${BLACK}" 535 echo -e "${GREEN}srs-librtmp for client is enabled${BLACK}"
537 -else 536 + else
538 echo -e "${YELLOW}note: srs-librtmp for client is disabled${BLACK}" 537 echo -e "${YELLOW}note: srs-librtmp for client is disabled${BLACK}"
539 -fi  
540 -if [ $SRS_RESEARCH = YES ]; then 538 + fi
  539 + if [ $SRS_RESEARCH = YES ]; then
541 echo -e "${GREEN}research tools are builded${BLACK}" 540 echo -e "${GREEN}research tools are builded${BLACK}"
542 -else 541 + else
543 echo -e "${GREEN}note: research tools are not builded${BLACK}" 542 echo -e "${GREEN}note: research tools are not builded${BLACK}"
544 -fi  
545 -if [ $SRS_UTEST = YES ]; then 543 + fi
  544 + if [ $SRS_UTEST = YES ]; then
546 echo -e "${GREEN}utest for srs are builded${BLACK}" 545 echo -e "${GREEN}utest for srs are builded${BLACK}"
547 -else 546 + else
548 echo -e "${YELLOW}note: utest for srs are not builded${BLACK}" 547 echo -e "${YELLOW}note: utest for srs are not builded${BLACK}"
549 -fi  
550 -if [ $SRS_GPERF = YES ]; then 548 + fi
  549 + if [ $SRS_GPERF = YES ]; then
551 echo -e "${GREEN}gperf(tcmalloc) for srs are builded${BLACK}" 550 echo -e "${GREEN}gperf(tcmalloc) for srs are builded${BLACK}"
552 -else 551 + else
553 echo -e "${GREEN}note: gperf(tcmalloc) for srs are not builded${BLACK}" 552 echo -e "${GREEN}note: gperf(tcmalloc) for srs are not builded${BLACK}"
554 -fi  
555 -if [ $SRS_GPERF_MC = YES ]; then 553 + fi
  554 + if [ $SRS_GPERF_MC = YES ]; then
556 echo -e "${YELLOW}gmc(gperf memory check) for srs are builded -- Performance may suffer${BLACK}" 555 echo -e "${YELLOW}gmc(gperf memory check) for srs are builded -- Performance may suffer${BLACK}"
557 -else 556 + else
558 echo -e "${GREEN}note: gmc(gperf memory check) for srs are not builded${BLACK}" 557 echo -e "${GREEN}note: gmc(gperf memory check) for srs are not builded${BLACK}"
559 -fi  
560 -if [ $SRS_GPERF_MP = YES ]; then 558 + fi
  559 + if [ $SRS_GPERF_MP = YES ]; then
561 echo -e "${YELLOW}gmp(gperf memory profile) for srs are builded -- Performance may suffer${BLACK}" 560 echo -e "${YELLOW}gmp(gperf memory profile) for srs are builded -- Performance may suffer${BLACK}"
562 -else 561 + else
563 echo -e "${GREEN}note: gmp(gperf memory profile) for srs are not builded${BLACK}" 562 echo -e "${GREEN}note: gmp(gperf memory profile) for srs are not builded${BLACK}"
564 -fi  
565 -if [ $SRS_GPERF_CP = YES ]; then 563 + fi
  564 + if [ $SRS_GPERF_CP = YES ]; then
566 echo -e "${YELLOW}gcp(gperf cpu profile) for srs are builded -- Performance may suffer${BLACK}" 565 echo -e "${YELLOW}gcp(gperf cpu profile) for srs are builded -- Performance may suffer${BLACK}"
567 -else 566 + else
568 echo -e "${GREEN}note: gcp(gperf cpu profile) for srs are not builded${BLACK}" 567 echo -e "${GREEN}note: gcp(gperf cpu profile) for srs are not builded${BLACK}"
569 -fi  
570 -if [ $SRS_GPROF = YES ]; then 568 + fi
  569 + if [ $SRS_GPROF = YES ]; then
571 echo -e "${YELLOW}gprof(GNU profile tool) for srs are builded -- Performance may suffer${BLACK}" 570 echo -e "${YELLOW}gprof(GNU profile tool) for srs are builded -- Performance may suffer${BLACK}"
572 -else 571 + else
573 echo -e "${GREEN}note: gprof(GNU profile tool) for srs are not builded${BLACK}" 572 echo -e "${GREEN}note: gprof(GNU profile tool) for srs are not builded${BLACK}"
574 -fi  
575 -if [ $SRS_ARM_UBUNTU12 = YES ]; then 573 + fi
  574 + if [ $SRS_ARM_UBUNTU12 = YES ]; then
576 echo -e "${GREEN}arm-ubuntu12(armhf, v7cpu) for srs are builded${BLACK}" 575 echo -e "${GREEN}arm-ubuntu12(armhf, v7cpu) for srs are builded${BLACK}"
577 -else 576 + else
578 echo -e "${GREEN}note: arm-ubuntu12(armhf, v7cpu) for srs are not builded${BLACK}" 577 echo -e "${GREEN}note: arm-ubuntu12(armhf, v7cpu) for srs are not builded${BLACK}"
579 -fi  
580 -if [ $SRS_MIPS_UBUNTU12 = YES ]; then 578 + fi
  579 + if [ $SRS_MIPS_UBUNTU12 = YES ]; then
581 echo -e "${GREEN}mips-ubuntu12 for srs are builded${BLACK}" 580 echo -e "${GREEN}mips-ubuntu12 for srs are builded${BLACK}"
582 -else 581 + else
583 echo -e "${GREEN}note: mips-ubuntu12 for srs are not builded${BLACK}" 582 echo -e "${GREEN}note: mips-ubuntu12 for srs are not builded${BLACK}"
  583 + fi
584 fi 584 fi
585 585
586 ##################################################################################### 586 #####################################################################################
587 # next step 587 # next step
588 ##################################################################################### 588 #####################################################################################
589 -ip=`ifconfig|grep "inet addr"| grep -v "127.0.0.1"|awk '{print $2}'|awk -F ':' 'NR==1 {print $2}'`  
590 -echo ""  
591 -echo "to run 3rdparty application:"  
592 -if [ $SRS_NGINX = YES ]; then 589 +if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
  590 + ip=`ifconfig|grep "inet addr"| grep -v "127.0.0.1"|awk '{print $2}'|awk -F ':' 'NR==1 {print $2}'`
  591 + echo ""
  592 + echo "to run 3rdparty application:"
  593 + if [ $SRS_NGINX = YES ]; then
593 echo "\" sudo ./objs/nginx/sbin/nginx \" to start the nginx http server for hls" 594 echo "\" sudo ./objs/nginx/sbin/nginx \" to start the nginx http server for hls"
594 -fi  
595 -if [ $SRS_FFMPEG_TOOL = YES ]; then 595 + fi
  596 + if [ $SRS_FFMPEG_TOOL = YES ]; then
596 echo -e "\" ./objs/ffmpeg/bin/ffmpeg \" is used for live stream transcoding" 597 echo -e "\" ./objs/ffmpeg/bin/ffmpeg \" is used for live stream transcoding"
597 -fi  
598 -if [ $SRS_HTTP_CALLBACK = YES ]; then 598 + fi
  599 + if [ $SRS_HTTP_CALLBACK = YES ]; then
599 echo -e "\" python ./research/api-server/server.py 8085 \" to start the api-server" 600 echo -e "\" python ./research/api-server/server.py 8085 \" to start the api-server"
  601 + fi
  602 + echo ""
  603 + echo "to build:"
  604 + echo "\" make \" to build the srs(simple rtmp server)."
  605 + echo "\" make help \" to get the usage of make"
600 fi 606 fi
601 -echo ""  
602 -echo "to build:"  
603 -echo "\" make \" to build the srs(simple rtmp server)."  
604 -echo "\" make help \" to get the usage of make"  
@@ -80,31 +80,31 @@ int main(int argc, char** argv) @@ -80,31 +80,31 @@ int main(int argc, char** argv)
80 80
81 rtmp = srs_rtmp_create2(argv[1]); 81 rtmp = srs_rtmp_create2(argv[1]);
82 82
83 - srs_trace("bandwidth check/test url: %s", argv[1]); 83 + srs_lib_trace("bandwidth check/test url: %s", argv[1]);
84 84
85 if ((ret = srs_simple_handshake(rtmp)) != 0) { 85 if ((ret = srs_simple_handshake(rtmp)) != 0) {
86 - srs_trace("simple handshake failed."); 86 + srs_lib_trace("simple handshake failed.");
87 goto rtmp_destroy; 87 goto rtmp_destroy;
88 } 88 }
89 - srs_trace("simple handshake success"); 89 + srs_lib_trace("simple handshake success");
90 90
91 if ((ret = srs_connect_app2(rtmp, 91 if ((ret = srs_connect_app2(rtmp,
92 srs_server_ip, srs_server, srs_primary_authors, srs_version, &srs_id, &srs_pid)) != 0) { 92 srs_server_ip, srs_server, srs_primary_authors, srs_version, &srs_id, &srs_pid)) != 0) {
93 - srs_trace("connect vhost/app failed."); 93 + srs_lib_trace("connect vhost/app failed.");
94 goto rtmp_destroy; 94 goto rtmp_destroy;
95 } 95 }
96 - srs_trace("connect vhost/app success"); 96 + srs_lib_trace("connect vhost/app success");
97 97
98 if ((ret = srs_bandwidth_check(rtmp, 98 if ((ret = srs_bandwidth_check(rtmp,
99 &start_time, &end_time, &play_kbps, &publish_kbps, 99 &start_time, &end_time, &play_kbps, &publish_kbps,
100 &play_bytes, &publish_bytes, &play_duration, &publish_duration)) != 0 100 &play_bytes, &publish_bytes, &play_duration, &publish_duration)) != 0
101 ) { 101 ) {
102 - srs_trace("bandwidth check/test failed."); 102 + srs_lib_trace("bandwidth check/test failed.");
103 goto rtmp_destroy; 103 goto rtmp_destroy;
104 } 104 }
105 - srs_trace("bandwidth check/test success"); 105 + srs_lib_trace("bandwidth check/test success");
106 106
107 - srs_trace("\n%s, %s\n" 107 + srs_lib_trace("\n%s, %s\n"
108 "%s, %s, srs_pid=%d, srs_id=%d\n" 108 "%s, %s, srs_pid=%d, srs_id=%d\n"
109 "duration: %dms(%d+%d)\n" 109 "duration: %dms(%d+%d)\n"
110 "play: %dkbps\n" 110 "play: %dkbps\n"
@@ -136,8 +136,8 @@ rtmp_destroy: @@ -136,8 +136,8 @@ rtmp_destroy:
136 (int)(end_time - start_time), play_duration, publish_duration, 136 (int)(end_time - start_time), play_duration, publish_duration,
137 play_kbps, publish_kbps); 137 play_kbps, publish_kbps);
138 138
139 - srs_trace("");  
140 - srs_trace("completed"); 139 + srs_lib_trace("");
  140 + srs_lib_trace("completed");
141 141
142 return ret; 142 return ret;
143 } 143 }
@@ -79,55 +79,55 @@ int main(int argc, char** argv) @@ -79,55 +79,55 @@ int main(int argc, char** argv)
79 duration = atoi(argv[2]); 79 duration = atoi(argv[2]);
80 timeout = atoi(argv[3]); 80 timeout = atoi(argv[3]);
81 81
82 - srs_trace("rtmp url: %s", rtmp_url);  
83 - srs_trace("duration: %ds, timeout:%ds", duration, timeout); 82 + srs_lib_trace("rtmp url: %s", rtmp_url);
  83 + srs_lib_trace("duration: %ds, timeout:%ds", duration, timeout);
84 84
85 if (duration <= 0 || timeout <= 0) { 85 if (duration <= 0 || timeout <= 0) {
86 - srs_trace("duration and timeout must be positive."); 86 + srs_lib_trace("duration and timeout must be positive.");
87 exit(-2); 87 exit(-2);
88 } 88 }
89 89
90 rtmp = srs_rtmp_create(rtmp_url); 90 rtmp = srs_rtmp_create(rtmp_url);
91 91
92 if ((ret = __srs_dns_resolve(rtmp)) != 0) { 92 if ((ret = __srs_dns_resolve(rtmp)) != 0) {
93 - srs_trace("dns resolve failed. ret=%d", ret); 93 + srs_lib_trace("dns resolve failed. ret=%d", ret);
94 goto rtmp_destroy; 94 goto rtmp_destroy;
95 } 95 }
96 - srs_trace("dns resolve success"); 96 + srs_lib_trace("dns resolve success");
97 time_dns_resolve = srs_get_time_ms(); 97 time_dns_resolve = srs_get_time_ms();
98 98
99 if ((ret = __srs_connect_server(rtmp)) != 0) { 99 if ((ret = __srs_connect_server(rtmp)) != 0) {
100 - srs_trace("socket connect failed. ret=%d", ret); 100 + srs_lib_trace("socket connect failed. ret=%d", ret);
101 goto rtmp_destroy; 101 goto rtmp_destroy;
102 } 102 }
103 - srs_trace("socket connect success"); 103 + srs_lib_trace("socket connect success");
104 time_socket_connect = srs_get_time_ms(); 104 time_socket_connect = srs_get_time_ms();
105 105
106 if ((ret = __srs_do_simple_handshake(rtmp)) != 0) { 106 if ((ret = __srs_do_simple_handshake(rtmp)) != 0) {
107 - srs_trace("do simple handshake failed. ret=%d", ret); 107 + srs_lib_trace("do simple handshake failed. ret=%d", ret);
108 goto rtmp_destroy; 108 goto rtmp_destroy;
109 } 109 }
110 - srs_trace("do simple handshake success"); 110 + srs_lib_trace("do simple handshake success");
111 111
112 if ((ret = srs_connect_app(rtmp)) != 0) { 112 if ((ret = srs_connect_app(rtmp)) != 0) {
113 - srs_trace("connect vhost/app failed. ret=%d", ret); 113 + srs_lib_trace("connect vhost/app failed. ret=%d", ret);
114 goto rtmp_destroy; 114 goto rtmp_destroy;
115 } 115 }
116 - srs_trace("connect vhost/app success"); 116 + srs_lib_trace("connect vhost/app success");
117 117
118 if ((ret = srs_play_stream(rtmp)) != 0) { 118 if ((ret = srs_play_stream(rtmp)) != 0) {
119 - srs_trace("play stream failed. ret=%d", ret); 119 + srs_lib_trace("play stream failed. ret=%d", ret);
120 goto rtmp_destroy; 120 goto rtmp_destroy;
121 } 121 }
122 - srs_trace("play stream success"); 122 + srs_lib_trace("play stream success");
123 time_play_stream = srs_get_time_ms(); 123 time_play_stream = srs_get_time_ms();
124 124
125 for (;;) { 125 for (;;) {
126 if ((ret = srs_read_packet(rtmp, &type, &timestamp, &data, &size)) != 0) { 126 if ((ret = srs_read_packet(rtmp, &type, &timestamp, &data, &size)) != 0) {
127 - srs_trace("read packet failed. ret=%d", ret); 127 + srs_lib_trace("read packet failed. ret=%d", ret);
128 goto rtmp_destroy; 128 goto rtmp_destroy;
129 } 129 }
130 - srs_trace("got packet: type=%s, time=%d, size=%d", 130 + srs_lib_trace("got packet: type=%s, time=%d, size=%d",
131 srs_type2string(type), timestamp, size); 131 srs_type2string(type), timestamp, size);
132 132
133 if (SRS_RTMP_TYPE_VIDEO == type || SRS_RTMP_TYPE_AUDIO == type) { 133 if (SRS_RTMP_TYPE_VIDEO == type || SRS_RTMP_TYPE_AUDIO == type) {
@@ -142,12 +142,12 @@ int main(int argc, char** argv) @@ -142,12 +142,12 @@ int main(int argc, char** argv)
142 free(data); 142 free(data);
143 143
144 if (srs_get_time_ms() - time_startup > timeout * 1000) { 144 if (srs_get_time_ms() - time_startup > timeout * 1000) {
145 - srs_trace("timeout, terminate."); 145 + srs_lib_trace("timeout, terminate.");
146 goto rtmp_destroy; 146 goto rtmp_destroy;
147 } 147 }
148 148
149 if ((timestamp - basetime) > duration * 1000) { 149 if ((timestamp - basetime) > duration * 1000) {
150 - srs_trace("duration exceed, terminate."); 150 + srs_lib_trace("duration exceed, terminate.");
151 goto rtmp_destroy; 151 goto rtmp_destroy;
152 } 152 }
153 } 153 }
@@ -196,8 +196,8 @@ rtmp_destroy: @@ -196,8 +196,8 @@ rtmp_destroy:
196 "\"remark2\": \"if code is not 0, user must ignore all data\"" 196 "\"remark2\": \"if code is not 0, user must ignore all data\""
197 ); 197 );
198 198
199 - srs_trace("");  
200 - srs_trace("completed"); 199 + srs_lib_trace("");
  200 + srs_lib_trace("completed");
201 201
202 return ret; 202 return ret;
203 } 203 }
@@ -76,9 +76,9 @@ int main(int argc, char** argv) @@ -76,9 +76,9 @@ int main(int argc, char** argv)
76 tmp_file = (char*)malloc(tmp_file_size); 76 tmp_file = (char*)malloc(tmp_file_size);
77 snprintf(tmp_file, tmp_file_size, "%s.tmp", out_flv_file); 77 snprintf(tmp_file, tmp_file_size, "%s.tmp", out_flv_file);
78 78
79 - srs_trace("input: %s", in_flv_file);  
80 - srs_trace("output: %s", out_flv_file);  
81 - srs_trace("tmp_file: %s", tmp_file); 79 + srs_lib_trace("input: %s", in_flv_file);
  80 + srs_lib_trace("output: %s", out_flv_file);
  81 + srs_lib_trace("tmp_file: %s", tmp_file);
82 82
83 ret = process(in_flv_file, tmp_file, &ic, &oc); 83 ret = process(in_flv_file, tmp_file, &ic, &oc);
84 84
@@ -89,13 +89,13 @@ int main(int argc, char** argv) @@ -89,13 +89,13 @@ int main(int argc, char** argv)
89 unlink(tmp_file); 89 unlink(tmp_file);
90 if (ret == ERROR_INJECTED) { 90 if (ret == ERROR_INJECTED) {
91 ret = 0; 91 ret = 0;
92 - srs_trace("file already injected."); 92 + srs_lib_trace("file already injected.");
93 } else { 93 } else {
94 - srs_trace("error, remove tmp file."); 94 + srs_lib_trace("error, remove tmp file.");
95 } 95 }
96 } else { 96 } else {
97 rename(tmp_file, out_flv_file); 97 rename(tmp_file, out_flv_file);
98 - srs_trace("completed, rename to %s", out_flv_file); 98 + srs_lib_trace("completed, rename to %s", out_flv_file);
99 } 99 }
100 100
101 free(tmp_file); 101 free(tmp_file);
@@ -123,14 +123,14 @@ int process(const char* in_flv_file, const char* out_flv_file, srs_flv_t* pic, s @@ -123,14 +123,14 @@ int process(const char* in_flv_file, const char* out_flv_file, srs_flv_t* pic, s
123 123
124 if ((ic = srs_flv_open_read(in_flv_file)) == NULL) { 124 if ((ic = srs_flv_open_read(in_flv_file)) == NULL) {
125 ret = 2; 125 ret = 2;
126 - srs_trace("open input flv file failed. ret=%d", ret); 126 + srs_lib_trace("open input flv file failed. ret=%d", ret);
127 return ret; 127 return ret;
128 } 128 }
129 *pic = ic; 129 *pic = ic;
130 130
131 if ((oc = srs_flv_open_write(out_flv_file)) == NULL) { 131 if ((oc = srs_flv_open_write(out_flv_file)) == NULL) {
132 ret = 2; 132 ret = 2;
133 - srs_trace("open output flv file failed. ret=%d", ret); 133 + srs_lib_trace("open output flv file failed. ret=%d", ret);
134 return ret; 134 return ret;
135 } 135 }
136 *poc = oc; 136 *poc = oc;
@@ -164,13 +164,13 @@ int parse_metadata(char* data, int size, srs_amf0_t* pname, srs_amf0_t* pdata) @@ -164,13 +164,13 @@ int parse_metadata(char* data, int size, srs_amf0_t* pname, srs_amf0_t* pdata)
164 *pname = srs_amf0_parse(data, size, &nparsed); 164 *pname = srs_amf0_parse(data, size, &nparsed);
165 165
166 if (*pname == NULL || nparsed >= size) { 166 if (*pname == NULL || nparsed >= size) {
167 - srs_trace("invalid amf0 name data."); 167 + srs_lib_trace("invalid amf0 name data.");
168 return -1; 168 return -1;
169 } 169 }
170 170
171 *pdata = srs_amf0_parse(data + nparsed, size - nparsed, &nparsed); 171 *pdata = srs_amf0_parse(data + nparsed, size - nparsed, &nparsed);
172 if (*pdata == NULL || nparsed > size) { 172 if (*pdata == NULL || nparsed > size) {
173 - srs_trace("invalid amf0 value data"); 173 + srs_lib_trace("invalid amf0 value data");
174 return -1; 174 return -1;
175 } 175 }
176 176
@@ -206,22 +206,22 @@ int build_keyframes(srs_flv_t ic, srs_amf0_t *pname, srs_amf0_t* pdata, srs_amf0 @@ -206,22 +206,22 @@ int build_keyframes(srs_flv_t ic, srs_amf0_t *pname, srs_amf0_t* pdata, srs_amf0
206 return ret; 206 return ret;
207 } 207 }
208 208
209 - srs_trace("build keyframe infos from flv"); 209 + srs_lib_trace("build keyframe infos from flv");
210 for (;;) { 210 for (;;) {
211 offset = srs_flv_tellg(ic); 211 offset = srs_flv_tellg(ic);
212 212
213 // tag header 213 // tag header
214 if ((ret = srs_flv_read_tag_header(ic, &type, &size, &timestamp)) != 0) { 214 if ((ret = srs_flv_read_tag_header(ic, &type, &size, &timestamp)) != 0) {
215 if (srs_flv_is_eof(ret)) { 215 if (srs_flv_is_eof(ret)) {
216 - srs_trace("parse completed."); 216 + srs_lib_trace("parse completed.");
217 return 0; 217 return 0;
218 } 218 }
219 - srs_trace("flv get packet failed. ret=%d", ret); 219 + srs_lib_trace("flv get packet failed. ret=%d", ret);
220 return ret; 220 return ret;
221 } 221 }
222 222
223 if (size <= 0) { 223 if (size <= 0) {
224 - srs_trace("invalid size=%d", size); 224 + srs_lib_trace("invalid size=%d", size);
225 return ret; 225 return ret;
226 } 226 }
227 227
@@ -343,20 +343,20 @@ int do_inject_flv(srs_flv_t ic, srs_flv_t oc, srs_amf0_t amf0_name, srs_amf0_t a @@ -343,20 +343,20 @@ int do_inject_flv(srs_flv_t ic, srs_flv_t oc, srs_amf0_t amf0_name, srs_amf0_t a
343 free(data); 343 free(data);
344 } 344 }
345 345
346 - srs_trace("build keyframe infos from flv"); 346 + srs_lib_trace("build keyframe infos from flv");
347 for (;;) { 347 for (;;) {
348 // tag header 348 // tag header
349 if ((ret = srs_flv_read_tag_header(ic, &type, &size, &timestamp)) != 0) { 349 if ((ret = srs_flv_read_tag_header(ic, &type, &size, &timestamp)) != 0) {
350 if (srs_flv_is_eof(ret)) { 350 if (srs_flv_is_eof(ret)) {
351 - srs_trace("parse completed."); 351 + srs_lib_trace("parse completed.");
352 return 0; 352 return 0;
353 } 353 }
354 - srs_trace("flv get packet failed. ret=%d", ret); 354 + srs_lib_trace("flv get packet failed. ret=%d", ret);
355 return ret; 355 return ret;
356 } 356 }
357 357
358 if (size <= 0) { 358 if (size <= 0) {
359 - srs_trace("invalid size=%d", size); 359 + srs_lib_trace("invalid size=%d", size);
360 break; 360 break;
361 } 361 }
362 362
@@ -61,11 +61,11 @@ int main(int argc, char** argv) @@ -61,11 +61,11 @@ int main(int argc, char** argv)
61 } 61 }
62 62
63 in_flv_file = argv[1]; 63 in_flv_file = argv[1];
64 - srs_trace("input: %s", in_flv_file); 64 + srs_lib_trace("input: %s", in_flv_file);
65 65
66 if ((flv = srs_flv_open_read(in_flv_file)) == NULL) { 66 if ((flv = srs_flv_open_read(in_flv_file)) == NULL) {
67 ret = 2; 67 ret = 2;
68 - srs_trace("open flv file failed. ret=%d", ret); 68 + srs_lib_trace("open flv file failed. ret=%d", ret);
69 return ret; 69 return ret;
70 } 70 }
71 71
@@ -147,12 +147,12 @@ int parse_script_data(u_int32_t timestamp, char* data, int size, int64_t offset) @@ -147,12 +147,12 @@ int parse_script_data(u_int32_t timestamp, char* data, int size, int64_t offset)
147 // amf0 147 // amf0
148 amf0_name = srs_amf0_parse(data, size, &nparsed); 148 amf0_name = srs_amf0_parse(data, size, &nparsed);
149 if (amf0_name == NULL || nparsed >= size) { 149 if (amf0_name == NULL || nparsed >= size) {
150 - srs_trace("invalid amf0 name data."); 150 + srs_lib_trace("invalid amf0 name data.");
151 return -1; 151 return -1;
152 } 152 }
153 amf0_data = srs_amf0_parse(data + nparsed, size - nparsed, &nparsed); 153 amf0_data = srs_amf0_parse(data + nparsed, size - nparsed, &nparsed);
154 154
155 - srs_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n" 155 + srs_lib_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n"
156 "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n%s%s", 156 "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n%s%s",
157 srs_type2string(SRS_RTMP_TYPE_SCRIPT), timestamp, size + FLV_HEADER_SIZE, size, 157 srs_type2string(SRS_RTMP_TYPE_SCRIPT), timestamp, size + FLV_HEADER_SIZE, size,
158 (int)offset, hbuf, tbuf, 158 (int)offset, hbuf, tbuf,
@@ -178,7 +178,7 @@ int parse_audio_data(u_int32_t timestamp, char* data, int size, int64_t offset) @@ -178,7 +178,7 @@ int parse_audio_data(u_int32_t timestamp, char* data, int size, int64_t offset)
178 // bytes 178 // bytes
179 parse_bytes(data, size, hbuf, sizeof(hbuf), tbuf, sizeof(tbuf), 16); 179 parse_bytes(data, size, hbuf, sizeof(hbuf), tbuf, sizeof(tbuf), 16);
180 180
181 - srs_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n" 181 + srs_lib_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n"
182 "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n", 182 "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n",
183 srs_type2string(SRS_RTMP_TYPE_AUDIO), timestamp, size + FLV_HEADER_SIZE, size, 183 srs_type2string(SRS_RTMP_TYPE_AUDIO), timestamp, size + FLV_HEADER_SIZE, size,
184 (int)offset, hbuf, tbuf); 184 (int)offset, hbuf, tbuf);
@@ -196,7 +196,7 @@ int parse_video_data(u_int32_t timestamp, char* data, int size, int64_t offset) @@ -196,7 +196,7 @@ int parse_video_data(u_int32_t timestamp, char* data, int size, int64_t offset)
196 // bytes 196 // bytes
197 parse_bytes(data, size, hbuf, sizeof(hbuf), tbuf, sizeof(tbuf), 16); 197 parse_bytes(data, size, hbuf, sizeof(hbuf), tbuf, sizeof(tbuf), 16);
198 198
199 - srs_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n" 199 + srs_lib_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n"
200 "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n", 200 "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n",
201 srs_type2string(SRS_RTMP_TYPE_VIDEO), timestamp, size + FLV_HEADER_SIZE, size, 201 srs_type2string(SRS_RTMP_TYPE_VIDEO), timestamp, size + FLV_HEADER_SIZE, size,
202 (int)offset, hbuf, tbuf); 202 (int)offset, hbuf, tbuf);
@@ -221,22 +221,22 @@ int parse_flv(srs_flv_t flv) @@ -221,22 +221,22 @@ int parse_flv(srs_flv_t flv)
221 return ret; 221 return ret;
222 } 222 }
223 223
224 - srs_trace("start parse flv"); 224 + srs_lib_trace("start parse flv");
225 for (;;) { 225 for (;;) {
226 offset = srs_flv_tellg(flv); 226 offset = srs_flv_tellg(flv);
227 227
228 // tag header 228 // tag header
229 if ((ret = srs_flv_read_tag_header(flv, &type, &size, &timestamp)) != 0) { 229 if ((ret = srs_flv_read_tag_header(flv, &type, &size, &timestamp)) != 0) {
230 if (srs_flv_is_eof(ret)) { 230 if (srs_flv_is_eof(ret)) {
231 - srs_trace("parse completed."); 231 + srs_lib_trace("parse completed.");
232 return 0; 232 return 0;
233 } 233 }
234 - srs_trace("flv get packet failed. ret=%d", ret); 234 + srs_lib_trace("flv get packet failed. ret=%d", ret);
235 return ret; 235 return ret;
236 } 236 }
237 237
238 if (size <= 0) { 238 if (size <= 0) {
239 - srs_trace("invalid size=%d", size); 239 + srs_lib_trace("invalid size=%d", size);
240 break; 240 break;
241 } 241 }
242 242
@@ -44,7 +44,7 @@ int read_h264_frame(char* data, int size, char** pp, int* pnb_start_code, int fp @@ -44,7 +44,7 @@ int read_h264_frame(char* data, int size, char** pp, int* pnb_start_code, int fp
44 // we search the h264 frame from the buffer which cached the h264 data. 44 // we search the h264 frame from the buffer which cached the h264 data.
45 // please get h264 raw data from device, it always a encoded frame. 45 // please get h264 raw data from device, it always a encoded frame.
46 if (!srs_h264_startswith_annexb(p, size - (p - data), pnb_start_code)) { 46 if (!srs_h264_startswith_annexb(p, size - (p - data), pnb_start_code)) {
47 - srs_trace("h264 raw data invalid."); 47 + srs_lib_trace("h264 raw data invalid.");
48 return -1; 48 return -1;
49 } 49 }
50 50
@@ -63,7 +63,7 @@ int read_h264_frame(char* data, int size, char** pp, int* pnb_start_code, int fp @@ -63,7 +63,7 @@ int read_h264_frame(char* data, int size, char** pp, int* pnb_start_code, int fp
63 *pp = p; 63 *pp = p;
64 *frame_size = p - *frame; 64 *frame_size = p - *frame;
65 if (*frame_size <= 0) { 65 if (*frame_size <= 0) {
66 - srs_trace("h264 raw data invalid."); 66 + srs_lib_trace("h264 raw data invalid.");
67 return -1; 67 return -1;
68 } 68 }
69 69
@@ -95,32 +95,32 @@ int main(int argc, char** argv) @@ -95,32 +95,32 @@ int main(int argc, char** argv)
95 95
96 const char* raw_file = argv[1]; 96 const char* raw_file = argv[1];
97 const char* rtmp_url = argv[2]; 97 const char* rtmp_url = argv[2];
98 - srs_trace("raw_file=%s, rtmp_url=%s", raw_file, rtmp_url); 98 + srs_lib_trace("raw_file=%s, rtmp_url=%s", raw_file, rtmp_url);
99 99
100 // open file 100 // open file
101 int raw_fd = open(raw_file, O_RDONLY); 101 int raw_fd = open(raw_file, O_RDONLY);
102 if (raw_fd < 0) { 102 if (raw_fd < 0) {
103 - srs_trace("open h264 raw file %s failed.", raw_fd); 103 + srs_lib_trace("open h264 raw file %s failed.", raw_fd);
104 goto rtmp_destroy; 104 goto rtmp_destroy;
105 } 105 }
106 106
107 off_t file_size = lseek(raw_fd, 0, SEEK_END); 107 off_t file_size = lseek(raw_fd, 0, SEEK_END);
108 if (file_size <= 0) { 108 if (file_size <= 0) {
109 - srs_trace("h264 raw file %s empty.", raw_file); 109 + srs_lib_trace("h264 raw file %s empty.", raw_file);
110 goto rtmp_destroy; 110 goto rtmp_destroy;
111 } 111 }
112 - srs_trace("read entirely h264 raw file, size=%dKB", (int)(file_size / 1024)); 112 + srs_lib_trace("read entirely h264 raw file, size=%dKB", (int)(file_size / 1024));
113 113
114 char* h264_raw = (char*)malloc(file_size); 114 char* h264_raw = (char*)malloc(file_size);
115 if (!h264_raw) { 115 if (!h264_raw) {
116 - srs_trace("alloc raw buffer failed for file %s.", raw_file); 116 + srs_lib_trace("alloc raw buffer failed for file %s.", raw_file);
117 goto rtmp_destroy; 117 goto rtmp_destroy;
118 } 118 }
119 119
120 lseek(raw_fd, 0, SEEK_SET); 120 lseek(raw_fd, 0, SEEK_SET);
121 ssize_t nb_read = 0; 121 ssize_t nb_read = 0;
122 if ((nb_read = read(raw_fd, h264_raw, file_size)) != file_size) { 122 if ((nb_read = read(raw_fd, h264_raw, file_size)) != file_size) {
123 - srs_trace("buffer %s failed, expect=%dKB, actual=%dKB.", 123 + srs_lib_trace("buffer %s failed, expect=%dKB, actual=%dKB.",
124 raw_file, (int)(file_size / 1024), (int)(nb_read / 1024)); 124 raw_file, (int)(file_size / 1024), (int)(nb_read / 1024));
125 goto rtmp_destroy; 125 goto rtmp_destroy;
126 } 126 }
@@ -129,22 +129,22 @@ int main(int argc, char** argv) @@ -129,22 +129,22 @@ int main(int argc, char** argv)
129 srs_rtmp_t rtmp = srs_rtmp_create(rtmp_url); 129 srs_rtmp_t rtmp = srs_rtmp_create(rtmp_url);
130 130
131 if (srs_simple_handshake(rtmp) != 0) { 131 if (srs_simple_handshake(rtmp) != 0) {
132 - srs_trace("simple handshake failed."); 132 + srs_lib_trace("simple handshake failed.");
133 goto rtmp_destroy; 133 goto rtmp_destroy;
134 } 134 }
135 - srs_trace("simple handshake success"); 135 + srs_lib_trace("simple handshake success");
136 136
137 if (srs_connect_app(rtmp) != 0) { 137 if (srs_connect_app(rtmp) != 0) {
138 - srs_trace("connect vhost/app failed."); 138 + srs_lib_trace("connect vhost/app failed.");
139 goto rtmp_destroy; 139 goto rtmp_destroy;
140 } 140 }
141 - srs_trace("connect vhost/app success"); 141 + srs_lib_trace("connect vhost/app success");
142 142
143 if (srs_publish_stream(rtmp) != 0) { 143 if (srs_publish_stream(rtmp) != 0) {
144 - srs_trace("publish stream failed."); 144 + srs_lib_trace("publish stream failed.");
145 goto rtmp_destroy; 145 goto rtmp_destroy;
146 } 146 }
147 - srs_trace("publish stream success"); 147 + srs_lib_trace("publish stream success");
148 148
149 u_int32_t dts = 0; 149 u_int32_t dts = 0;
150 u_int32_t pts = 0; 150 u_int32_t pts = 0;
@@ -161,27 +161,27 @@ int main(int argc, char** argv) @@ -161,27 +161,27 @@ int main(int argc, char** argv)
161 if (read_h264_frame(h264_raw, file_size, &p, &nb_start_code, fps, 161 if (read_h264_frame(h264_raw, file_size, &p, &nb_start_code, fps,
162 &data, &size, &dts, &pts) < 0 162 &data, &size, &dts, &pts) < 0
163 ) { 163 ) {
164 - srs_trace("read a frame from file buffer failed."); 164 + srs_lib_trace("read a frame from file buffer failed.");
165 goto rtmp_destroy; 165 goto rtmp_destroy;
166 } 166 }
167 167
168 // send out the h264 packet over RTMP 168 // send out the h264 packet over RTMP
169 if (srs_write_h264_raw_frames(rtmp, data, size, dts, pts) != 0) { 169 if (srs_write_h264_raw_frames(rtmp, data, size, dts, pts) != 0) {
170 - srs_trace("send h264 raw data failed."); 170 + srs_lib_trace("send h264 raw data failed.");
171 goto rtmp_destroy; 171 goto rtmp_destroy;
172 } 172 }
173 173
174 // 5bits, 7.3.1 NAL unit syntax, 174 // 5bits, 7.3.1 NAL unit syntax,
175 // H.264-AVC-ISO_IEC_14496-10.pdf, page 44. 175 // H.264-AVC-ISO_IEC_14496-10.pdf, page 44.
176 u_int8_t nut = (char)data[nb_start_code] & 0x1f; 176 u_int8_t nut = (char)data[nb_start_code] & 0x1f;
177 - srs_trace("sent packet: type=%s, time=%d, size=%d, fps=%d, b[%d]=%#x(%s)", 177 + srs_lib_trace("sent packet: type=%s, time=%d, size=%d, fps=%d, b[%d]=%#x(%s)",
178 srs_type2string(SRS_RTMP_TYPE_VIDEO), dts, size, fps, nb_start_code, (char)data[nb_start_code], 178 srs_type2string(SRS_RTMP_TYPE_VIDEO), dts, size, fps, nb_start_code, (char)data[nb_start_code],
179 (nut == 7? "SPS":(nut == 8? "PPS":(nut == 5? "I":(nut == 1? "P":"Unknown"))))); 179 (nut == 7? "SPS":(nut == 8? "PPS":(nut == 5? "I":(nut == 1? "P":"Unknown")))));
180 180
181 // @remark, when use encode device, it not need to sleep. 181 // @remark, when use encode device, it not need to sleep.
182 usleep(1000 / fps * 1000); 182 usleep(1000 / fps * 1000);
183 } 183 }
184 - srs_trace("h264 raw data completed"); 184 + srs_lib_trace("h264 raw data completed");
185 185
186 rtmp_destroy: 186 rtmp_destroy:
187 srs_rtmp_destroy(rtmp); 187 srs_rtmp_destroy(rtmp);
@@ -89,19 +89,19 @@ int main(int argc, char** argv) @@ -89,19 +89,19 @@ int main(int argc, char** argv)
89 } 89 }
90 } 90 }
91 91
92 - srs_trace("input: %s", in_flv_file);  
93 - srs_trace("output: %s", out_rtmp_url); 92 + srs_lib_trace("input: %s", in_flv_file);
  93 + srs_lib_trace("output: %s", out_rtmp_url);
94 94
95 if ((flv = srs_flv_open_read(in_flv_file)) == NULL) { 95 if ((flv = srs_flv_open_read(in_flv_file)) == NULL) {
96 ret = 2; 96 ret = 2;
97 - srs_trace("open flv file failed. ret=%d", ret); 97 + srs_lib_trace("open flv file failed. ret=%d", ret);
98 return ret; 98 return ret;
99 } 99 }
100 100
101 ortmp = srs_rtmp_create(out_rtmp_url); 101 ortmp = srs_rtmp_create(out_rtmp_url);
102 102
103 ret = proxy(flv, ortmp); 103 ret = proxy(flv, ortmp);
104 - srs_trace("ingest flv to RTMP completed"); 104 + srs_lib_trace("ingest flv to RTMP completed");
105 105
106 srs_rtmp_destroy(ortmp); 106 srs_rtmp_destroy(ortmp);
107 srs_flv_close(flv); 107 srs_flv_close(flv);
@@ -118,20 +118,20 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, u_int32_t* ptimestamp) @@ -118,20 +118,20 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, u_int32_t* ptimestamp)
118 int size; 118 int size;
119 char* data = NULL; 119 char* data = NULL;
120 120
121 - srs_trace("start ingest flv to RTMP stream"); 121 + srs_lib_trace("start ingest flv to RTMP stream");
122 for (;;) { 122 for (;;) {
123 // tag header 123 // tag header
124 if ((ret = srs_flv_read_tag_header(flv, &type, &size, ptimestamp)) != 0) { 124 if ((ret = srs_flv_read_tag_header(flv, &type, &size, ptimestamp)) != 0) {
125 if (srs_flv_is_eof(ret)) { 125 if (srs_flv_is_eof(ret)) {
126 - srs_trace("parse completed."); 126 + srs_lib_trace("parse completed.");
127 return 0; 127 return 0;
128 } 128 }
129 - srs_trace("flv get packet failed. ret=%d", ret); 129 + srs_lib_trace("flv get packet failed. ret=%d", ret);
130 return ret; 130 return ret;
131 } 131 }
132 132
133 if (size <= 0) { 133 if (size <= 0) {
134 - srs_trace("invalid size=%d", size); 134 + srs_lib_trace("invalid size=%d", size);
135 break; 135 break;
136 } 136 }
137 137
@@ -142,10 +142,10 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, u_int32_t* ptimestamp) @@ -142,10 +142,10 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, u_int32_t* ptimestamp)
142 } 142 }
143 143
144 if ((ret = srs_write_packet(ortmp, type, *ptimestamp, data, size)) != 0) { 144 if ((ret = srs_write_packet(ortmp, type, *ptimestamp, data, size)) != 0) {
145 - srs_trace("irtmp get packet failed. ret=%d", ret); 145 + srs_lib_trace("irtmp get packet failed. ret=%d", ret);
146 return ret; 146 return ret;
147 } 147 }
148 - srs_verbose("ortmp sent packet: type=%s, time=%d, size=%d", 148 + srs_lib_verbose("ortmp sent packet: type=%s, time=%d, size=%d",
149 srs_type2string(type), *ptimestamp, size); 149 srs_type2string(type), *ptimestamp, size);
150 150
151 re_update(re, *ptimestamp); 151 re_update(re, *ptimestamp);
@@ -182,22 +182,22 @@ int connect_oc(srs_rtmp_t ortmp) @@ -182,22 +182,22 @@ int connect_oc(srs_rtmp_t ortmp)
182 int ret = 0; 182 int ret = 0;
183 183
184 if ((ret = srs_simple_handshake(ortmp)) != 0) { 184 if ((ret = srs_simple_handshake(ortmp)) != 0) {
185 - srs_trace("ortmp simple handshake failed. ret=%d", ret); 185 + srs_lib_trace("ortmp simple handshake failed. ret=%d", ret);
186 return ret; 186 return ret;
187 } 187 }
188 - srs_trace("ortmp simple handshake success"); 188 + srs_lib_trace("ortmp simple handshake success");
189 189
190 if ((ret = srs_connect_app(ortmp)) != 0) { 190 if ((ret = srs_connect_app(ortmp)) != 0) {
191 - srs_trace("ortmp connect vhost/app failed. ret=%d", ret); 191 + srs_lib_trace("ortmp connect vhost/app failed. ret=%d", ret);
192 return ret; 192 return ret;
193 } 193 }
194 - srs_trace("ortmp connect vhost/app success"); 194 + srs_lib_trace("ortmp connect vhost/app success");
195 195
196 if ((ret = srs_publish_stream(ortmp)) != 0) { 196 if ((ret = srs_publish_stream(ortmp)) != 0) {
197 - srs_trace("ortmp publish stream failed. ret=%d", ret); 197 + srs_lib_trace("ortmp publish stream failed. ret=%d", ret);
198 return ret; 198 return ret;
199 } 199 }
200 - srs_trace("ortmp publish stream success"); 200 + srs_lib_trace("ortmp publish stream success");
201 201
202 return ret; 202 return ret;
203 } 203 }
@@ -209,16 +209,16 @@ int64_t re_create() @@ -209,16 +209,16 @@ int64_t re_create()
209 209
210 // use the starttime to get the deviation 210 // use the starttime to get the deviation
211 int64_t deviation = re - tools_main_entrance_startup_time; 211 int64_t deviation = re - tools_main_entrance_startup_time;
212 - srs_trace("deviation is %d ms, pulse is %d ms", (int)(deviation), (int)(RE_PULSE_MS)); 212 + srs_lib_trace("deviation is %d ms, pulse is %d ms", (int)(deviation), (int)(RE_PULSE_MS));
213 213
214 // so, we adjust time to max(0, deviation) 214 // so, we adjust time to max(0, deviation)
215 // because the last pulse, we already sleeped 215 // because the last pulse, we already sleeped
216 int adjust = (int)(deviation); 216 int adjust = (int)(deviation);
217 if (adjust > 0) { 217 if (adjust > 0) {
218 - srs_trace("adjust re time for %d ms", adjust); 218 + srs_lib_trace("adjust re time for %d ms", adjust);
219 re -= adjust; 219 re -= adjust;
220 } else { 220 } else {
221 - srs_trace("no need to adjust re time"); 221 + srs_lib_trace("no need to adjust re time");
222 } 222 }
223 223
224 return re; 224 return re;
@@ -239,7 +239,7 @@ void re_cleanup(int64_t re, u_int32_t time) @@ -239,7 +239,7 @@ void re_cleanup(int64_t re, u_int32_t time)
239 int64_t now = srs_get_time_ms(); 239 int64_t now = srs_get_time_ms();
240 int64_t diff = time - (now -re); 240 int64_t diff = time - (now -re);
241 if (diff > 0) { 241 if (diff > 0) {
242 - srs_trace("re_cleanup sleep for the last pulse for %d ms", (int)diff); 242 + srs_lib_trace("re_cleanup sleep for the last pulse for %d ms", (int)diff);
243 usleep(diff * 1000); 243 usleep(diff * 1000);
244 } 244 }
245 } 245 }
@@ -74,14 +74,14 @@ int main(int argc, char** argv) @@ -74,14 +74,14 @@ int main(int argc, char** argv)
74 } 74 }
75 } 75 }
76 76
77 - srs_trace("input: %s", in_rtmp_url);  
78 - srs_trace("output: %s", out_rtmp_url); 77 + srs_lib_trace("input: %s", in_rtmp_url);
  78 + srs_lib_trace("output: %s", out_rtmp_url);
79 79
80 irtmp = srs_rtmp_create(in_rtmp_url); 80 irtmp = srs_rtmp_create(in_rtmp_url);
81 ortmp = srs_rtmp_create(out_rtmp_url); 81 ortmp = srs_rtmp_create(out_rtmp_url);
82 82
83 ret = proxy(irtmp, ortmp); 83 ret = proxy(irtmp, ortmp);
84 - srs_trace("proxy completed"); 84 + srs_lib_trace("proxy completed");
85 85
86 srs_rtmp_destroy(irtmp); 86 srs_rtmp_destroy(irtmp);
87 srs_rtmp_destroy(ortmp); 87 srs_rtmp_destroy(ortmp);
@@ -105,20 +105,20 @@ int proxy(srs_rtmp_t irtmp, srs_rtmp_t ortmp) @@ -105,20 +105,20 @@ int proxy(srs_rtmp_t irtmp, srs_rtmp_t ortmp)
105 return ret; 105 return ret;
106 } 106 }
107 107
108 - srs_trace("start proxy RTMP stream"); 108 + srs_lib_trace("start proxy RTMP stream");
109 for (;;) { 109 for (;;) {
110 if ((ret = srs_read_packet(irtmp, &type, &timestamp, &data, &size)) != 0) { 110 if ((ret = srs_read_packet(irtmp, &type, &timestamp, &data, &size)) != 0) {
111 - srs_trace("irtmp get packet failed. ret=%d", ret); 111 + srs_lib_trace("irtmp get packet failed. ret=%d", ret);
112 return ret; 112 return ret;
113 } 113 }
114 - srs_verbose("irtmp got packet: type=%s, time=%d, size=%d", 114 + srs_lib_verbose("irtmp got packet: type=%s, time=%d, size=%d",
115 srs_type2string(type), timestamp, size); 115 srs_type2string(type), timestamp, size);
116 116
117 if ((ret = srs_write_packet(ortmp, type, timestamp, data, size)) != 0) { 117 if ((ret = srs_write_packet(ortmp, type, timestamp, data, size)) != 0) {
118 - srs_trace("irtmp get packet failed. ret=%d", ret); 118 + srs_lib_trace("irtmp get packet failed. ret=%d", ret);
119 return ret; 119 return ret;
120 } 120 }
121 - srs_verbose("ortmp sent packet: type=%s, time=%d, size=%d", 121 + srs_lib_verbose("ortmp sent packet: type=%s, time=%d, size=%d",
122 srs_type2string(type), timestamp, size); 122 srs_type2string(type), timestamp, size);
123 } 123 }
124 124
@@ -130,22 +130,22 @@ int connect_ic(srs_rtmp_t irtmp) @@ -130,22 +130,22 @@ int connect_ic(srs_rtmp_t irtmp)
130 int ret = 0; 130 int ret = 0;
131 131
132 if ((ret = srs_simple_handshake(irtmp)) != 0) { 132 if ((ret = srs_simple_handshake(irtmp)) != 0) {
133 - srs_trace("irtmp simple handshake failed. ret=%d", ret); 133 + srs_lib_trace("irtmp simple handshake failed. ret=%d", ret);
134 return ret; 134 return ret;
135 } 135 }
136 - srs_trace("irtmp simple handshake success"); 136 + srs_lib_trace("irtmp simple handshake success");
137 137
138 if ((ret = srs_connect_app(irtmp)) != 0) { 138 if ((ret = srs_connect_app(irtmp)) != 0) {
139 - srs_trace("irtmp connect vhost/app failed. ret=%d", ret); 139 + srs_lib_trace("irtmp connect vhost/app failed. ret=%d", ret);
140 return ret; 140 return ret;
141 } 141 }
142 - srs_trace("irtmp connect vhost/app success"); 142 + srs_lib_trace("irtmp connect vhost/app success");
143 143
144 if ((ret = srs_play_stream(irtmp)) != 0) { 144 if ((ret = srs_play_stream(irtmp)) != 0) {
145 - srs_trace("irtmp play stream failed. ret=%d", ret); 145 + srs_lib_trace("irtmp play stream failed. ret=%d", ret);
146 return ret; 146 return ret;
147 } 147 }
148 - srs_trace("irtmp play stream success"); 148 + srs_lib_trace("irtmp play stream success");
149 149
150 return ret; 150 return ret;
151 } 151 }
@@ -155,22 +155,22 @@ int connect_oc(srs_rtmp_t ortmp) @@ -155,22 +155,22 @@ int connect_oc(srs_rtmp_t ortmp)
155 int ret = 0; 155 int ret = 0;
156 156
157 if ((ret = srs_simple_handshake(ortmp)) != 0) { 157 if ((ret = srs_simple_handshake(ortmp)) != 0) {
158 - srs_trace("ortmp simple handshake failed. ret=%d", ret); 158 + srs_lib_trace("ortmp simple handshake failed. ret=%d", ret);
159 return ret; 159 return ret;
160 } 160 }
161 - srs_trace("ortmp simple handshake success"); 161 + srs_lib_trace("ortmp simple handshake success");
162 162
163 if ((ret = srs_connect_app(ortmp)) != 0) { 163 if ((ret = srs_connect_app(ortmp)) != 0) {
164 - srs_trace("ortmp connect vhost/app failed. ret=%d", ret); 164 + srs_lib_trace("ortmp connect vhost/app failed. ret=%d", ret);
165 return ret; 165 return ret;
166 } 166 }
167 - srs_trace("ortmp connect vhost/app success"); 167 + srs_lib_trace("ortmp connect vhost/app success");
168 168
169 if ((ret = srs_publish_stream(ortmp)) != 0) { 169 if ((ret = srs_publish_stream(ortmp)) != 0) {
170 - srs_trace("ortmp publish stream failed. ret=%d", ret); 170 + srs_lib_trace("ortmp publish stream failed. ret=%d", ret);
171 return ret; 171 return ret;
172 } 172 }
173 - srs_trace("ortmp publish stream success"); 173 + srs_lib_trace("ortmp publish stream success");
174 174
175 return ret; 175 return ret;
176 } 176 }
@@ -44,26 +44,26 @@ int main(int argc, char** argv) @@ -44,26 +44,26 @@ int main(int argc, char** argv)
44 exit(-1); 44 exit(-1);
45 } 45 }
46 46
47 - srs_trace("rtmp url: %s", argv[1]); 47 + srs_lib_trace("rtmp url: %s", argv[1]);
48 srs_rtmp_t rtmp = srs_rtmp_create(argv[1]); 48 srs_rtmp_t rtmp = srs_rtmp_create(argv[1]);
49 49
50 if (srs_simple_handshake(rtmp) != 0) { 50 if (srs_simple_handshake(rtmp) != 0) {
51 - srs_trace("simple handshake failed."); 51 + srs_lib_trace("simple handshake failed.");
52 goto rtmp_destroy; 52 goto rtmp_destroy;
53 } 53 }
54 - srs_trace("simple handshake success"); 54 + srs_lib_trace("simple handshake success");
55 55
56 if (srs_connect_app(rtmp) != 0) { 56 if (srs_connect_app(rtmp) != 0) {
57 - srs_trace("connect vhost/app failed."); 57 + srs_lib_trace("connect vhost/app failed.");
58 goto rtmp_destroy; 58 goto rtmp_destroy;
59 } 59 }
60 - srs_trace("connect vhost/app success"); 60 + srs_lib_trace("connect vhost/app success");
61 61
62 if (srs_play_stream(rtmp) != 0) { 62 if (srs_play_stream(rtmp) != 0) {
63 - srs_trace("play stream failed."); 63 + srs_lib_trace("play stream failed.");
64 goto rtmp_destroy; 64 goto rtmp_destroy;
65 } 65 }
66 - srs_trace("play stream success"); 66 + srs_lib_trace("play stream success");
67 67
68 for (;;) { 68 for (;;) {
69 int type, size; 69 int type, size;
@@ -73,7 +73,7 @@ int main(int argc, char** argv) @@ -73,7 +73,7 @@ int main(int argc, char** argv)
73 if (srs_read_packet(rtmp, &type, &timestamp, &data, &size) != 0) { 73 if (srs_read_packet(rtmp, &type, &timestamp, &data, &size) != 0) {
74 goto rtmp_destroy; 74 goto rtmp_destroy;
75 } 75 }
76 - srs_trace("got packet: type=%s, time=%d, size=%d", 76 + srs_lib_trace("got packet: type=%s, time=%d, size=%d",
77 srs_type2string(type), timestamp, size); 77 srs_type2string(type), timestamp, size);
78 78
79 free(data); 79 free(data);
@@ -47,31 +47,31 @@ int main(int argc, char** argv) @@ -47,31 +47,31 @@ int main(int argc, char** argv)
47 47
48 // warn it . 48 // warn it .
49 // @see: https://github.com/winlinvip/simple-rtmp-server/issues/126 49 // @see: https://github.com/winlinvip/simple-rtmp-server/issues/126
50 - srs_trace("\033[33m%s\033[0m", 50 + srs_lib_trace("\033[33m%s\033[0m",
51 "[warning] it's only a sample to use librtmp. " 51 "[warning] it's only a sample to use librtmp. "
52 "please never use it to publish and test forward/transcode/edge/HLS whatever. " 52 "please never use it to publish and test forward/transcode/edge/HLS whatever. "
53 "you should refer to this tool to use the srs-librtmp to publish the real media stream." 53 "you should refer to this tool to use the srs-librtmp to publish the real media stream."
54 "read about: https://github.com/winlinvip/simple-rtmp-server/issues/126"); 54 "read about: https://github.com/winlinvip/simple-rtmp-server/issues/126");
55 - srs_trace("rtmp url: %s", argv[1]); 55 + srs_lib_trace("rtmp url: %s", argv[1]);
56 srs_rtmp_t rtmp = srs_rtmp_create(argv[1]); 56 srs_rtmp_t rtmp = srs_rtmp_create(argv[1]);
57 57
58 if (srs_simple_handshake(rtmp) != 0) { 58 if (srs_simple_handshake(rtmp) != 0) {
59 - srs_trace("simple handshake failed."); 59 + srs_lib_trace("simple handshake failed.");
60 goto rtmp_destroy; 60 goto rtmp_destroy;
61 } 61 }
62 - srs_trace("simple handshake success"); 62 + srs_lib_trace("simple handshake success");
63 63
64 if (srs_connect_app(rtmp) != 0) { 64 if (srs_connect_app(rtmp) != 0) {
65 - srs_trace("connect vhost/app failed."); 65 + srs_lib_trace("connect vhost/app failed.");
66 goto rtmp_destroy; 66 goto rtmp_destroy;
67 } 67 }
68 - srs_trace("connect vhost/app success"); 68 + srs_lib_trace("connect vhost/app success");
69 69
70 if (srs_publish_stream(rtmp) != 0) { 70 if (srs_publish_stream(rtmp) != 0) {
71 - srs_trace("publish stream failed."); 71 + srs_lib_trace("publish stream failed.");
72 goto rtmp_destroy; 72 goto rtmp_destroy;
73 } 73 }
74 - srs_trace("publish stream success"); 74 + srs_lib_trace("publish stream success");
75 75
76 u_int32_t timestamp = 0; 76 u_int32_t timestamp = 0;
77 for (;;) { 77 for (;;) {
@@ -84,7 +84,7 @@ int main(int argc, char** argv) @@ -84,7 +84,7 @@ int main(int argc, char** argv)
84 if (srs_write_packet(rtmp, type, timestamp, data, size) != 0) { 84 if (srs_write_packet(rtmp, type, timestamp, data, size) != 0) {
85 goto rtmp_destroy; 85 goto rtmp_destroy;
86 } 86 }
87 - srs_trace("sent packet: type=%s, time=%d, size=%d", 87 + srs_lib_trace("sent packet: type=%s, time=%d, size=%d",
88 srs_type2string(type), timestamp, size); 88 srs_type2string(type), timestamp, size);
89 89
90 usleep(40 * 1000); 90 usleep(40 * 1000);
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR 2 32 #define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 10 34 +#define VERSION_REVISION 12
35 // server info. 35 // server info.
36 #define RTMP_SIG_SRS_KEY "SRS" 36 #define RTMP_SIG_SRS_KEY "SRS"
37 #define RTMP_SIG_SRS_ROLE "origin/edge server" 37 #define RTMP_SIG_SRS_ROLE "origin/edge server"
@@ -30,10 +30,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -30,10 +30,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 #include <sstream> 30 #include <sstream>
31 using namespace std; 31 using namespace std;
32 32
33 -// undefine the log of librtmp for the srs use its log.  
34 -#undef srs_trace  
35 -#undef srs_verbose  
36 -  
37 #include <srs_kernel_error.hpp> 33 #include <srs_kernel_error.hpp>
38 #include <srs_protocol_rtmp.hpp> 34 #include <srs_protocol_rtmp.hpp>
39 #include <srs_lib_simple_socket.hpp> 35 #include <srs_lib_simple_socket.hpp>
@@ -48,7 +44,7 @@ using namespace std; @@ -48,7 +44,7 @@ using namespace std;
48 #include <srs_kernel_file.hpp> 44 #include <srs_kernel_file.hpp>
49 #include <srs_lib_bandwidth.hpp> 45 #include <srs_lib_bandwidth.hpp>
50 46
51 -// if user want to define log, define the folowing macro. 47 +// if want to use your log, define the folowing macro.
52 #ifndef SRS_RTMP_USER_DEFINED_LOG 48 #ifndef SRS_RTMP_USER_DEFINED_LOG
53 // kernel module. 49 // kernel module.
54 ISrsLog* _srs_log = new ISrsLog(); 50 ISrsLog* _srs_log = new ISrsLog();
@@ -237,8 +237,8 @@ extern int64_t srs_get_nrecv_bytes(srs_rtmp_t rtmp); @@ -237,8 +237,8 @@ extern int64_t srs_get_nrecv_bytes(srs_rtmp_t rtmp);
237 237
238 // log to console, for use srs-librtmp application. 238 // log to console, for use srs-librtmp application.
239 extern const char* srs_format_time(); 239 extern const char* srs_format_time();
240 -#define srs_trace(msg, ...) printf("[%s] ", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n")  
241 -#define srs_verbose(msg, ...) printf("[%s] ", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n") 240 +#define srs_lib_trace(msg, ...) printf("[%s] ", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n")
  241 +#define srs_lib_verbose(msg, ...) printf("[%s] ", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n")
242 242
243 /************************************************************* 243 /*************************************************************
244 ************************************************************** 244 **************************************************************