From 6b99a749ead039915119f90e0cbf065f8396cad9 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 23 Dec 2013 10:58:41 +0800 Subject: [PATCH] refine the chat, use players_pub_rtmp without hls and gopcache, low latecy --- trunk/conf/srs.conf | 7 +++ trunk/research/players/js/srs.js | 84 +++++++++++++++++++++++++++- trunk/research/players/srs_chat.html | 8 +-- 3 files changed, 93 insertions(+), 6 deletions(-) diff --git a/trunk/conf/srs.conf b/trunk/conf/srs.conf index 7e136eb8c..18482fbf8 100755 --- a/trunk/conf/srs.conf +++ b/trunk/conf/srs.conf @@ -142,6 +142,13 @@ vhost players_pub { hls_window 30; } } +# rtmp only, no hls, for chat(low latecy) +vhost players_pub_rtmp { + gop_cache off; + hls { + enabled off; + } +} # for development vhost dev { diff --git a/trunk/research/players/js/srs.js b/trunk/research/players/js/srs.js index dda3ec22a..da86a5667 100755 --- a/trunk/research/players/js/srs.js +++ b/trunk/research/players/js/srs.js @@ -121,7 +121,7 @@ function build_default_publish_rtmp_url() { if (server == vhost || vhost == "") { return "rtmp://" + server + ":" + port + "/" + app + "/" + stream; } else { - vhost = srs_get_player_publish_vhost(vhost); + vhost = srs_get_player_chat_vhost(vhost); return "rtmp://" + server + ":" + port + "/" + app + "...vhost..." + vhost + "/" + stream; } } @@ -211,6 +211,8 @@ function srs_get_api_server_port() { return 8085; } // for example, src_vhost is "players", we transcode stream to vhost "players_pub". // if not equals to the player vhost, return the orignal vhost. function srs_get_player_publish_vhost(src_vhost) { return (src_vhost != srs_get_player_vhost())? src_vhost:(src_vhost + "_pub"); } +// for chat, use rtmp only vhost, low latecy, without gop cache. +function srs_get_player_chat_vhost(src_vhost) { return (src_vhost != srs_get_player_vhost())? src_vhost:(src_vhost + "_pub_rtmp"); } /** * initialize the page. @@ -276,6 +278,7 @@ function srs_publisher_initialize_page( for (var i = 0; i < profiles.length; i++) { $(sl_profile).append("