From 1d01ef499d0be5be068c74c8d35439b96bd2ee3a Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 20 Feb 2020 01:06:33 +0800 Subject: [PATCH 1/7] For #1579, support rolling update of k8s. 4.0.7 --- README.md | 1 + trunk/src/core/srs_core_version4.hpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 628a135f6..99dd9e68f 100755 --- a/README.md +++ b/README.md @@ -153,6 +153,7 @@ For previous versions, please read: ## V4 changes +* v4.0, 2020-02-19, For [#1579][bug #1579], support rolling update of k8s. 4.0.7 * v4.0, 2020-02-18, For [#1579][bug #1579], support start/final wait for gracefully quit. 4.0.6 * v4.0, 2020-02-18, For [#1579][bug #1579], support gracefully quit and force to. 4.0.5 * v4.0, 2020-02-13, SRT supports detail config for [DynamicEncoding](https://github.com/runner365/srt_encoder). 4.0.4 diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 8e9e26875..f6717ca54 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -24,6 +24,6 @@ #ifndef SRS_CORE_VERSION4_HPP #define SRS_CORE_VERSION4_HPP -#define SRS_VERSION4_REVISION 6 +#define SRS_VERSION4_REVISION 7 #endif From 4a69499f2c989c6748517a6efdd8c490ca7c4b4b Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 21 Feb 2020 23:11:09 +0800 Subject: [PATCH 2/7] Fix bug for librtmp client ipv4/ipv6 socket. 3.0.122 --- README.md | 1 + trunk/src/core/srs_core_version3.hpp | 2 +- trunk/src/libs/srs_lib_simple_socket.cpp | 45 +++++++++++++++++------- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index eb7664c91..4f4ee7545 100755 --- a/README.md +++ b/README.md @@ -146,6 +146,7 @@ For previous versions, please read: ## V3 changes +* v3.0, 2020-02-21, Fix bug for librtmp client ipv4/ipv6 socket. 3.0.122 * v3.0, 2020-02-18, For [#1579][bug #1579], support start/final wait for gracefully quit. 3.0.121 * v3.0, 2020-02-18, For [#1579][bug #1579], support force gracefully quit. 3.0.120 * v3.0, 2020-02-18, For [#1579][bug #1579], support gracefully quit. 3.0.119 diff --git a/trunk/src/core/srs_core_version3.hpp b/trunk/src/core/srs_core_version3.hpp index ac541b5e4..801fd91fe 100644 --- a/trunk/src/core/srs_core_version3.hpp +++ b/trunk/src/core/srs_core_version3.hpp @@ -24,6 +24,6 @@ #ifndef SRS_CORE_VERSION3_HPP #define SRS_CORE_VERSION3_HPP -#define SRS_VERSION3_REVISION 121 +#define SRS_VERSION3_REVISION 122 #endif diff --git a/trunk/src/libs/srs_lib_simple_socket.cpp b/trunk/src/libs/srs_lib_simple_socket.cpp index d67a48308..59adf2278 100644 --- a/trunk/src/libs/srs_lib_simple_socket.cpp +++ b/trunk/src/libs/srs_lib_simple_socket.cpp @@ -77,8 +77,11 @@ #ifndef SRS_HIJACK_IO struct SrsBlockSyncSocket { + int family; SOCKET fd; - int family; + SOCKET fdv4; + SOCKET fdv6; + // Bytes transmit. int64_t rbytes; int64_t sbytes; // The send/recv timeout in ms. @@ -86,15 +89,26 @@ struct SrsBlockSyncSocket int64_t stm; SrsBlockSyncSocket() { + family = AF_UNSPEC; stm = rtm = SRS_UTIME_NO_TIMEOUT; rbytes = sbytes = 0; SOCKET_RESET(fd); + SOCKET_RESET(fdv4); + SOCKET_RESET(fdv6); SOCKET_SETUP(); } virtual ~SrsBlockSyncSocket() { - SOCKET_CLOSE(fd); + if (SOCKET_VALID(fd)) { + SOCKET_CLOSE(fd); + } + if (SOCKET_VALID(fdv4)) { + SOCKET_CLOSE(fdv4); + } + if (SOCKET_VALID(fdv6)) { + SOCKET_CLOSE(fdv6); + } SOCKET_CLEANUP(); } }; @@ -112,19 +126,17 @@ int srs_hijack_io_create_socket(srs_hijack_io_t ctx, srs_rtmp_t owner) { SrsBlockSyncSocket* skt = (SrsBlockSyncSocket*)ctx; - skt->family = AF_INET6; - skt->fd = ::socket(skt->family, SOCK_STREAM, 0); // Try IPv6 first. - if (!SOCKET_VALID(skt->fd)) { - skt->family = AF_INET; - skt->fd = ::socket(skt->family, SOCK_STREAM, 0); // Try IPv4 instead, if IPv6 fails. - } - if (!SOCKET_VALID(skt->fd)) { + skt->family = AF_UNSPEC; + skt->fdv4 = ::socket(AF_INET, SOCK_STREAM, 0); + skt->fdv6 = ::socket(AF_INET6, SOCK_STREAM, 0); + if (!SOCKET_VALID(skt->fdv4) && !SOCKET_VALID(skt->fdv4)) { return ERROR_SOCKET_CREATE; } // No TCP cache. int v = 1; - setsockopt(skt->fd, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v)); + setsockopt(skt->fdv4, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v)); + setsockopt(skt->fdv6, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v)); return ERROR_SUCCESS; } @@ -137,7 +149,7 @@ int srs_hijack_io_connect(srs_hijack_io_t ctx, const char* server_ip, int port) addrinfo hints; memset(&hints, 0, sizeof(hints)); - hints.ai_family = skt->family; + hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; addrinfo* r = NULL; @@ -145,7 +157,16 @@ int srs_hijack_io_connect(srs_hijack_io_t ctx, const char* server_ip, int port) if(getaddrinfo(server_ip, sport, (const addrinfo*)&hints, &r)) { return ERROR_SOCKET_CONNECT; } - + + skt->family = r->ai_family; + if (r->ai_family == AF_INET6) { + skt->fd = skt->fdv6; + SOCKET_RESET(skt->fdv6); + } else { + skt->fd = skt->fdv4; + SOCKET_RESET(skt->fdv4); + } + if(::connect(skt->fd, r->ai_addr, r->ai_addrlen) < 0){ return ERROR_SOCKET_CONNECT; } From 20b9d6ab026620cdcc773725169ac745bcea6802 Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 21 Feb 2020 23:51:40 +0800 Subject: [PATCH 3/7] For #1598, support SLB health checking by TCP. 3.0.123 --- README.md | 2 ++ trunk/conf/full.conf | 4 ++++ trunk/src/app/srs_app_caster_flv.cpp | 6 +++++- trunk/src/app/srs_app_config.cpp | 14 +++++++++++++- trunk/src/app/srs_app_config.hpp | 2 ++ trunk/src/app/srs_app_rtsp.cpp | 3 +++ trunk/src/app/srs_app_server.cpp | 4 ++++ trunk/src/core/srs_core_version3.hpp | 2 +- 8 files changed, 34 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4f4ee7545..e72c4e14f 100755 --- a/README.md +++ b/README.md @@ -146,6 +146,7 @@ For previous versions, please read: ## V3 changes +* v3.0, 2020-02-21, For [#1598][bug #1598], support SLB health checking by TCP. 3.0.123 * v3.0, 2020-02-21, Fix bug for librtmp client ipv4/ipv6 socket. 3.0.122 * v3.0, 2020-02-18, For [#1579][bug #1579], support start/final wait for gracefully quit. 3.0.121 * v3.0, 2020-02-18, For [#1579][bug #1579], support force gracefully quit. 3.0.120 @@ -1656,6 +1657,7 @@ Winlin [bug #1595]: https://github.com/ossrs/srs/issues/1595 [bug #1601]: https://github.com/ossrs/srs/issues/1601 [bug #1579]: https://github.com/ossrs/srs/issues/1579 +[bug #1598]: https://github.com/ossrs/srs/issues/1598 [bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx [exo #828]: https://github.com/google/ExoPlayer/pull/828 diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index 65d5ddb48..b56f27fbc 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -72,6 +72,10 @@ work_dir ./; # @reamrk do not support reload. # default: off asprocess off; +# Whether client empty IP is ok, for example, health checking by SLB. +# If ok(on), we will ignore this connection without warnings or errors. +# default: on +empty_ip_ok on; # For gracefully quit, wait for a while then close listeners, # because K8S notify SRS with SIGQUIT and update Service simultaneously, diff --git a/trunk/src/app/srs_app_caster_flv.cpp b/trunk/src/app/srs_app_caster_flv.cpp index 7526921cc..d6f3150f7 100644 --- a/trunk/src/app/srs_app_caster_flv.cpp +++ b/trunk/src/app/srs_app_caster_flv.cpp @@ -76,8 +76,12 @@ srs_error_t SrsAppCasterFlv::initialize() srs_error_t SrsAppCasterFlv::on_tcp_client(srs_netfd_t stfd) { srs_error_t err = srs_success; - + string ip = srs_get_peer_ip(srs_netfd_fileno(stfd)); + if (ip.empty() && !_srs_config->empty_ip_ok()) { + srs_warn("empty ip for fd=%d", srs_netfd_fileno(stfd)); + } + SrsHttpConn* conn = new SrsDynamicHttpConn(this, stfd, http_mux, ip); conns.push_back(conn); diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 3c0af54de..3eb7483a5 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -3488,7 +3488,7 @@ srs_error_t SrsConfig::check_normal_config() && n != "http_server" && n != "stream_caster" && n != "utc_time" && n != "work_dir" && n != "asprocess" && n != "ff_log_level" && n != "grace_final_wait" && n != "force_grace_quit" - && n != "grace_start_wait" + && n != "grace_start_wait" && n != "empty_ip_ok" ) { return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal directive %s", n.c_str()); } @@ -4051,6 +4051,18 @@ bool SrsConfig::get_asprocess() return SRS_CONF_PERFER_FALSE(conf->arg0()); } +bool SrsConfig::empty_ip_ok() +{ + static bool DEFAULT = true; + + SrsConfDirective* conf = root->get("empty_ip_ok"); + if (!conf || conf->arg0().empty()) { + return DEFAULT; + } + + return SRS_CONF_PERFER_TRUE(conf->arg0()); +} + srs_utime_t SrsConfig::get_grace_start_wait() { static srs_utime_t DEFAULT = 2300 * SRS_UTIME_MILLISECONDS; diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index 2bd2882b3..0b94470da 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -468,6 +468,8 @@ public: virtual std::string get_work_dir(); // Whether use asprocess mode. virtual bool get_asprocess(); + // Whether empty client IP is ok. + virtual bool empty_ip_ok(); // Get the start wait in ms for gracefully quit. virtual srs_utime_t get_grace_start_wait(); // Get the final wait in ms for gracefully quit. diff --git a/trunk/src/app/srs_app_rtsp.cpp b/trunk/src/app/srs_app_rtsp.cpp index 051071b49..62ebfdcd1 100644 --- a/trunk/src/app/srs_app_rtsp.cpp +++ b/trunk/src/app/srs_app_rtsp.cpp @@ -243,6 +243,9 @@ srs_error_t SrsRtspConn::do_cycle() // retrieve ip of client. std::string ip = srs_get_peer_ip(srs_netfd_fileno(stfd)); + if (ip.empty() && !_srs_config->empty_ip_ok()) { + srs_warn("empty ip for fd=%d", srs_netfd_fileno(stfd)); + } srs_trace("rtsp: serve %s", ip.c_str()); // consume all rtsp messages. diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index b82cb9197..632ff9fc5 100644 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -1237,6 +1237,10 @@ srs_error_t SrsServer::accept_client(SrsListenerType type, srs_netfd_t stfd) SrsConnection* conn = NULL; if ((err = fd2conn(type, stfd, &conn)) != srs_success) { + if (srs_error_code(err) == ERROR_SOCKET_GET_PEER_IP && _srs_config->empty_ip_ok()) { + srs_close_stfd(stfd); srs_error_reset(err); + return srs_success; + } return srs_error_wrap(err, "fd2conn"); } srs_assert(conn); diff --git a/trunk/src/core/srs_core_version3.hpp b/trunk/src/core/srs_core_version3.hpp index 801fd91fe..c871670b0 100644 --- a/trunk/src/core/srs_core_version3.hpp +++ b/trunk/src/core/srs_core_version3.hpp @@ -24,6 +24,6 @@ #ifndef SRS_CORE_VERSION3_HPP #define SRS_CORE_VERSION3_HPP -#define SRS_VERSION3_REVISION 122 +#define SRS_VERSION3_REVISION 123 #endif From 67d78dff0e283ec3c031211225cffc7432f54db9 Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 21 Feb 2020 23:56:40 +0800 Subject: [PATCH 4/7] For #1598, support SLB health checking by TCP. 4.0.8 --- README.md | 1 + trunk/src/core/srs_core_version4.hpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 46194a505..56658c3dc 100755 --- a/README.md +++ b/README.md @@ -153,6 +153,7 @@ For previous versions, please read: ## V4 changes +* v4.0, 2020-02-21, For [#1598][bug #1598], support SLB health checking by TCP. 4.0.8 * v4.0, 2020-02-19, For [#1579][bug #1579], support rolling update of k8s. 4.0.7 * v4.0, 2020-02-18, For [#1579][bug #1579], support start/final wait for gracefully quit. 4.0.6 * v4.0, 2020-02-18, For [#1579][bug #1579], support gracefully quit and force to. 4.0.5 diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index f6717ca54..f5d2ad53c 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -24,6 +24,6 @@ #ifndef SRS_CORE_VERSION4_HPP #define SRS_CORE_VERSION4_HPP -#define SRS_VERSION4_REVISION 7 +#define SRS_VERSION4_REVISION 8 #endif From bbfa55214080ede81344db4655c423fef4bc26a9 Mon Sep 17 00:00:00 2001 From: runner365 Date: Mon, 24 Feb 2020 12:55:17 +0800 Subject: [PATCH 5/7] update streamid decode for get more encoder such as VMIX --- trunk/src/srt/srt_conn.cpp | 59 ++++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/trunk/src/srt/srt_conn.cpp b/trunk/src/srt/srt_conn.cpp index a0fd93ad9..4ea90bda1 100644 --- a/trunk/src/srt/srt_conn.cpp +++ b/trunk/src/srt/srt_conn.cpp @@ -4,28 +4,43 @@ #include bool is_streamid_valid(const std::string& streamid) { - int mode = ERR_SRT_MODE; - std::string url_subpash; - - bool ret = get_streamid_info(streamid, mode, url_subpash); - if (!ret) { - return ret; - } - - if ((mode != PULL_SRT_MODE) && (mode != PUSH_SRT_MODE)) { + if (streamid.empty()) { return false; } - if (url_subpash.empty()) { + size_t pos = streamid.find(" "); + if (pos != streamid.npos) { + return false; + } + + int mode; + std::string subpath; + + bool ret = get_streamid_info(streamid, mode, subpath); + if (!ret) { + return false; + } + + if ((mode != PUSH_SRT_MODE) && (mode != PULL_SRT_MODE)) { return false; } std::vector info_vec; - string_split(url_subpash, "/", info_vec); - if (info_vec.size() < 2) { + string_split(subpath, "/", info_vec); + + if (info_vec.size() < 2) {//it must be appname/stream at least. return false; } + for (auto item : info_vec) { + if (item.empty()) { + return false; + } + pos = item.find(" "); + if (pos != item.npos) { + return false; + } + } return true; } @@ -46,13 +61,21 @@ bool get_key_value(const std::string& info, std::string& key, std::string& value } //eg. streamid=#!::h:live/livestream,m:publish -bool get_streamid_info(const std::string& streamid, int& mode, std::string& url_subpash) { +bool get_streamid_info(const std::string& streamid, int& mode, std::string& url_subpath) { std::vector info_vec; std::string real_streamid; - size_t pos = streamid.find("#!::h"); + mode = PUSH_SRT_MODE; + + size_t pos = streamid.find("#!::"); if (pos != 0) { - return false; + pos = streamid.find("/"); + if (pos == streamid.npos) { + url_subpath = "live/" + streamid; + return true; + } + url_subpath = streamid; + return true; } real_streamid = streamid.substr(4); @@ -71,7 +94,7 @@ bool get_streamid_info(const std::string& streamid, int& mode, std::string& url_ } if (key == "h") { - url_subpash = value;//eg. h=live/stream + url_subpath = value;//eg. h=live/stream } else if (key == "m") { std::string mode_str = string_lower(value);//m=publish or m=request if (mode_str == "publish") { @@ -79,8 +102,7 @@ bool get_streamid_info(const std::string& streamid, int& mode, std::string& url_ } else if (mode_str == "request") { mode = PULL_SRT_MODE; } else { - mode = ERR_SRT_MODE; - return false; + mode = PUSH_SRT_MODE; } } else {//not suport continue; @@ -93,6 +115,7 @@ bool get_streamid_info(const std::string& streamid, int& mode, std::string& url_ srt_conn::srt_conn(SRTSOCKET conn_fd, const std::string& streamid):_conn_fd(conn_fd), _streamid(streamid) { get_streamid_info(streamid, _mode, _url_subpath); + _update_timestamp = now_ms(); std::vector path_vec; From 90afd06c85fb76e81f6a9d9931649fffde1713b0 Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 25 Feb 2020 13:22:44 +0800 Subject: [PATCH 6/7] For #1615, support default app(live) for vmix SRT. 4.0.9 --- README.md | 2 ++ trunk/conf/full.conf | 3 +++ trunk/src/app/srs_app_config.cpp | 17 ++++++++++++++++- trunk/src/app/srs_app_config.hpp | 2 ++ trunk/src/core/srs_core_version4.hpp | 2 +- trunk/src/srt/srt_conn.cpp | 4 +++- 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 56658c3dc..bec6c8de6 100755 --- a/README.md +++ b/README.md @@ -153,6 +153,7 @@ For previous versions, please read: ## V4 changes +* v4.0, 2020-02-25, For [#1615][bug #1615], support default app(live) for vmix SRT. 4.0.9 * v4.0, 2020-02-21, For [#1598][bug #1598], support SLB health checking by TCP. 4.0.8 * v4.0, 2020-02-19, For [#1579][bug #1579], support rolling update of k8s. 4.0.7 * v4.0, 2020-02-18, For [#1579][bug #1579], support start/final wait for gracefully quit. 4.0.6 @@ -1685,6 +1686,7 @@ Winlin [bug #1601]: https://github.com/ossrs/srs/issues/1601 [bug #1579]: https://github.com/ossrs/srs/issues/1579 [bug #1598]: https://github.com/ossrs/srs/issues/1598 +[bug #1615]: https://github.com/ossrs/srs/issues/1615 [bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx [exo #828]: https://github.com/google/ExoPlayer/pull/828 diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index 3352538b6..928925e00 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -290,6 +290,9 @@ srt_server { connect_timeout 4000; peerlatency 300; recvlatency 300; + # Default app for vmix, see https://github.com/ossrs/srs/pull/1615 + # default: live + default_app live; } ############################################################################################# diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 89f3da8b5..0eaabb4c9 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -3529,7 +3529,8 @@ srs_error_t SrsConfig::check_normal_config() if (n != "enabled" && n != "listen" && n != "maxbw" && n != "mss" && n != "latency" && n != "recvlatency" && n != "peerlatency" && n != "tlpkdrop" && n != "connect_timeout" - && n != "sendbuf" && n != "recvbuf" && n != "payloadsize") { + && n != "sendbuf" && n != "recvbuf" && n != "payloadsize" + && n != "default_app") { return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal srt_stream.%s", n.c_str()); } } @@ -6893,6 +6894,20 @@ int SrsConfig::get_srto_payloadsize() { return atoi(conf->arg0().c_str()); } +string SrsConfig::get_default_app_name() { + static string DEFAULT = "live"; + SrsConfDirective* conf = root->get("srt_server"); + if (!conf) { + return DEFAULT; + } + + conf = conf->get("default_app"); + if (!conf || conf->arg0().empty()) { + return DEFAULT; + } + return conf->arg0(); +} + bool SrsConfig::get_http_stream_enabled() { SrsConfDirective* conf = root->get("http_server"); diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index 17bcd4963..dde708f8e 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -623,6 +623,8 @@ public: virtual int get_srto_recvbuf(); // SRTO_PAYLOADSIZE virtual int get_srto_payloadsize(); + // Get the default app. + virtual std::string get_default_app_name(); // http_hooks section private: diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index f5d2ad53c..da3e2b804 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -24,6 +24,6 @@ #ifndef SRS_CORE_VERSION4_HPP #define SRS_CORE_VERSION4_HPP -#define SRS_VERSION4_REVISION 8 +#define SRS_VERSION4_REVISION 9 #endif diff --git a/trunk/src/srt/srt_conn.cpp b/trunk/src/srt/srt_conn.cpp index 4ea90bda1..e2f18af27 100644 --- a/trunk/src/srt/srt_conn.cpp +++ b/trunk/src/srt/srt_conn.cpp @@ -3,6 +3,8 @@ #include "stringex.hpp" #include +#include + bool is_streamid_valid(const std::string& streamid) { if (streamid.empty()) { return false; @@ -71,7 +73,7 @@ bool get_streamid_info(const std::string& streamid, int& mode, std::string& url_ if (pos != 0) { pos = streamid.find("/"); if (pos == streamid.npos) { - url_subpath = "live/" + streamid; + url_subpath = _srs_config->get_default_app_name() + "/" + streamid; return true; } url_subpath = streamid; From 04d0620ddeffeb640167e0a7ee7877bdae25d6ca Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 25 Feb 2020 13:45:05 +0800 Subject: [PATCH 7/7] For #1615, fix build failed and srt api issue --- trunk/src/core/srs_core_mem_watch.cpp | 2 +- trunk/src/protocol/srs_protocol_utility.cpp | 2 +- trunk/src/srt/srt_server.cpp | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/trunk/src/core/srs_core_mem_watch.cpp b/trunk/src/core/srs_core_mem_watch.cpp index 701795fa9..dbc6c9411 100644 --- a/trunk/src/core/srs_core_mem_watch.cpp +++ b/trunk/src/core/srs_core_mem_watch.cpp @@ -74,7 +74,7 @@ void srs_memory_report() std::map::iterator it; for (it = _srs_ptrs.begin(); it != _srs_ptrs.end(); ++it) { SrsMemoryObject* obj = it->second; - printf(" %s: %#"PRIx64", %dB\n", obj->category.c_str(), (int64_t)obj->ptr, obj->size); + printf(" %s: %#" PRIx64 ", %dB\n", obj->category.c_str(), (int64_t)obj->ptr, obj->size); total += obj->size; } diff --git a/trunk/src/protocol/srs_protocol_utility.cpp b/trunk/src/protocol/srs_protocol_utility.cpp index 28141f625..251d69854 100644 --- a/trunk/src/protocol/srs_protocol_utility.cpp +++ b/trunk/src/protocol/srs_protocol_utility.cpp @@ -122,7 +122,7 @@ void srs_discovery_tc_url(string tcUrl, string& schema, string& host, string& vh srs_vhost_resolve(vhost, stream, param); // Ignore when the param only contains the default vhost. - if (param == "?vhost="SRS_CONSTS_RTMP_DEFAULT_VHOST) { + if (param == "?vhost=" SRS_CONSTS_RTMP_DEFAULT_VHOST) { param = ""; } } diff --git a/trunk/src/srt/srt_server.cpp b/trunk/src/srt/srt_server.cpp index 3a17a0a8b..eb41866e0 100644 --- a/trunk/src/srt/srt_server.cpp +++ b/trunk/src/srt/srt_server.cpp @@ -256,7 +256,11 @@ void srt_server::on_work() } } } + + // @see 2020-01-28 https://github.com/Haivision/srt/commit/b8c70ec801a56bea151ecce9c09c4ebb720c2f68#diff-fb66028e8746fea578788532533a296bR786 +#if SRT_VERSION_MAJOR > 1 || SRT_VERSION_MINOR > 4 || SRT_VERSION_PATCH > 1 srt_epoll_clear_usocks(_pollid); +#endif } SrtServerAdapter::SrtServerAdapter()