From 10297fab519811845b549a8af40a6bcbd23411e8 Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 12 Dec 2014 21:51:06 +0800 Subject: [PATCH] fix #257, support 0.1s+ latency. 2.0.70 --- README.md | 2 + trunk/conf/full.conf | 13 ++++++ trunk/conf/realtime.conf | 3 +- trunk/research/players/js/srs.player.js | 2 +- trunk/research/players/srs_player.html | 14 ++++++- trunk/src/app/srs_app_config.cpp | 32 +++++++++++++-- trunk/src/app/srs_app_config.hpp | 6 +++ trunk/src/app/srs_app_recv_thread.cpp | 32 +++++++++++++-- trunk/src/app/srs_app_recv_thread.hpp | 4 ++ trunk/src/app/srs_app_reload.cpp | 5 +++ trunk/src/app/srs_app_reload.hpp | 1 + trunk/src/app/srs_app_rtmp_conn.cpp | 54 ++++++++++++++++++++----- trunk/src/app/srs_app_rtmp_conn.hpp | 4 ++ trunk/src/app/srs_app_source.cpp | 13 ++++-- trunk/src/app/srs_app_source.hpp | 3 +- trunk/src/core/srs_core.hpp | 2 +- trunk/src/core/srs_core_performance.hpp | 9 +++++ trunk/src/kernel/srs_kernel_utility.cpp | 8 ++-- trunk/src/kernel/srs_kernel_utility.hpp | 2 +- 19 files changed, 179 insertions(+), 30 deletions(-) mode change 100644 => 100755 trunk/research/players/srs_player.html diff --git a/README.md b/README.md index c21401c974..96890e4d61 100755 --- a/README.md +++ b/README.md @@ -453,6 +453,7 @@ Supported operating systems and hardware: [CN](https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_SrsLibrtmp#publish-audio-raw-stream), [EN](https://github.com/winlinvip/simple-rtmp-server/wiki/v2_EN_SrsLibrtmp#publish-audio-raw-stream) ) by srs-librtmp. +1. Support 0.1s+ latency, read [#257](https://github.com/winlinvip/simple-rtmp-server/issues/257). 1. [no-plan] Support <500ms latency, FRSC(Fast RTMP-compatible Stream Channel tech). 1. [no-plan] Support RTMP 302 redirect [#92](https://github.com/winlinvip/simple-rtmp-server/issues/92). 1. [no-plan] Support multiple processes, for both origin and edge @@ -486,6 +487,7 @@ Supported operating systems and hardware: * 2013-10-17, Created.
## History +* v2.0, 2014-12-12, fix [#257](https://github.com/winlinvip/simple-rtmp-server/issues/257), support 0.1s+ latency. 2.0.70 * v2.0, 2014-12-08, update wiki for mr([EN](https://github.com/winlinvip/simple-rtmp-server/wiki/v2_EN_LowLatency#merged-read), [CN](https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_LowLatency#merged-read)) and mw([EN](https://github.com/winlinvip/simple-rtmp-server/wiki/v2_EN_LowLatency#merged-write), [CN](https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_LowLatency#merged-write)). * v2.0, 2014-12-07, fix [#251](https://github.com/winlinvip/simple-rtmp-server/issues/251), 10k+ clients, use queue cond wait and fast vector. 2.0.67 * v2.0, 2014-12-05, fix [#251](https://github.com/winlinvip/simple-rtmp-server/issues/251), 9k+ clients, use fast cache for msgs queue. 2.0.57 diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index de0ca04987..343e51b8d1 100755 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -145,6 +145,13 @@ vhost __defaultVhost__ { # the MR(merged-read) setting for publisher. # the MW(merged-write) settings for player. vhost mrw.srs.com { + # whether enable min delay mode for vhost. + # for min latence mode: + # 1. disable the mr for vhost. + # 2. use timeout for cond wait for consumer queue. + # @see https://github.com/winlinvip/simple-rtmp-server/issues/257 + # default: on + min_latency off; # about MR, read https://github.com/winlinvip/simple-rtmp-server/issues/241 mr { # whether enable the MR(merged-read) @@ -440,6 +447,12 @@ vhost debug.srs.com { # the vhost for min delay, donot cache any stream. vhost min.delay.com { + # @see vhost mrw.srs.com for detail. + min_latency on; + mr { + enabled off; + } + mw_latency 100; # whether cache the last gop. # if on, cache the last gop and dispatch to client, # to enabled fast startup for client, client play immediately. diff --git a/trunk/conf/realtime.conf b/trunk/conf/realtime.conf index 00ccd03c54..4ac824b6f4 100755 --- a/trunk/conf/realtime.conf +++ b/trunk/conf/realtime.conf @@ -1,5 +1,5 @@ # the config for srs to delivery realtime RTMP stream -# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleRealtime +# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_SampleRealtime # @see full.conf for detail config. listen 1935; @@ -7,6 +7,7 @@ max_connections 1000; vhost __defaultVhost__ { gop_cache off; queue_length 10; + min_latency on; mr { enabled off; } diff --git a/trunk/research/players/js/srs.player.js b/trunk/research/players/js/srs.player.js index dad0ba9278..f04859ca9c 100755 --- a/trunk/research/players/js/srs.player.js +++ b/trunk/research/players/js/srs.player.js @@ -22,7 +22,7 @@ function SrsPlayer(container, width, height, private_object) { this.height = height; this.id = SrsPlayer.__id++; this.stream_url = null; - this.buffer_time = 0.8; // default to 0.8 + this.buffer_time = 0.3; // default to 0.3 this.volume = 1.0; // default to 100% this.callbackObj = null; diff --git a/trunk/research/players/srs_player.html b/trunk/research/players/srs_player.html old mode 100644 new mode 100755 index 4e26ed0468..0345d16f59 --- a/trunk/research/players/srs_player.html +++ b/trunk/research/players/srs_player.html @@ -96,7 +96,7 @@ srs_player = new SrsPlayer("player_id", srs_get_player_width(), srs_get_player_height()); srs_player.on_player_ready = function() { - select_buffer_time("#btn_bt_0_8", 0.8); + select_buffer_time("#btn_bt_0_1", 0.1); this.play(url); }; srs_player.on_player_metadata = function(metadata) { @@ -231,6 +231,15 @@ } if (true) { + $("#btn_bt_0_1").click(function(){ + select_buffer_time("#btn_bt_0_1", 0.1); + }); + $("#btn_bt_0_2").click(function(){ + select_buffer_time("#btn_bt_0_2", 0.2); + }); + $("#btn_bt_0_3").click(function(){ + select_buffer_time("#btn_bt_0_3", 0.3); + }); $("#btn_bt_0_5").click(function(){ select_buffer_time("#btn_bt_0_5", 0.5); }); @@ -504,6 +513,9 @@

SrsPlayer