From 4c8d6d2eb1026267f7c824c69b26a921e2124181 Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 26 Mar 2014 18:13:33 +0800 Subject: [PATCH] fix bug of hls and rename demo player stream to live/demo. change to 0.9.36 --- trunk/conf/demo.19350.conf | 5 +++++ trunk/conf/demo.conf | 5 +++++ trunk/research/players/js/srs.page.js | 6 +++--- trunk/scripts/_ffmpeg.players.sh | 2 +- trunk/scripts/_step.start.srs.19350.sh | 4 ++-- trunk/scripts/_step.start.srs.sh | 4 ++-- trunk/src/app/srs_app_hls.cpp | 10 ++++++---- trunk/src/core/srs_core.hpp | 2 +- 8 files changed, 25 insertions(+), 13 deletions(-) diff --git a/trunk/conf/demo.19350.conf b/trunk/conf/demo.19350.conf index 91c0b1d87..ab5422ca9 100644 --- a/trunk/conf/demo.19350.conf +++ b/trunk/conf/demo.19350.conf @@ -3,6 +3,11 @@ # @see full.conf for detail config. listen 19350; +daemon on; +srs_log_tank file; +srs_log_file ./objs/demo.19350.log; +pid ./objs/srs.demo.19350.pid; + vhost __defaultVhost__ { enabled on; gop_cache on; diff --git a/trunk/conf/demo.conf b/trunk/conf/demo.conf index 191675302..5ed7a2cfd 100644 --- a/trunk/conf/demo.conf +++ b/trunk/conf/demo.conf @@ -3,6 +3,11 @@ # @see full.conf for detail config. listen 1935; +daemon on; +srs_log_tank file; +srs_log_file ./objs/demo.log; +pid ./objs/srs.demo.pid; + chunk_size 60000; max_connections 2000; diff --git a/trunk/research/players/js/srs.page.js b/trunk/research/players/js/srs.page.js index 62e28a52c..a39f0b216 100755 --- a/trunk/research/players/js/srs.page.js +++ b/trunk/research/players/js/srs.page.js @@ -55,7 +55,7 @@ function build_default_rtmp_url() { var port = (query.port == undefined)? 1935:query.port; var vhost = (query.vhost == undefined)? window.location.hostname:query.vhost; var app = (query.app == undefined)? "live":query.app; - var stream = (query.stream == undefined)? "livestream":query.stream; + var stream = (query.stream == undefined)? "demo":query.stream; if (server == vhost || vhost == "") { return "rtmp://" + server + ":" + port + "/" + app + "/" + stream; @@ -71,7 +71,7 @@ function build_default_publish_rtmp_url() { var port = (query.port == undefined)? 1935:query.port; var vhost = (query.vhost == undefined)? window.location.hostname:query.vhost; var app = (query.app == undefined)? "live":query.app; - var stream = (query.stream == undefined)? "livestream":query.stream; + var stream = (query.stream == undefined)? "demo":query.stream; if (server == vhost || vhost == "") { return "rtmp://" + server + ":" + port + "/" + app + "/" + stream; @@ -114,7 +114,7 @@ function build_default_hls_url() { var port = (query.hls_port == undefined)? window.location.port:query.hls_port; var app = (query.app == undefined)? "live":query.app; - var stream = (query.stream == undefined)? "livestream":query.stream; + var stream = (query.stream == undefined)? "demo":query.stream; if (port == "" || port == null || port == undefined) { port = 80; diff --git a/trunk/scripts/_ffmpeg.players.sh b/trunk/scripts/_ffmpeg.players.sh index 5fd0f73f3..6d18c5933 100755 --- a/trunk/scripts/_ffmpeg.players.sh +++ b/trunk/scripts/_ffmpeg.players.sh @@ -2,6 +2,6 @@ for((;;)); do \ ./objs/ffmpeg/bin/ffmpeg -re -i ./doc/source.200kbps.768x320.flv \ -vcodec copy -acodec copy \ - -f flv -y rtmp://127.0.0.1/live?vhost=players/livestream; \ + -f flv -y rtmp://127.0.0.1/live?vhost=players/demo; \ sleep 1; \ done diff --git a/trunk/scripts/_step.start.srs.19350.sh b/trunk/scripts/_step.start.srs.19350.sh index 38f32298a..b3a00c96d 100755 --- a/trunk/scripts/_step.start.srs.19350.sh +++ b/trunk/scripts/_step.start.srs.19350.sh @@ -2,10 +2,10 @@ src_dir='src' if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; exit 1; fi -cmd="nohup ./objs/srs -c conf/demo.19350.conf > ./objs/demo.19350.log 2>&1 &" +cmd="./objs/srs -c conf/demo.19350.conf" echo "启动SRS转发服务器:$cmd" pids=`ps aux|grep srs|grep "./objs"|grep "demo.19350.conf"|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done -nohup ./objs/srs -c conf/demo.19350.conf > ./objs/demo.19350.log 2>&1 & +./objs/srs -c conf/demo.19350.conf ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动SRS转发服务器失败"; exit $ret; fi echo "启动SRS转发服务器成功" diff --git a/trunk/scripts/_step.start.srs.sh b/trunk/scripts/_step.start.srs.sh index 76e7bbd82..a9d571d45 100755 --- a/trunk/scripts/_step.start.srs.sh +++ b/trunk/scripts/_step.start.srs.sh @@ -2,10 +2,10 @@ src_dir='src' if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; exit 1; fi -cmd="nohup ./objs/srs -c conf/demo.conf >./objs/demo.log 2>&1 &" +cmd="./objs/srs -c conf/demo.conf" echo "启动SRS服务器:$cmd" pids=`ps aux|grep srs|grep "./objs"|grep "demo.conf"|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done -nohup ./objs/srs -c conf/demo.conf >./objs/demo.log 2>&1 & +./objs/srs -c conf/demo.conf ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动SRS失败"; exit $ret; fi echo "启动SRS服务器成功" diff --git a/trunk/src/app/srs_app_hls.cpp b/trunk/src/app/srs_app_hls.cpp index 356b180da..4a04ee787 100644 --- a/trunk/src/app/srs_app_hls.cpp +++ b/trunk/src/app/srs_app_hls.cpp @@ -693,15 +693,17 @@ int SrsHlsMuxer::segment_close(string log_desc) // close the muxer of finished segment. srs_freep(current->muxer); + std::string full_path = current->full_path; + current = NULL; + // rename from tmp to real path - std::string tmp_file = current->full_path + ".tmp"; - if (rename(tmp_file.c_str(), current->full_path.c_str()) < 0) { + std::string tmp_file = full_path + ".tmp"; + if (rename(tmp_file.c_str(), full_path.c_str()) < 0) { ret = ERROR_HLS_WRITE_FAILED; srs_error("rename ts file failed, %s => %s. ret=%d", - tmp_file.c_str(), current->full_path.c_str(), ret); + tmp_file.c_str(), full_path.c_str(), ret); return ret; } - current = NULL; } else { // reuse current segment index. file_index--; diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index c152ef816..a08f0f2dc 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // current release version #define VERSION_MAJOR "0" #define VERSION_MINOR "9" -#define VERSION_REVISION "35" +#define VERSION_REVISION "36" #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION // server info. #define RTMP_SIG_SRS_KEY "srs"