winlin

for #324, always enable hstrs. 3.0.10

@@ -132,6 +132,7 @@ Please select your language: @@ -132,6 +132,7 @@ Please select your language:
132 132
133 ### V3 changes 133 ### V3 changes
134 134
  135 +* v3.0, 2017-01-05, for [#324][bug #324], always enable hstrs. 3.0.10
135 * v3.0, 2016-12-15, fix [#717][bug #717], [#691][bug #691], http api/static/stream support cors. 3.0.9 136 * v3.0, 2016-12-15, fix [#717][bug #717], [#691][bug #691], http api/static/stream support cors. 3.0.9
136 * v3.0, 2016-12-08, support log rotate signal SIGUSR1. 3.0.8 137 * v3.0, 2016-12-08, support log rotate signal SIGUSR1. 3.0.8
137 * v3.0, 2016-12-07, fix typo and refine grammar. 3.0.7 138 * v3.0, 2016-12-07, fix typo and refine grammar. 3.0.7
@@ -767,11 +767,6 @@ vhost http.remux.srs.com { @@ -767,11 +767,6 @@ vhost http.remux.srs.com {
767 # @remark the port of http is specified by http_server section. 767 # @remark the port of http is specified by http_server section.
768 # default: [vhost]/[app]/[stream].flv 768 # default: [vhost]/[app]/[stream].flv
769 mount [vhost]/[app]/[stream].flv; 769 mount [vhost]/[app]/[stream].flv;
770 - # whether http stream trigger rtmp stream source when no stream available,  
771 - # for example, when encoder has not publish stream yet,  
772 - # user can play the http flv stream and wait for stream.  
773 - # default: off  
774 - hstrs off;  
775 } 770 }
776 } 771 }
777 772
@@ -105,7 +105,6 @@ vhost vhost.srs.com { @@ -105,7 +105,6 @@ vhost vhost.srs.com {
105 enabled off; 105 enabled off;
106 fast_cache 30; 106 fast_cache 30;
107 mount [vhost]/[app]/[stream].flv; 107 mount [vhost]/[app]/[stream].flv;
108 - hstrs on;  
109 } 108 }
110 http_hooks { 109 http_hooks {
111 enabled off; 110 enabled off;
@@ -14,7 +14,5 @@ vhost __defaultVhost__ { @@ -14,7 +14,5 @@ vhost __defaultVhost__ {
14 enabled on; 14 enabled on;
15 fast_cache 30; 15 fast_cache 30;
16 mount [vhost]/[app]/[stream].aac; 16 mount [vhost]/[app]/[stream].aac;
17 - hstrs on;  
18 -  
19 } 17 }
20 } 18 }
@@ -13,6 +13,5 @@ vhost __defaultVhost__ { @@ -13,6 +13,5 @@ vhost __defaultVhost__ {
13 http_remux { 13 http_remux {
14 enabled on; 14 enabled on;
15 mount [vhost]/[app]/[stream].flv; 15 mount [vhost]/[app]/[stream].flv;
16 - hstrs on;  
17 } 16 }
18 } 17 }
@@ -19,6 +19,5 @@ vhost __defaultVhost__ { @@ -19,6 +19,5 @@ vhost __defaultVhost__ {
19 http_remux { 19 http_remux {
20 enabled on; 20 enabled on;
21 mount [vhost]/[app]/[stream].flv; 21 mount [vhost]/[app]/[stream].flv;
22 - hstrs on;  
23 } 22 }
24 } 23 }
@@ -19,6 +19,5 @@ vhost __defaultVhost__ { @@ -19,6 +19,5 @@ vhost __defaultVhost__ {
19 http_remux { 19 http_remux {
20 enabled on; 20 enabled on;
21 mount [vhost]/[app]/[stream].flv; 21 mount [vhost]/[app]/[stream].flv;
22 - hstrs on;  
23 } 22 }
24 } 23 }
@@ -14,7 +14,5 @@ vhost __defaultVhost__ { @@ -14,7 +14,5 @@ vhost __defaultVhost__ {
14 enabled on; 14 enabled on;
15 fast_cache 30; 15 fast_cache 30;
16 mount [vhost]/[app]/[stream].mp3; 16 mount [vhost]/[app]/[stream].mp3;
17 - hstrs on;  
18 -  
19 } 17 }
20 } 18 }
@@ -13,6 +13,5 @@ vhost __defaultVhost__ { @@ -13,6 +13,5 @@ vhost __defaultVhost__ {
13 http_remux { 13 http_remux {
14 enabled on; 14 enabled on;
15 mount [vhost]/[app]/[stream].ts; 15 mount [vhost]/[app]/[stream].ts;
16 - hstrs on;  
17 } 16 }
18 } 17 }
@@ -367,6 +367,15 @@ int srs_config_transform_vhost(SrsConfDirective* root) @@ -367,6 +367,15 @@ int srs_config_transform_vhost(SrsConfDirective* root)
367 continue; 367 continue;
368 } 368 }
369 369
  370 + // SRS3.0, ignore hstrs, always on.
  371 + // SRS1/2:
  372 + // vhost { http_remux { hstrs; } }
  373 + if (n == "http_remux") {
  374 + SrsConfDirective* hstrs = conf->get("hstrs");
  375 + conf->remove(hstrs);
  376 + srs_freep(hstrs);
  377 + }
  378 +
370 // SRS3.0, change the refer style 379 // SRS3.0, change the refer style
371 // SRS1/2: 380 // SRS1/2:
372 // vhost { refer; refer_play; refer_publish; } 381 // vhost { refer; refer_play; refer_publish; }
@@ -2553,8 +2562,6 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsJsonObject* obj) @@ -2553,8 +2562,6 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsJsonObject* obj)
2553 http_remux->set("fast_cache", sdir->dumps_arg0_to_integer()); 2562 http_remux->set("fast_cache", sdir->dumps_arg0_to_integer());
2554 } else if (sdir->name == "mount") { 2563 } else if (sdir->name == "mount") {
2555 http_remux->set("mount", sdir->dumps_arg0_to_str()); 2564 http_remux->set("mount", sdir->dumps_arg0_to_str());
2556 - } else if (sdir->name == "hstrs") {  
2557 - http_remux->set("hstrs", sdir->dumps_arg0_to_boolean());  
2558 } 2565 }
2559 } 2566 }
2560 } 2567 }
@@ -3903,7 +3910,7 @@ int SrsConfig::check_config() @@ -3903,7 +3910,7 @@ int SrsConfig::check_config()
3903 } else if (n == "http_remux") { 3910 } else if (n == "http_remux") {
3904 for (int j = 0; j < (int)conf->directives.size(); j++) { 3911 for (int j = 0; j < (int)conf->directives.size(); j++) {
3905 string m = conf->at(j)->name.c_str(); 3912 string m = conf->at(j)->name.c_str();
3906 - if (m != "enabled" && m != "mount" && m != "fast_cache" && m != "hstrs") { 3913 + if (m != "enabled" && m != "mount" && m != "fast_cache") {
3907 ret = ERROR_SYSTEM_CONFIG_INVALID; 3914 ret = ERROR_SYSTEM_CONFIG_INVALID;
3908 srs_error("unsupported vhost http_remux directive %s, ret=%d", m.c_str(), ret); 3915 srs_error("unsupported vhost http_remux directive %s, ret=%d", m.c_str(), ret);
3909 return ret; 3916 return ret;
@@ -6751,29 +6758,6 @@ string SrsConfig::get_vhost_http_remux_mount(string vhost) @@ -6751,29 +6758,6 @@ string SrsConfig::get_vhost_http_remux_mount(string vhost)
6751 return conf->arg0(); 6758 return conf->arg0();
6752 } 6759 }
6753 6760
6754 -bool SrsConfig::get_vhost_http_remux_hstrs(string vhost)  
6755 -{  
6756 - // the HSTRS must default to false for origin.  
6757 - static bool DEFAULT = false;  
6758 -  
6759 - SrsConfDirective* conf = get_vhost(vhost);  
6760 - if (!conf) {  
6761 - return DEFAULT;  
6762 - }  
6763 -  
6764 - conf = conf->get("http_remux");  
6765 - if (!conf) {  
6766 - return DEFAULT;  
6767 - }  
6768 -  
6769 - conf = conf->get("hstrs");  
6770 - if (!conf || conf->arg0().empty()) {  
6771 - return DEFAULT;  
6772 - }  
6773 -  
6774 - return SRS_CONF_PERFER_TRUE(conf->arg0());  
6775 -}  
6776 -  
6777 SrsConfDirective* SrsConfig::get_heartbeart() 6761 SrsConfDirective* SrsConfig::get_heartbeart()
6778 { 6762 {
6779 return root->get("heartbeat"); 6763 return root->get("heartbeat");
@@ -1358,10 +1358,6 @@ public: @@ -1358,10 +1358,6 @@ public:
1358 * used to generate the flv stream mount path. 1358 * used to generate the flv stream mount path.
1359 */ 1359 */
1360 virtual std::string get_vhost_http_remux_mount(std::string vhost); 1360 virtual std::string get_vhost_http_remux_mount(std::string vhost);
1361 - /**  
1362 - * get whether the hstrs(http stream trigger rtmp source) enabled.  
1363 - */  
1364 - virtual bool get_vhost_http_remux_hstrs(std::string vhost);  
1365 // http heartbeart section 1361 // http heartbeart section
1366 private: 1362 private:
1367 /** 1363 /**
@@ -622,10 +622,9 @@ int SrsLiveStream::streaming_send_messages(ISrsBufferEncoder* enc, SrsSharedPtrM @@ -622,10 +622,9 @@ int SrsLiveStream::streaming_send_messages(ISrsBufferEncoder* enc, SrsSharedPtrM
622 return ret; 622 return ret;
623 } 623 }
624 624
625 -SrsLiveEntry::SrsLiveEntry(std::string m, bool h) 625 +SrsLiveEntry::SrsLiveEntry(std::string m)
626 { 626 {
627 mount = m; 627 mount = m;
628 - hstrs = h;  
629 628
630 stream = NULL; 629 stream = NULL;
631 cache = NULL; 630 cache = NULL;
@@ -640,11 +639,6 @@ SrsLiveEntry::SrsLiveEntry(std::string m, bool h) @@ -640,11 +639,6 @@ SrsLiveEntry::SrsLiveEntry(std::string m, bool h)
640 _is_aac = (ext == ".aac"); 639 _is_aac = (ext == ".aac");
641 } 640 }
642 641
643 -void SrsLiveEntry::reset_hstrs(bool h)  
644 -{  
645 - hstrs = h;  
646 -}  
647 -  
648 bool SrsLiveEntry::is_flv() 642 bool SrsLiveEntry::is_flv()
649 { 643 {
650 return _is_flv; 644 return _is_flv;
@@ -806,7 +800,7 @@ int SrsHttpStreamServer::http_mount(SrsSource* s, SrsRequest* r) @@ -806,7 +800,7 @@ int SrsHttpStreamServer::http_mount(SrsSource* s, SrsRequest* r)
806 // remove the default vhost mount 800 // remove the default vhost mount
807 mount = srs_string_replace(mount, SRS_CONSTS_RTMP_DEFAULT_VHOST"/", "/"); 801 mount = srs_string_replace(mount, SRS_CONSTS_RTMP_DEFAULT_VHOST"/", "/");
808 802
809 - entry = new SrsLiveEntry(mount, tmpl->hstrs); 803 + entry = new SrsLiveEntry(mount);
810 804
811 entry->cache = new SrsBufferCache(s, r); 805 entry->cache = new SrsBufferCache(s, r);
812 entry->stream = new SrsLiveStream(s, r, entry->cache); 806 entry->stream = new SrsLiveStream(s, r, entry->cache);
@@ -906,9 +900,6 @@ int SrsHttpStreamServer::on_reload_vhost_http_remux_updated(string vhost) @@ -906,9 +900,6 @@ int SrsHttpStreamServer::on_reload_vhost_http_remux_updated(string vhost)
906 900
907 string old_tmpl_mount = tmpl->mount; 901 string old_tmpl_mount = tmpl->mount;
908 string new_tmpl_mount = _srs_config->get_vhost_http_remux_mount(vhost); 902 string new_tmpl_mount = _srs_config->get_vhost_http_remux_mount(vhost);
909 - bool hstrs = _srs_config->get_vhost_http_remux_hstrs(vhost);  
910 -  
911 - tmpl->reset_hstrs(hstrs);  
912 903
913 /** 904 /**
914 * TODO: not support to reload different mount url for the time being. 905 * TODO: not support to reload different mount url for the time being.
@@ -920,11 +911,7 @@ int SrsHttpStreamServer::on_reload_vhost_http_remux_updated(string vhost) @@ -920,11 +911,7 @@ int SrsHttpStreamServer::on_reload_vhost_http_remux_updated(string vhost)
920 // do http mount directly with SrsRequest and SrsSource if stream is played already. 911 // do http mount directly with SrsRequest and SrsSource if stream is played already.
921 if (req) { 912 if (req) {
922 std::string sid = req->get_stream_url(); 913 std::string sid = req->get_stream_url();
923 -  
924 - if (sflvs.find(sid) != sflvs.end()) {  
925 - SrsLiveEntry* stream = sflvs[sid];  
926 - stream->reset_hstrs(hstrs);  
927 - } 914 +
928 // remount stream. 915 // remount stream.
929 if ((ret = http_mount(source, req)) != ERROR_SUCCESS) { 916 if ((ret = http_mount(source, req)) != ERROR_SUCCESS) {
930 srs_trace("vhost %s http_remux reload failed", vhost.c_str()); 917 srs_trace("vhost %s http_remux reload failed", vhost.c_str());
@@ -971,15 +958,12 @@ int SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph) @@ -971,15 +958,12 @@ int SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph)
971 return ret; 958 return ret;
972 } 959 }
973 960
974 - // hstrs not enabled, ignore. 961 + // hstrs always enabled.
975 // for origin, the http stream will be mount already when publish, 962 // for origin, the http stream will be mount already when publish,
976 // so it must never enter this line for stream already mounted. 963 // so it must never enter this line for stream already mounted.
977 // for edge, the http stream is trigger by hstrs and mount by it, 964 // for edge, the http stream is trigger by hstrs and mount by it,
978 // so we only hijack when only edge and hstrs is on. 965 // so we only hijack when only edge and hstrs is on.
979 entry = it->second; 966 entry = it->second;
980 - if (!entry->hstrs) {  
981 - return ret;  
982 - }  
983 967
984 // check entry and request extension. 968 // check entry and request extension.
985 if (entry->is_flv()) { 969 if (entry->is_flv()) {
@@ -1048,7 +1032,7 @@ int SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph) @@ -1048,7 +1032,7 @@ int SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph)
1048 1032
1049 // trigger edge to fetch from origin. 1033 // trigger edge to fetch from origin.
1050 bool vhost_is_edge = _srs_config->get_vhost_is_edge(r->vhost); 1034 bool vhost_is_edge = _srs_config->get_vhost_is_edge(r->vhost);
1051 - srs_trace("hstrs: source url=%s, is_edge=%d, source_id=%d[%d]", 1035 + srs_trace("flv: source url=%s, is_edge=%d, source_id=%d[%d]",
1052 r->get_stream_url().c_str(), vhost_is_edge, s->source_id(), s->source_id()); 1036 r->get_stream_url().c_str(), vhost_is_edge, s->source_id(), s->source_id());
1053 1037
1054 return ret; 1038 return ret;
@@ -1083,8 +1067,7 @@ int SrsHttpStreamServer::initialize_flv_entry(std::string vhost) @@ -1083,8 +1067,7 @@ int SrsHttpStreamServer::initialize_flv_entry(std::string vhost)
1083 } 1067 }
1084 1068
1085 SrsLiveEntry* entry = new SrsLiveEntry( 1069 SrsLiveEntry* entry = new SrsLiveEntry(
1086 - _srs_config->get_vhost_http_remux_mount(vhost),  
1087 - _srs_config->get_vhost_http_remux_hstrs(vhost) 1070 + _srs_config->get_vhost_http_remux_mount(vhost)
1088 ); 1071 );
1089 1072
1090 tflvs[vhost] = entry; 1073 tflvs[vhost] = entry;
@@ -252,14 +252,11 @@ public: @@ -252,14 +252,11 @@ public:
252 // for template, the mount contains variables. 252 // for template, the mount contains variables.
253 // for concrete stream, the mount is url to access. 253 // for concrete stream, the mount is url to access.
254 std::string mount; 254 std::string mount;
255 - // whether hstrs(http stream trigger rtmp source)  
256 - bool hstrs;  
257 255
258 SrsLiveStream* stream; 256 SrsLiveStream* stream;
259 SrsBufferCache* cache; 257 SrsBufferCache* cache;
260 258
261 - SrsLiveEntry(std::string m, bool h);  
262 - void reset_hstrs(bool h); 259 + SrsLiveEntry(std::string m);
263 260
264 bool is_flv(); 261 bool is_flv();
265 bool is_ts(); 262 bool is_ts();
@@ -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 3 32 #define VERSION_MAJOR 3
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 9 34 +#define VERSION_REVISION 10
35 35
36 // generated by configure, only macros. 36 // generated by configure, only macros.
37 #include <srs_auto_headers.hpp> 37 #include <srs_auto_headers.hpp>