From fd90e49cd6799d524234231ad1a02ecbc2ad8085 Mon Sep 17 00:00:00 2001 From: Winlin Date: Sun, 26 Dec 2021 19:12:44 +0800 Subject: [PATCH 01/32] CI: Support build and test for CentOS 6.0 (#2816) --- .github/workflows/test.yml | 7 +++++-- trunk/Dockerfile.builds | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b2ac7d659..1e1fa2525 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - # Build for CentOS7 + # Build for CentOS 7 - name: Build on CentOS7, baseline run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-baseline . - name: Build on CentOS7, with SRT @@ -23,7 +23,10 @@ jobs: run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-no-asm . - name: Build on CentOS7, C++98, no FFmpeg run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-ansi-no-ffmpeg . - # Build for CentOS8 + # Build for CentOS 6 + - name: Build on CentOS6, baseline + run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos6-baseline . + # Build for CentOS 8 - name: Build on CentOS8, baseline run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos8-baseline . - name: Build on CentOS8, with SRT diff --git a/trunk/Dockerfile.builds b/trunk/Dockerfile.builds index ea91ac2c6..73f113893 100644 --- a/trunk/Dockerfile.builds +++ b/trunk/Dockerfile.builds @@ -19,6 +19,11 @@ FROM ossrs/srs:dev AS centos7-ansi-no-ffmpeg COPY . /srs RUN cd /srs/trunk && ./configure --jobs=2 --cxx11=off --cxx14=off --ffmpeg-fit=off && make -j2 +######################################################## +FROM ossrs/srs:dev6 AS centos6-baseline +COPY . /srs +RUN cd /srs/trunk && ./configure --jobs=2 && make -j2 + ######################################################## FROM ossrs/srs:dev8 AS centos8-baseline COPY . /srs From f8122ea8619bfca02180524bcd51cf229efbbe21 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 27 Dec 2021 10:19:44 +0800 Subject: [PATCH 02/32] Refine ISSUE template --- .github/ISSUE_TEMPLATE/feature_request.md | 20 ------------------- .../bug_report.md => issue_template.md} | 0 2 files changed, 20 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md rename .github/{ISSUE_TEMPLATE/bug_report.md => issue_template.md} (100%) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7d6..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/issue_template.md similarity index 100% rename from .github/ISSUE_TEMPLATE/bug_report.md rename to .github/issue_template.md From c7ea21d06af56f10ce73d3b6f3014d03eb6289c0 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 27 Dec 2021 11:10:44 +0800 Subject: [PATCH 03/32] Fix ulimit issue by detecting epoll on Ubuntu. (#2811). v4.0.213 --- trunk/auto/depends.sh | 4 ++++ trunk/doc/CHANGELOG.md | 1 + trunk/src/core/srs_core_version4.hpp | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index b0837dda2..215b86cae 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -384,6 +384,10 @@ fi if [[ $SRS_OSX == YES ]]; then _ST_MAKE=darwin-debug && _ST_EXTRA_CFLAGS="-DMD_HAVE_KQUEUE" && _ST_OBJ="DARWIN_`uname -r`_DBG" fi +# For Ubuntu, the epoll detection might be fail. +if [[ $OS_IS_UBUNTU == YES ]]; then + _ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_HAVE_EPOLL" +fi # Whether enable debug stats. if [[ $SRS_DEBUG_STATS == YES ]]; then _ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DDEBUG_STATS" diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index b4091386c..05badcfb9 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2021-12-27, Fix [#2811](https://github.com/ossrs/srs/issues/2811): Fix ulimit issue by detecting epoll on Ubuntu. (#2811). v4.0.213 * v4.0, 2021-12-26, Fix [#2247](https://github.com/ossrs/srs/pull/2247): Cleanup server for GMC, by WaitGroup to destroy. (#2247). v4.0.212 * v4.0, 2021-12-25, For [#2809](https://github.com/ossrs/srs/issues/2809), HTTP: Fix 2GB+ mp4/flv file downloading error. (#2809)(#2780)(#2781). v4.0.211 * v4.0, 2021-12-23, For [#2800](https://github.com/ossrs/srs/issues/2800), Fix bug for large mp4(5G+) offset. (#2800). v4.0.210 diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 44ff19545..ab1455f2a 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 212 +#define VERSION_REVISION 213 #endif From f1a448bc6a4b3331035750bdc82d67fa55e6624a Mon Sep 17 00:00:00 2001 From: akanchi Date: Mon, 27 Dec 2021 11:14:50 +0800 Subject: [PATCH 04/32] SRT: Fix srt2rtmp crash when streamid is too long(#2770) (#2786) --- trunk/src/srt/srt_to_rtmp.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/trunk/src/srt/srt_to_rtmp.cpp b/trunk/src/srt/srt_to_rtmp.cpp index c753d0d02..a554a3e25 100644 --- a/trunk/src/srt/srt_to_rtmp.cpp +++ b/trunk/src/srt/srt_to_rtmp.cpp @@ -15,6 +15,7 @@ #include #include #include +#include std::shared_ptr srt2rtmp::s_srt2rtmp_ptr; @@ -258,8 +259,7 @@ rtmp_client::rtmp_client(std::string key_path):_key_path(key_path) _appname = ret_vec[0]; _streamname = ret_vec[1]; } - char url_sz[128]; - + std::vector ip_ports = _srs_config->get_listens(); int port = 0; std::string ip; @@ -271,22 +271,24 @@ rtmp_client::rtmp_client(std::string key_path):_key_path(key_path) } } port = (port == 0) ? 1935 : port; - if (_vhost == DEF_VHOST) { - sprintf(url_sz, "rtmp://127.0.0.1:%d/%s/%s", port, - _appname.c_str(), _streamname.c_str()); - } else { - sprintf(url_sz, "rtmp://127.0.0.1:%d/%s?vhost=%s/%s", port, - _appname.c_str(), _vhost.c_str(), _streamname.c_str()); + + std::stringstream ss; + ss << "rtmp://127.0.0.1"; + ss << ":" << port; + ss << "/" << _appname; + if (_vhost != DEF_VHOST) { + ss << "?vhost=" << _vhost; } - - _url = url_sz; + ss << "/" << _streamname; + + _url = ss.str(); _h264_sps_changed = false; _h264_pps_changed = false; _h264_sps_pps_sent = false; _last_live_ts = now_ms(); - srs_trace("rtmp client construct url:%s", url_sz); + srs_trace("rtmp client construct url:%s", _url.c_str()); } rtmp_client::~rtmp_client() { From 3f8b1a2922549a5f011cdd0452bc97914e4079aa Mon Sep 17 00:00:00 2001 From: mapengfei53 <52305649+mapengfei53@users.noreply.github.com> Date: Wed, 29 Dec 2021 11:25:30 +0800 Subject: [PATCH 05/32] Fix the error of pps statistics (#2820) --- trunk/src/app/srs_app_listener.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trunk/src/app/srs_app_listener.cpp b/trunk/src/app/srs_app_listener.cpp index cab8730a8..7bfb3e564 100755 --- a/trunk/src/app/srs_app_listener.cpp +++ b/trunk/src/app/srs_app_listener.cpp @@ -652,7 +652,7 @@ srs_error_t SrsUdpMuxListener::cycle() if (pps_last > 10000 || pps_average > 10000) { pps_unit = "(w)"; pps_last /= 10000; pps_average /= 10000; } else if (pps_last > 1000 || pps_average > 1000) { - pps_unit = "(k)"; pps_last /= 10000; pps_average /= 10000; + pps_unit = "(k)"; pps_last /= 1000; pps_average /= 1000; } srs_trace("<- RTC RECV #%d, udp %" PRId64 ", pps %d/%d%s, schedule %" PRId64, From a16590b3a65aa5c4f5d692f7a0e8cb2103a8ae6b Mon Sep 17 00:00:00 2001 From: chundonglinlin Date: Wed, 29 Dec 2021 11:52:02 +0800 Subject: [PATCH 06/32] SRT: Eliminate duplicate header file.(#2786) (#2827) --- trunk/src/srt/srt_to_rtmp.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/trunk/src/srt/srt_to_rtmp.cpp b/trunk/src/srt/srt_to_rtmp.cpp index a554a3e25..53ae3b01a 100644 --- a/trunk/src/srt/srt_to_rtmp.cpp +++ b/trunk/src/srt/srt_to_rtmp.cpp @@ -14,8 +14,6 @@ #include #include #include -#include -#include std::shared_ptr srt2rtmp::s_srt2rtmp_ptr; From a9397598e8a1f156a328409e55d260e1bd63e33c Mon Sep 17 00:00:00 2001 From: john Date: Tue, 28 Dec 2021 21:53:16 -0600 Subject: [PATCH 07/32] Fix typo(HTTP-Server -> HTTPS-Server) (#2822) --- trunk/src/app/srs_app_server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index 06487b173..10fb9c156 100644 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -49,7 +49,7 @@ std::string srs_listener_type2string(SrsListenerType type) case SrsListenerHttpStream: return "HTTP-Server"; case SrsListenerHttpsStream: - return "HTTP-Server"; + return "HTTPS-Server"; case SrsListenerMpegTsOverUdp: return "MPEG-TS over UDP"; case SrsListenerFlv: From 5aba212f3d4c6de69f5139e59aedaa382de8dcc9 Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 29 Dec 2021 11:57:15 +0800 Subject: [PATCH 08/32] Bugs fixed. (#2770)(#2820). v4.0.214 --- trunk/doc/CHANGELOG.md | 1 + trunk/src/core/srs_core_version4.hpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 05badcfb9..b3bf4b537 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2021-12-29, Merge [#2770](https://github.com/ossrs/srs/pull/2770), [#2820](https://github.com/ossrs/srs/pull/2820): Bugs fixed. (#2770)(#2820). v4.0.214 * v4.0, 2021-12-27, Fix [#2811](https://github.com/ossrs/srs/issues/2811): Fix ulimit issue by detecting epoll on Ubuntu. (#2811). v4.0.213 * v4.0, 2021-12-26, Fix [#2247](https://github.com/ossrs/srs/pull/2247): Cleanup server for GMC, by WaitGroup to destroy. (#2247). v4.0.212 * v4.0, 2021-12-25, For [#2809](https://github.com/ossrs/srs/issues/2809), HTTP: Fix 2GB+ mp4/flv file downloading error. (#2809)(#2780)(#2781). v4.0.211 diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index ab1455f2a..fd30d1912 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 213 +#define VERSION_REVISION 214 #endif From 56a9e4d140586b73e4e001046c8713341afcbaba Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 30 Dec 2021 11:28:10 +0800 Subject: [PATCH 09/32] Change images from gitee to ossrs.net --- README.md | 12 ++++++------ trunk/3rdparty/st-srs/README.md | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6a03246ab..e72af1575 100755 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ [![](https://github.com/ossrs/srs/actions/workflows/release.yml/badge.svg)](https://github.com/ossrs/srs/actions/workflows/release.yml?query=workflow%3ARelease) [![](https://github.com/ossrs/srs/actions/workflows/test.yml/badge.svg?branch=4.0release)](https://github.com/ossrs/srs/actions?query=workflow%3ATest+branch%3A4.0release) [![](https://codecov.io/gh/ossrs/srs/branch/4.0release/graph/badge.svg)](https://codecov.io/gh/ossrs/srs/branch/4.0release) -[![](https://gitee.com/winlinvip/srs-wiki/raw/master/images/wechat-badge4.svg)](../../wikis/Contact#wechat) -[![](https://gitee.com/winlinvip/srs-wiki/raw/master/images/srs-faq.svg)](https://github.com/ossrs/srs/issues/2716) -[![](https://gitee.com/winlinvip/srs-wiki/raw/master/images/mulan-incubating.svg)](http://mulanos.cn) -[![](https://gitee.com/winlinvip/srs-wiki/raw/master/images/srs-alternativeto.svg)](https://alternativeto.net/software/srs/about/) -[![](https://gitee.com/winlinvip/srs-wiki/raw/master/images/srs-facebook.svg)](https://www.facebook.com/winlinvip) +[![](https://ossrs.net/wiki/images/wechat-badge4.svg)](../../wikis/Contact#wechat) +[![](https://ossrs.net/wiki/images/srs-faq.svg)](https://github.com/ossrs/srs/issues/2716) +[![](https://ossrs.net/wiki/images/mulan-incubating.svg)](http://mulanos.cn) +[![](https://ossrs.net/wiki/images/srs-alternativeto.svg)](https://alternativeto.net/software/srs/about/) +[![](https://ossrs.net/wiki/images/srs-facebook.svg)](https://www.facebook.com/winlinvip) [![](https://badgen.net/twitter/follow/winlinvip)](https://twitter.com/winlinvip) [![](https://img.shields.io/youtube/channel/views/UCP6ZblCL_fIJoEyUzZxC1ng?style=social)](https://www.youtube.com/channel/UCP6ZblCL_fIJoEyUzZxC1ng) [![](https://img.shields.io/twitch/status/winlinvip?style=social)](https://www.twitch.tv/winlinvip) @@ -21,7 +21,7 @@ SRS/4.0,[Leo](https://github.com/ossrs/srs/wiki/Product#release40),是一个 SRS is a simple, high efficiency and realtime video server, supports RTMP/WebRTC/HLS/HTTP-FLV/SRT. -[![SRS Overview](https://gitee.com/winlinvip/srs-wiki/raw/master/images/SRS-Overview-4.0.png)](https://gitee.com/winlinvip/srs-wiki/raw/master/images/SRS-Overview-4.0.png) +[![SRS Overview](https://ossrs.net/wiki/images/SRS-Overview-4.0.png)](https://ossrs.net/wiki/images/SRS-Overview-4.0.png) > Note: Please see https://www.processon.com/view/link/619f29791efad425fd699fd2 diff --git a/trunk/3rdparty/st-srs/README.md b/trunk/3rdparty/st-srs/README.md index 8a5eba94f..5a90bf7a6 100644 --- a/trunk/3rdparty/st-srs/README.md +++ b/trunk/3rdparty/st-srs/README.md @@ -94,8 +94,8 @@ Important cli options: * API reference: http://ossrs.github.io/state-threads/docs/reference.html * Programming notes: http://ossrs.github.io/state-threads/docs/notes.html -* About setjmp and longjmp, read [setjmp](https://gitee.com/winlinvip/srs-wiki/raw/master/images/st-setjmp.jpg). -* About the stack structure, read [stack](https://gitee.com/winlinvip/srs-wiki/raw/master/images/st-stack.jpg) +* About setjmp and longjmp, read [setjmp](https://ossrs.net/wiki/images/st-setjmp.jpg). +* About the stack structure, read [stack](https://ossrs.net/wiki/images/st-stack.jpg) * About asm code comments, read [#91d530e](https://github.com/ossrs/state-threads/commit/91d530e#diff-ed9428b14ff6afda0e9ab04cc91d4445R25). * About the scheduler, read [#13-scheduler](https://github.com/ossrs/state-threads/issues/13#issuecomment-616025527). * About the IO event system, read [#13-IO](https://github.com/ossrs/state-threads/issues/13#issuecomment-616096568). From 425b5cb3ac65f060c5e485e27e54e2dfcd50ba8b Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 30 Dec 2021 11:30:29 +0800 Subject: [PATCH 10/32] Refresh arch image cache --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e72af1575..0f811a015 100755 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ SRS/4.0,[Leo](https://github.com/ossrs/srs/wiki/Product#release40),是一个 SRS is a simple, high efficiency and realtime video server, supports RTMP/WebRTC/HLS/HTTP-FLV/SRT. -[![SRS Overview](https://ossrs.net/wiki/images/SRS-Overview-4.0.png)](https://ossrs.net/wiki/images/SRS-Overview-4.0.png) +[![SRS Overview](https://ossrs.net/wiki/images/SRS-Overview-4.0.png?v=100)](https://ossrs.net/wiki/images/SRS-Overview-4.0.png) > Note: Please see https://www.processon.com/view/link/619f29791efad425fd699fd2 From cf010064eba5a9faa2cbbc0d65c86be44968beaa Mon Sep 17 00:00:00 2001 From: along Date: Thu, 30 Dec 2021 18:06:23 +0800 Subject: [PATCH 11/32] Update srs_core.hpp (#2832) modify a word. --- trunk/src/core/srs_core.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index cedf8b1c6..05f044dc8 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -94,7 +94,7 @@ typedef SrsCplxError* srs_error_t; #include // The context ID, it default to a string object, we can also use other objects. -// @remark User can directly user string as SrsContextId, we user struct to ensure the context is an object. +// @remark User can directly use string as SrsContextId, we use struct to ensure the context is an object. #if 1 class _SrsContextId { From add4ff38ecea57a39de0fa7aff99334db60b83bb Mon Sep 17 00:00:00 2001 From: Winlin Date: Fri, 31 Dec 2021 08:27:08 +0800 Subject: [PATCH 12/32] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0f811a015..4984538fb 100755 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ [![](https://img.shields.io/twitch/status/winlinvip?style=social)](https://www.twitch.tv/winlinvip) [![](https://badgen.net/discord/members/yZ4BnPmHAd)](https://discord.gg/yZ4BnPmHAd) [![](https://opencollective.com/srs-server/tiers/badge.svg)](https://opencollective.com/srs-server/contribute) -[![](https://stackoverflow-badge.herokuapp.com/api/StackOverflowBadge/17679565)](https://stackoverflow.com/questions/tagged/simple-realtime-server) +[![](https://img.shields.io/stackexchange/stackoverflow/r/17679565)](https://stackoverflow.com/questions/tagged/simple-realtime-server) SRS/4.0,[Leo](https://github.com/ossrs/srs/wiki/Product#release40),是一个简单高效的实时视频服务器,支持RTMP/WebRTC/HLS/HTTP-FLV/SRT。 From 8bc2759c7e8eaaac95d6e5a5072a03b2378280c3 Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 31 Dec 2021 11:42:49 +0800 Subject: [PATCH 13/32] Refine error log for rtmp2rtc. (#2728). v4.0.215 --- trunk/doc/CHANGELOG.md | 1 + trunk/src/app/srs_app_rtc_api.cpp | 8 ++++++++ trunk/src/app/srs_app_source.hpp | 2 +- trunk/src/core/srs_core_version4.hpp | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index b3bf4b537..f8dd26861 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2021-12-31, For [#2728](https://github.com/ossrs/srs/issues/2728): Refine error log for rtmp2rtc. (#2728). v4.0.215 * v4.0, 2021-12-29, Merge [#2770](https://github.com/ossrs/srs/pull/2770), [#2820](https://github.com/ossrs/srs/pull/2820): Bugs fixed. (#2770)(#2820). v4.0.214 * v4.0, 2021-12-27, Fix [#2811](https://github.com/ossrs/srs/issues/2811): Fix ulimit issue by detecting epoll on Ubuntu. (#2811). v4.0.213 * v4.0, 2021-12-26, Fix [#2247](https://github.com/ossrs/srs/pull/2247): Cleanup server for GMC, by WaitGroup to destroy. (#2247). v4.0.212 diff --git a/trunk/src/app/srs_app_rtc_api.cpp b/trunk/src/app/srs_app_rtc_api.cpp index b52bd37e7..b64595c79 100644 --- a/trunk/src/app/srs_app_rtc_api.cpp +++ b/trunk/src/app/srs_app_rtc_api.cpp @@ -185,6 +185,14 @@ srs_error_t SrsGoApiRtcPlay::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMe server_enabled, rtc_enabled, ruc.req_->vhost.c_str()); } + // For RTMP to RTC, fail if disabled and RTMP is active, see https://github.com/ossrs/srs/issues/2728 + if (!_srs_config->get_rtc_to_rtmp(ruc.req_->vhost)) { + SrsLiveSource* rtmp = _srs_sources->fetch(ruc.req_); + if (!rtmp->inactive()) { + return srs_error_new(ERROR_RTC_DISABLED, "Disabled rtmp_to_rtc of %s, see #2728", ruc.req_->vhost.c_str()); + } + } + // TODO: FIXME: When server enabled, but vhost disabled, should report error. SrsRtcConnection* session = NULL; if ((err = server_->create_session(&ruc, local_sdp, &session)) != srs_success) { diff --git a/trunk/src/app/srs_app_source.hpp b/trunk/src/app/srs_app_source.hpp index 33a48f580..d1bf0b3dc 100644 --- a/trunk/src/app/srs_app_source.hpp +++ b/trunk/src/app/srs_app_source.hpp @@ -448,7 +448,7 @@ public: // @param h the event handler for source. // @param pps the matched source, if success never be NULL. virtual srs_error_t fetch_or_create(SrsRequest* r, ISrsLiveSourceHandler* h, SrsLiveSource** pps); -private: +public: // Get the exists source, NULL when not exists. // update the request and return the exists source. virtual SrsLiveSource* fetch(SrsRequest* r); diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index fd30d1912..2d2a72872 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 214 +#define VERSION_REVISION 215 #endif From a01fd52712616406f5d7a9717598e31805415a93 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 3 Jan 2022 08:35:23 +0800 Subject: [PATCH 14/32] Release v4.0-b2, 4.0 beta2, v4.0.215, 144278 lines. --- .github/workflows/release.yml | 4 ++++ README.md | 1 + 2 files changed, 5 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0a1e7b3f3..05a743d8c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -88,6 +88,8 @@ jobs: docker push ossrs/srs:$SRS_TAG docker tag ossrs/srs:$SRS_TAG ossrs/srs:$SRS_MAJOR docker push ossrs/srs:$SRS_MAJOR + docker tag ossrs/srs:$SRS_TAG ossrs/srs:latest + docker push ossrs/srs:latest # Aliyun ACR - name: Login Aliyun docker hub uses: aliyun/acr-login@v1 @@ -105,6 +107,8 @@ jobs: docker push registry.cn-hangzhou.aliyuncs.com/ossrs/srs:v$SRS_MAJOR docker tag ossrs/srs:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/srs:$SRS_MAJOR docker push registry.cn-hangzhou.aliyuncs.com/ossrs/srs:$SRS_MAJOR + docker tag ossrs/srs:$SRS_TAG registry.cn-hangzhou.aliyuncs.com/ossrs/srs:latest + docker push registry.cn-hangzhou.aliyuncs.com/ossrs/srs:latest ################################################################ # K8S diff --git a/README.md b/README.md index 4984538fb..a3f4cbe00 100755 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ A big THANK YOU goes to: ## Releases +* 2022-01-03, Release [v4.0-b2](https://github.com/ossrs/srs/releases/tag/v4.0-b2), v4.0-b2, 4.0 beta2, v4.0.215, 144278 lines. * 2021-12-19, Release [v4.0-b1](https://github.com/ossrs/srs/releases/tag/v4.0-b1), v4.0-b1, 4.0 beta1, v4.0.206, 144126 lines. * 2021-12-01, Release [v4.0-b0](https://github.com/ossrs/srs/releases/tag/v4.0-b0), v4.0-b0, 4.0 beta0, v4.0.201, 144022 lines. * 2021-11-15, Release [v4.0.198](https://github.com/ossrs/srs/releases/tag/v4.0.198), 4.0 dev8, v4.0.198, 144010 lines. From fd313133b19999c1fada48d1248210f41ac9a2de Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 3 Jan 2022 08:55:42 +0800 Subject: [PATCH 15/32] Support ossrs/srs:latest as 4.0 --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 05a743d8c..2e86f11db 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -140,8 +140,10 @@ jobs: * Source: ${{ env.SRS_SOURCE_MD5 }} [${{ env.SRS_SOURCE_TAR }}](https://github.com/ossrs/srs/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_SOURCE_TAR }}) * Binary: ${{ env.SRS_PACKAGE_MD5 }} [${{ env.SRS_PACKAGE_ZIP }}](https://github.com/ossrs/srs/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_PACKAGE_ZIP }}) ## Docker + * China: [docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:latest](https://github.com/ossrs/srs/wiki/v4_CN_Home#docker) * China: [docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_MAJOR }}](https://github.com/ossrs/srs/wiki/v4_CN_Home#docker) * China: [docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_TAG }}](https://github.com/ossrs/srs/wiki/v4_CN_Home#docker) + * Global: [docker pull ossrs/srs:latest](https://github.com/ossrs/srs/wiki/v4_EN_Home#docker) * Global: [docker pull ossrs/srs:${{ env.SRS_MAJOR }}](https://github.com/ossrs/srs/wiki/v4_EN_Home#docker) * Global: [docker pull ossrs/srs:${{ env.SRS_TAG }}](https://github.com/ossrs/srs/wiki/v4_EN_Home#docker) ## Doc From 7808bd7ca86417abd5cac630ae66b538f79e92a6 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 3 Jan 2022 16:55:52 +0800 Subject: [PATCH 16/32] Support config in_docker to fix the detect fail. (#2824). v4.0.216 --- trunk/conf/full.conf | 4 ++++ trunk/doc/CHANGELOG.md | 1 + trunk/src/app/srs_app_config.cpp | 14 +++++++++++++- trunk/src/app/srs_app_config.hpp | 2 ++ trunk/src/core/srs_core_version4.hpp | 2 +- trunk/src/main/srs_main_server.cpp | 8 ++++++++ 6 files changed, 29 insertions(+), 2 deletions(-) diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index 80aadb53e..8bf44582b 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -77,6 +77,10 @@ asprocess off; # default: on empty_ip_ok on; +# Whether in docker. When SRS starting, it will detect the docker, however +# it might detect failed, then read this config. +# Default: off +in_docker off; # For gracefully quit, wait for a while then close listeners, # because K8S notify SRS with SIGQUIT and update Service simultaneously, # maybe there is some new connections incoming before Service updated. diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index f8dd26861..20c20b217 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2021-01-03, For [#2824](https://github.com/ossrs/srs/issues/2824): Support config in_docker to fix the detect fail. (#2824). v4.0.216 * v4.0, 2021-12-31, For [#2728](https://github.com/ossrs/srs/issues/2728): Refine error log for rtmp2rtc. (#2728). v4.0.215 * v4.0, 2021-12-29, Merge [#2770](https://github.com/ossrs/srs/pull/2770), [#2820](https://github.com/ossrs/srs/pull/2820): Bugs fixed. (#2770)(#2820). v4.0.214 * v4.0, 2021-12-27, Fix [#2811](https://github.com/ossrs/srs/issues/2811): Fix ulimit issue by detecting epoll on Ubuntu. (#2811). v4.0.213 diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index fa813737c..d6ea94634 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -2471,7 +2471,7 @@ srs_error_t SrsConfig::check_normal_config() && n != "grace_start_wait" && n != "empty_ip_ok" && n != "disable_daemon_for_docker" && n != "inotify_auto_reload" && n != "auto_reload_for_docker" && n != "tcmalloc_release_rate" && n != "query_latest_version" - && n != "circuit_breaker" && n != "is_full" + && n != "circuit_breaker" && n != "is_full" && n != "in_docker" ) { return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal directive %s", n.c_str()); } @@ -2999,6 +2999,18 @@ bool SrsConfig::get_daemon() return SRS_CONF_PERFER_TRUE(conf->arg0()); } +bool SrsConfig::get_in_docker() +{ + static bool DEFAULT = false; + + SrsConfDirective* conf = root->get("in_docker"); + if (!conf) { + return DEFAULT; + } + + return SRS_CONF_PERFER_FALSE(conf->arg0()); +} + bool SrsConfig::is_full_config() { static bool DEFAULT = false; diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index c62351c87..51510b5df 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -382,6 +382,8 @@ public: // If true, SRS will run in daemon mode, fork and fork to reap the // grand-child process to init process. virtual bool get_daemon(); + // Whether srs in docker. + virtual bool get_in_docker(); private: // Whether user use full.conf virtual bool is_full_config(); diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 2d2a72872..34e6eed6c 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 215 +#define VERSION_REVISION 216 #endif diff --git a/trunk/src/main/srs_main_server.cpp b/trunk/src/main/srs_main_server.cpp index 643ad83d4..46465c62d 100644 --- a/trunk/src/main/srs_main_server.cpp +++ b/trunk/src/main/srs_main_server.cpp @@ -385,6 +385,14 @@ srs_error_t run_directly_or_daemon() { srs_error_t err = srs_success; + // Try to load the config if docker detect failed. + if (!_srs_in_docker) { + _srs_in_docker = _srs_config->get_in_docker(); + if (_srs_in_docker) { + srs_trace("enable in_docker by config"); + } + } + // Load daemon from config, disable it for docker. // @see https://github.com/ossrs/srs/issues/1594 bool run_as_daemon = _srs_config->get_daemon(); From c0a7790c91bf5fb3e862223fce7d7087337eb49b Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 4 Jan 2022 11:18:52 +0800 Subject: [PATCH 17/32] Update README --- README.md | 11 ++++++++++- trunk/doc/Resources.md | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a3f4cbe00..b84842667 100755 --- a/README.md +++ b/README.md @@ -31,7 +31,13 @@ SRS is licenced under [MIT][LICENSE], but some depended libraries are distribute ## Usage -Build SRS from source or **docker([CN](https://github.com/ossrs/srs/wiki/v4_CN_Home#docker) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_Home#docker))**, please read **Wiki: Gettting Started([CN](https://github.com/ossrs/srs/wiki/v4_CN_Home#getting-started) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_Home#getting-started))**: +> Highly recommend that directly run SRS by +> **docker([CN](https://github.com/ossrs/srs/wiki/v4_CN_Home#docker) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_Home#docker))**, +> or **K8s([CN](https://github.com/ossrs/srs/wiki/v4_CN_Home#k8s) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_Home#k8s))**, +> however it's also easy to build SRS from source code, for detail please see +> **Getting Started([CN](https://github.com/ossrs/srs/wiki/v4_CN_Home#getting-started) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_Home#getting-started))**. + +Build SRS from source: ``` git clone -b 4.0release https://gitee.com/ossrs/srs.git && @@ -52,6 +58,9 @@ Play the following streams by [players](https://ossrs.net): * RTMP (by [VLC](https://www.videolan.org/)): rtmp://localhost/live/livestream * H5(HTTP-FLV): [http://localhost:8080/live/livestream.flv](http://localhost:8080/players/srs_player.html?autostart=true&stream=livestream.flv&port=8080&schema=http) * H5(HLS): [http://localhost:8080/live/livestream.m3u8](http://localhost:8080/players/srs_player.html?autostart=true&stream=livestream.m3u8&port=8080&schema=http) + +Note that if convert RTMP to WebRTC, please use [`rtmp2rtc.conf`](https://github.com/ossrs/srs/issues/2728#issuecomment-964686152): + * H5(WebRTC): [webrtc://localhost/live/livestream](http://localhost:8080/players/rtc_player.html?autostart=true) diff --git a/trunk/doc/Resources.md b/trunk/doc/Resources.md index 0c90b6748..e90922f4d 100644 --- a/trunk/doc/Resources.md +++ b/trunk/doc/Resources.md @@ -45,6 +45,15 @@ Other API used by [ossrs.net](https://ossrs.net): * `/im-service/v1/` The latest available version API, by IM. * `/code-service/v1/` The latest available version API, by Code verification. +The statistic path for [ossrs.net](https://ossrs.net): + +* `/srs/xxx` The GitHub pages for [srs](https://github.com/ossrs/srs) +* `/wiki/xxx` The GitHub wiki for [srs](https://github.com/ossrs/srs/wiki) +* `/release/xxx` The pages for [ossrs.net](https://ossrs.net) +* `/console/xxx` The pages for [console](http://ossrs.net/console/) +* `/player/xxx` The pages for [players and publishers](http://ossrs.net/players/) +* `/k8s/xxx` The template and repository deploy by K8s, like [srs-k8s-template](https://github.com/ossrs/srs-k8s-template) + ## Mirrors Gitee: [https://gitee.com/ossrs/srs][gitee], the GIT usage([CN][v4_CN_Git], [EN][v4_EN_Git]) From 013fa8ac6ca5657d4739ecfcc1cde083a83b1fc1 Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 4 Jan 2022 16:46:55 +0800 Subject: [PATCH 18/32] Install test-on self-sign certificate. v4.0.217 --- trunk/auto/depends.sh | 9 +++++ trunk/conf/https.docker.conf | 55 ++++++++++++++++++++++++++++ trunk/conf/https.rtc.conf | 18 +++++---- trunk/conf/https.rtmp2rtc.conf | 52 ++++++++++++++++++++++++++ trunk/conf/https.srs.conf | 55 ++++++++++++++++++++++++++++ trunk/configure | 1 + trunk/doc/CHANGELOG.md | 1 + trunk/src/core/srs_core_version4.hpp | 2 +- 8 files changed, 184 insertions(+), 9 deletions(-) create mode 100644 trunk/conf/https.docker.conf create mode 100644 trunk/conf/https.rtmp2rtc.conf create mode 100644 trunk/conf/https.srs.conf diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index 215b86cae..4e174310f 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -474,6 +474,15 @@ ln -sf `pwd`/research/api-server/static-dir/index.html ${SRS_OBJS}/nginx/html/in # nginx.html to detect whether nginx is alive echo "Nginx is ok." > ${SRS_OBJS}/nginx/html/nginx.html +##################################################################################### +# Generate default self-sign certificate for HTTPS server, test only. +##################################################################################### +if [[ ! -f conf/server.key || ! -f conf/server.crt ]]; then + openssl genrsa -out conf/server.key 2048 + openssl req -new -x509 -key conf/server.key -out conf/server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net" + echo "Generate test-only self-sign certificate files" +fi + ##################################################################################### # cherrypy for http hooks callback, CherryPy-3.2.4 ##################################################################################### diff --git a/trunk/conf/https.docker.conf b/trunk/conf/https.docker.conf new file mode 100644 index 000000000..8170185eb --- /dev/null +++ b/trunk/conf/https.docker.conf @@ -0,0 +1,55 @@ + +listen 1935; +max_connections 1000; +daemon off; +srs_log_tank console; + +http_server { + enabled on; + listen 8080; + dir ./objs/nginx/html; + https { + enabled on; + listen 8088; + key ./conf/server.key; + cert ./conf/server.crt; + } +} + +http_api { + enabled on; + listen 1985; + https { + enabled on; + listen 1990; + key ./conf/server.key; + cert ./conf/server.crt; + } +} +stats { + network 0; +} +rtc_server { + enabled on; + listen 8000; # UDP port + # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate + candidate $CANDIDATE; +} + +vhost __defaultVhost__ { + hls { + enabled on; + } + http_remux { + enabled on; + mount [vhost]/[app]/[stream].flv; + } + rtc { + enabled on; + # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtmp-to-rtc + rtmp_to_rtc off; + # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtc-to-rtmp + rtc_to_rtmp off; + } +} + diff --git a/trunk/conf/https.rtc.conf b/trunk/conf/https.rtc.conf index 5ceb9048d..368a21252 100644 --- a/trunk/conf/https.rtc.conf +++ b/trunk/conf/https.rtc.conf @@ -31,20 +31,22 @@ stats { } rtc_server { enabled on; - # Listen at udp://8000 - listen 8000; - # - # The $CANDIDATE means fetch from env, if not configed, use * as default. - # - # The * means retrieving server IP automatically, from all network interfaces, - # @see https://github.com/ossrs/srs/issues/307#issuecomment-599028124 + listen 8000; # UDP port + # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate candidate $CANDIDATE; } vhost __defaultVhost__ { rtc { enabled on; - keep_bframe off; + # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtmp-to-rtc + rtmp_to_rtc off; + # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtc-to-rtmp + rtc_to_rtmp off; + } + http_remux { + enabled on; + mount [vhost]/[app]/[stream].flv; } } diff --git a/trunk/conf/https.rtmp2rtc.conf b/trunk/conf/https.rtmp2rtc.conf new file mode 100644 index 000000000..079458e50 --- /dev/null +++ b/trunk/conf/https.rtmp2rtc.conf @@ -0,0 +1,52 @@ + +listen 1935; +max_connections 1000; +daemon off; +srs_log_tank console; + +http_server { + enabled on; + listen 8080; + dir ./objs/nginx/html; + https { + enabled on; + listen 8088; + key ./conf/server.key; + cert ./conf/server.crt; + } +} + +http_api { + enabled on; + listen 1985; + https { + enabled on; + listen 1990; + key ./conf/server.key; + cert ./conf/server.crt; + } +} +stats { + network 0; +} +rtc_server { + enabled on; + listen 8000; # UDP port + # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate + candidate $CANDIDATE; +} + +vhost __defaultVhost__ { + rtc { + enabled on; + # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtmp-to-rtc + rtmp_to_rtc on; + # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtc-to-rtmp + rtc_to_rtmp on; + } + http_remux { + enabled on; + mount [vhost]/[app]/[stream].flv; + } +} + diff --git a/trunk/conf/https.srs.conf b/trunk/conf/https.srs.conf new file mode 100644 index 000000000..8170185eb --- /dev/null +++ b/trunk/conf/https.srs.conf @@ -0,0 +1,55 @@ + +listen 1935; +max_connections 1000; +daemon off; +srs_log_tank console; + +http_server { + enabled on; + listen 8080; + dir ./objs/nginx/html; + https { + enabled on; + listen 8088; + key ./conf/server.key; + cert ./conf/server.crt; + } +} + +http_api { + enabled on; + listen 1985; + https { + enabled on; + listen 1990; + key ./conf/server.key; + cert ./conf/server.crt; + } +} +stats { + network 0; +} +rtc_server { + enabled on; + listen 8000; # UDP port + # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate + candidate $CANDIDATE; +} + +vhost __defaultVhost__ { + hls { + enabled on; + } + http_remux { + enabled on; + mount [vhost]/[app]/[stream].flv; + } + rtc { + enabled on; + # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtmp-to-rtc + rtmp_to_rtc off; + # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtc-to-rtmp + rtc_to_rtmp off; + } +} + diff --git a/trunk/configure b/trunk/configure index 1e8c50f67..be64ac9bf 100755 --- a/trunk/configure +++ b/trunk/configure @@ -604,6 +604,7 @@ install: @echo "Now copy srs conf files" @mkdir -p \$(__REAL_INSTALL)/conf @cp -f conf/*.conf \$(__REAL_INSTALL)/conf + @cp -f conf/server.key conf/server.crt \$(__REAL_INSTALL)/conf @echo "Now copy init.d script files" @mkdir -p \$(__REAL_INSTALL)/etc/init.d @cp -f etc/init.d/srs \$(__REAL_INSTALL)/etc/init.d diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 20c20b217..273f059fc 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2021-01-04, Install test-on self-sign certificate. v4.0.217 * v4.0, 2021-01-03, For [#2824](https://github.com/ossrs/srs/issues/2824): Support config in_docker to fix the detect fail. (#2824). v4.0.216 * v4.0, 2021-12-31, For [#2728](https://github.com/ossrs/srs/issues/2728): Refine error log for rtmp2rtc. (#2728). v4.0.215 * v4.0, 2021-12-29, Merge [#2770](https://github.com/ossrs/srs/pull/2770), [#2820](https://github.com/ossrs/srs/pull/2820): Bugs fixed. (#2770)(#2820). v4.0.214 diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 34e6eed6c..9238cb913 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 216 +#define VERSION_REVISION 217 #endif From fbb6d9464cbe34eb5ba81da408ffb79beb38c46b Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 4 Jan 2022 22:18:38 +0800 Subject: [PATCH 19/32] Discover api server and ip as candidates. v4.0.218 --- trunk/conf/full.conf | 5 ++ trunk/doc/CHANGELOG.md | 1 + trunk/src/app/srs_app_config.cpp | 19 +++++- trunk/src/app/srs_app_config.hpp | 1 + trunk/src/app/srs_app_rtc_api.cpp | 2 + trunk/src/app/srs_app_rtc_server.cpp | 87 ++++++++++++++++++++------ trunk/src/app/srs_app_rtc_server.hpp | 1 + trunk/src/core/srs_core_version4.hpp | 2 +- trunk/src/kernel/srs_kernel_consts.hpp | 1 + 9 files changed, 97 insertions(+), 22 deletions(-) diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index 8bf44582b..c630002fd 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -396,6 +396,11 @@ rtc_server { # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate # default: * candidate *; + # If api_as_candidates is on, SRS would try to use the IP of api server, specified by srs.sdk.js request: + # api:string "http://r.ossrs.net:1985/rtc/v1/play/" + # in this case, the r.ossrs.net and 39.107.238.185 will be added as candidates. + # Default: on + api_as_candidates on; # The IP family filter for auto discover candidate, it can be: # ipv4 Filter IP v4 candidates. # ipv6 Filter IP v6 candidates. diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 273f059fc..f7f97ffe1 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2021-01-04, Discover api server and ip as candidates. v4.0.218 * v4.0, 2021-01-04, Install test-on self-sign certificate. v4.0.217 * v4.0, 2021-01-03, For [#2824](https://github.com/ossrs/srs/issues/2824): Support config in_docker to fix the detect fail. (#2824). v4.0.216 * v4.0, 2021-12-31, For [#2728](https://github.com/ossrs/srs/issues/2728): Refine error log for rtmp2rtc. (#2728). v4.0.215 diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index d6ea94634..a984b4cd8 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -2542,7 +2542,7 @@ srs_error_t SrsConfig::check_normal_config() string n = conf->at(i)->name; if (n != "enabled" && n != "listen" && n != "dir" && n != "candidate" && n != "ecdsa" && n != "encrypt" && n != "reuseport" && n != "merge_nalus" && n != "black_hole" - && n != "ip_family") { + && n != "ip_family" && n != "api_as_candidates") { return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal rtc_server.%s", n.c_str()); } } @@ -3544,6 +3544,23 @@ std::string SrsConfig::get_rtc_server_candidates() return conf->arg0(); } +bool SrsConfig::get_api_as_candidates() +{ + static bool DEFAULT = true; + + SrsConfDirective* conf = root->get("rtc_server"); + if (!conf) { + return DEFAULT; + } + + conf = conf->get("api_as_candidates"); + if (!conf || conf->arg0().empty()) { + return DEFAULT; + } + + return SRS_CONF_PERFER_TRUE(conf->arg0()); +} + std::string SrsConfig::get_rtc_server_ip_family() { static string DEFAULT = "ipv4"; diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index 51510b5df..a37461643 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -469,6 +469,7 @@ public: virtual bool get_rtc_server_enabled(SrsConfDirective* conf); virtual int get_rtc_server_listen(); virtual std::string get_rtc_server_candidates(); + virtual bool get_api_as_candidates(); virtual std::string get_rtc_server_ip_family(); virtual bool get_rtc_server_ecdsa(); virtual bool get_rtc_server_encrypt(); diff --git a/trunk/src/app/srs_app_rtc_api.cpp b/trunk/src/app/srs_app_rtc_api.cpp index b64595c79..e9593ca90 100644 --- a/trunk/src/app/srs_app_rtc_api.cpp +++ b/trunk/src/app/srs_app_rtc_api.cpp @@ -117,6 +117,7 @@ srs_error_t SrsGoApiRtcPlay::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMe // The RTC user config object. SrsRtcUserConfig ruc; ruc.req_->ip = clientip; + ruc.api_ = api; srs_parse_rtmp_url(streamurl, ruc.req_->tcUrl, ruc.req_->stream); @@ -383,6 +384,7 @@ srs_error_t SrsGoApiRtcPublish::do_serve_http(ISrsHttpResponseWriter* w, ISrsHtt // The RTC user config object. SrsRtcUserConfig ruc; ruc.req_->ip = clientip; + ruc.api_ = api; srs_parse_rtmp_url(streamurl, ruc.req_->tcUrl, ruc.req_->stream); diff --git a/trunk/src/app/srs_app_rtc_server.cpp b/trunk/src/app/srs_app_rtc_server.cpp index 608245b3a..ab3584048 100644 --- a/trunk/src/app/srs_app_rtc_server.cpp +++ b/trunk/src/app/srs_app_rtc_server.cpp @@ -6,6 +6,7 @@ #include +#include using namespace std; #include @@ -149,18 +150,66 @@ bool srs_is_rtcp(const uint8_t* data, size_t len) return (len >= 12) && (data[0] & 0x80) && (data[1] >= 192 && data[1] <= 223); } -static std::vector get_candidate_ips() +srs_error_t api_server_as_candidates(string api, set& candidate_ips) { - std::vector candidate_ips; + srs_error_t err = srs_success; + if (api.empty() || !_srs_config->get_api_as_candidates()) { + return err; + } + + SrsHttpUri uri; + if ((err = uri.initialize(api)) != srs_success) { + return srs_error_wrap(err, "parse %s", api.c_str()); + } + + string hostname = uri.get_host(); + if (hostname.empty() || hostname == SRS_CONSTS_LOCALHOST_NAME) { + return err; + } + if (hostname == SRS_CONSTS_LOCALHOST || hostname == SRS_CONSTS_LOOPBACK || hostname == SRS_CONSTS_LOOPBACK6) { + return err; + } + + // Try to parse the domain name if not IP. + int family = 0; + string ip = srs_dns_resolve(hostname, family); + if (ip.empty() || ip == SRS_CONSTS_LOCALHOST || ip == SRS_CONSTS_LOOPBACK || ip == SRS_CONSTS_LOOPBACK6) { + return err; + } + + // Try to add the original hostname and ip as candidates. + candidate_ips.insert(hostname); + candidate_ips.insert(ip); + + return err; +} + +static set discover_candidates(SrsRtcUserConfig* ruc) +{ + srs_error_t err = srs_success; + + // Try to discover the eip as candidate, specified by user. + set candidate_ips; + if (!ruc->eip_.empty()) { + candidate_ips.insert(ruc->eip_); + } + + // Try to discover from api of request, if api_as_candidates enabled. + if ((err = api_server_as_candidates(ruc->api_, candidate_ips)) != srs_success) { + srs_warn("ignore discovering ip from api %s, err %s", ruc->api_.c_str(), srs_error_summary(err).c_str()); + srs_freep(err); + } + + // If not * or 0.0.0.0, use the candidate as exposed IP. string candidate = _srs_config->get_rtc_server_candidates(); if (candidate != "*" && candidate != "0.0.0.0") { - candidate_ips.push_back(candidate); + candidate_ips.insert(candidate); return candidate_ips; } - // For * or 0.0.0.0, auto discovery expose ip addresses. - std::vector& ips = srs_get_local_ips(); + // Discover from local network interface addresses. + vector& ips = srs_get_local_ips(); if (ips.empty()) { return candidate_ips; } @@ -180,7 +229,7 @@ static std::vector get_candidate_ips() continue; } - candidate_ips.push_back(ip->ip); + candidate_ips.insert(ip->ip); srs_trace("Best matched ip=%s, ifname=%s", ip->ip.c_str(), ip->ifname.c_str()); } @@ -195,7 +244,7 @@ static std::vector get_candidate_ips() continue; } - candidate_ips.push_back(ip->ip); + candidate_ips.insert(ip->ip); srs_trace("No best matched, use first ip=%s, ifname=%s", ip->ip.c_str(), ip->ifname.c_str()); return candidate_ips; } @@ -203,7 +252,7 @@ static std::vector get_candidate_ips() // We use the first one. if (candidate_ips.empty()) { SrsIPAddress* ip = ips[0]; - candidate_ips.push_back(ip->ip); + candidate_ips.insert(ip->ip); srs_warn("No best matched, use first ip=%s, ifname=%s", ip->ip.c_str(), ip->ifname.c_str()); return candidate_ips; } @@ -524,19 +573,17 @@ srs_error_t SrsRtcServer::do_create_session(SrsRtcUserConfig* ruc, SrsSdp& local local_sdp.set_fingerprint(_srs_rtc_dtls_certificate->get_fingerprint()); // We allows to mock the eip of server. - if (!ruc->eip_.empty()) { - string host; - int port = _srs_config->get_rtc_server_listen(); - srs_parse_hostport(ruc->eip_, host, port); - - local_sdp.add_candidate(host, port, "host"); - srs_trace("RTC: Use candidate mock_eip %s as %s:%d", ruc->eip_.c_str(), host.c_str(), port); - } else { - std::vector candidate_ips = get_candidate_ips(); - for (int i = 0; i < (int)candidate_ips.size(); ++i) { - local_sdp.add_candidate(candidate_ips[i], _srs_config->get_rtc_server_listen(), "host"); + if (true) { + int listen_port = _srs_config->get_rtc_server_listen(); + set candidates = discover_candidates(ruc); + for (set::iterator it = candidates.begin(); it != candidates.end(); ++it) { + string hostname; int port = listen_port; + srs_parse_hostport(*it, hostname,port); + local_sdp.add_candidate(hostname, port, "host"); } - srs_trace("RTC: Use candidates %s", srs_join_vector_string(candidate_ips, ", ").c_str()); + + vector v = vector(candidates.begin(), candidates.end()); + srs_trace("RTC: Use candidates %s", srs_join_vector_string(v, ", ").c_str()); } // Setup the negotiate DTLS by config. diff --git a/trunk/src/app/srs_app_rtc_server.hpp b/trunk/src/app/srs_app_rtc_server.hpp index 8d3343a28..f16530df9 100644 --- a/trunk/src/app/srs_app_rtc_server.hpp +++ b/trunk/src/app/srs_app_rtc_server.hpp @@ -78,6 +78,7 @@ public: SrsSdp remote_sdp_; std::string eip_; std::string codec_; + std::string api_; // Generated data. SrsRequest* req_; diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 9238cb913..5c2a4e8d1 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 217 +#define VERSION_REVISION 218 #endif diff --git a/trunk/src/kernel/srs_kernel_consts.hpp b/trunk/src/kernel/srs_kernel_consts.hpp index ef87b5575..5cac4a4bc 100644 --- a/trunk/src/kernel/srs_kernel_consts.hpp +++ b/trunk/src/kernel/srs_kernel_consts.hpp @@ -107,6 +107,7 @@ /////////////////////////////////////////////////////////// #define SRS_CONSTS_NULL_FILE "/dev/null" #define SRS_CONSTS_LOCALHOST "127.0.0.1" +#define SRS_CONSTS_LOCALHOST_NAME "localhost" #define SRS_CONSTS_LOOPBACK "0.0.0.0" #define SRS_CONSTS_LOOPBACK6 "::" From 4d09b8caae8e39a3b7eed4e0f71a65c6dfc6387f Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 5 Jan 2022 08:29:20 +0800 Subject: [PATCH 20/32] When reopening segment, never update the duration. (#2717). v4.0.219 --- trunk/doc/CHANGELOG.md | 1 + trunk/src/app/srs_app_dvr.cpp | 14 ++++++++++++-- trunk/src/app/srs_app_dvr.hpp | 2 ++ trunk/src/core/srs_core_version4.hpp | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index f7f97ffe1..7eb0775d3 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2021-01-05, For [#2717](https://github.com/ossrs/srs/issues/2717): When reopening segment, never update the duration. (#2717). v4.0.219 * v4.0, 2021-01-04, Discover api server and ip as candidates. v4.0.218 * v4.0, 2021-01-04, Install test-on self-sign certificate. v4.0.217 * v4.0, 2021-01-03, For [#2824](https://github.com/ossrs/srs/issues/2824): Support config in_docker to fix the detect fail. (#2824). v4.0.216 diff --git a/trunk/src/app/srs_app_dvr.cpp b/trunk/src/app/srs_app_dvr.cpp index 1675e12c6..bd06f84b3 100644 --- a/trunk/src/app/srs_app_dvr.cpp +++ b/trunk/src/app/srs_app_dvr.cpp @@ -745,6 +745,7 @@ SrsDvrSegmentPlan::SrsDvrSegmentPlan() { cduration = 0; wait_keyframe = false; + reopening_segment_ = false; } SrsDvrSegmentPlan::~SrsDvrSegmentPlan() @@ -845,6 +846,12 @@ srs_error_t SrsDvrSegmentPlan::on_video(SrsSharedPtrMessage* shared_video, SrsFo srs_error_t SrsDvrSegmentPlan::update_duration(SrsSharedPtrMessage* msg) { srs_error_t err = srs_success; + + // When reopening the segment, never update the duration, because there is actually no media data. + // @see https://github.com/ossrs/srs/issues/2717 + if (reopening_segment_) { + return err; + } srs_assert(segment); @@ -879,8 +886,11 @@ srs_error_t SrsDvrSegmentPlan::update_duration(SrsSharedPtrMessage* msg) return srs_error_wrap(err, "segment open"); } - // update sequence header - if ((err = hub->on_dvr_request_sh()) != srs_success) { + // When update sequence header, set the reopening state to prevent infinitely recursive call. + reopening_segment_ = true; + err = hub->on_dvr_request_sh(); + reopening_segment_ = false; + if (err != srs_success) { return srs_error_wrap(err, "request sh"); } diff --git a/trunk/src/app/srs_app_dvr.hpp b/trunk/src/app/srs_app_dvr.hpp index 212616b92..79e1964a9 100644 --- a/trunk/src/app/srs_app_dvr.hpp +++ b/trunk/src/app/srs_app_dvr.hpp @@ -198,6 +198,8 @@ private: // in config, in srs_utime_t srs_utime_t cduration; bool wait_keyframe; + // Whether reopening the DVR file. + bool reopening_segment_; public: SrsDvrSegmentPlan(); virtual ~SrsDvrSegmentPlan(); diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 5c2a4e8d1..224d67031 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 218 +#define VERSION_REVISION 219 #endif From 0165286fab89fd94a44983aac62c3412369c7ef0 Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 5 Jan 2022 13:51:15 +0800 Subject: [PATCH 21/32] Add docker badage --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b84842667..e92a994e0 100755 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ [![](https://img.shields.io/twitch/status/winlinvip?style=social)](https://www.twitch.tv/winlinvip) [![](https://badgen.net/discord/members/yZ4BnPmHAd)](https://discord.gg/yZ4BnPmHAd) [![](https://opencollective.com/srs-server/tiers/badge.svg)](https://opencollective.com/srs-server/contribute) -[![](https://img.shields.io/stackexchange/stackoverflow/r/17679565)](https://stackoverflow.com/questions/tagged/simple-realtime-server) +[![](https://badgen.net/badge/srs/stackoverflow/orange?icon=terminal)](https://stackoverflow.com/questions/tagged/simple-realtime-server) +[![](https://img.shields.io/docker/pulls/ossrs/srs)](https://hub.docker.com/r/ossrs/srs/tags) SRS/4.0,[Leo](https://github.com/ossrs/srs/wiki/Product#release40),是一个简单高效的实时视频服务器,支持RTMP/WebRTC/HLS/HTTP-FLV/SRT。 From 6919011e864af44a111503189a75ba2e60d7c57c Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 5 Jan 2022 14:36:42 +0800 Subject: [PATCH 22/32] Update sync script, ignore gb28181 --- trunk/scripts/git.commit.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/trunk/scripts/git.commit.sh b/trunk/scripts/git.commit.sh index 509da3c3c..0de1cfe2d 100755 --- a/trunk/scripts/git.commit.sh +++ b/trunk/scripts/git.commit.sh @@ -1,5 +1,8 @@ #!/bin/bash -#for file in $(git remote); do echo ""; git push $file $@; done -for file in $(git remote -v|grep -v https|grep push|awk '{print $1}'); do echo ""; echo "git push $file $@"; git push $file $@; done +for file in $(git remote -v|grep -v https|grep -v gb28181|grep push|awk '{print $1}'); do + echo ""; + echo "git push $file $@"; + git push $file $@; +done From 51ca3fd80a907df1a9939a2fd0d517e6e8066e8e Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 6 Jan 2022 11:31:06 +0800 Subject: [PATCH 23/32] Only discover api server ip as candidate. --- trunk/src/app/srs_app_rtc_server.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/trunk/src/app/srs_app_rtc_server.cpp b/trunk/src/app/srs_app_rtc_server.cpp index ab3584048..b08db9c04 100644 --- a/trunk/src/app/srs_app_rtc_server.cpp +++ b/trunk/src/app/srs_app_rtc_server.cpp @@ -178,8 +178,7 @@ srs_error_t api_server_as_candidates(string api, set& candidate_ips) return err; } - // Try to add the original hostname and ip as candidates. - candidate_ips.insert(hostname); + // Try to add the API server ip as candidates. candidate_ips.insert(ip); return err; From 4434bb1a2503bdc38bc400b6406b18737b0ab9f3 Mon Sep 17 00:00:00 2001 From: liuxiaoliang <37902979+liuxiaoliang8@users.noreply.github.com> Date: Thu, 6 Jan 2022 12:02:31 +0800 Subject: [PATCH 24/32] SRT: use const string to sprint rtmp url. (#2847) --- trunk/src/srt/srt_to_rtmp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trunk/src/srt/srt_to_rtmp.cpp b/trunk/src/srt/srt_to_rtmp.cpp index 53ae3b01a..268a1cbf4 100644 --- a/trunk/src/srt/srt_to_rtmp.cpp +++ b/trunk/src/srt/srt_to_rtmp.cpp @@ -268,10 +268,10 @@ rtmp_client::rtmp_client(std::string key_path):_key_path(key_path) break; } } - port = (port == 0) ? 1935 : port; + port = (port == 0) ? SRS_CONSTS_RTMP_DEFAULT_PORT : port; std::stringstream ss; - ss << "rtmp://127.0.0.1"; + ss << "rtmp://" << SRS_CONSTS_LOCALHOST; ss << ":" << port; ss << "/" << _appname; if (_vhost != DEF_VHOST) { From 623ca788aa1011cbbbfd9c7540e8cfa3091206cd Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 6 Jan 2022 21:56:41 +0800 Subject: [PATCH 25/32] Update for HTTPS server --- README.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e92a994e0..ef17ffc61 100755 --- a/README.md +++ b/README.md @@ -32,12 +32,6 @@ SRS is licenced under [MIT][LICENSE], but some depended libraries are distribute ## Usage -> Highly recommend that directly run SRS by -> **docker([CN](https://github.com/ossrs/srs/wiki/v4_CN_Home#docker) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_Home#docker))**, -> or **K8s([CN](https://github.com/ossrs/srs/wiki/v4_CN_Home#k8s) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_Home#k8s))**, -> however it's also easy to build SRS from source code, for detail please see -> **Getting Started([CN](https://github.com/ossrs/srs/wiki/v4_CN_Home#getting-started) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_Home#getting-started))**. - Build SRS from source: ``` @@ -52,8 +46,6 @@ by [FFmpeg](https://ffmpeg.org/download.html) or [OBS](https://obsproject.com/do ffmpeg -re -i ./doc/source.flv -c copy -f flv -y rtmp://localhost/live/livestream ``` -> Note: It's also able to [publish by H5](http://localhost:8080/players/rtc_publisher.html?autostart=true) if WebRTC is enabled. - Play the following streams by [players](https://ossrs.net): * RTMP (by [VLC](https://www.videolan.org/)): rtmp://localhost/live/livestream @@ -64,6 +56,20 @@ Note that if convert RTMP to WebRTC, please use [`rtmp2rtc.conf`](https://github * H5(WebRTC): [webrtc://localhost/live/livestream](http://localhost:8080/players/rtc_player.html?autostart=true) +> Note: Besides of FFmpeg or OBS, it's also able to [publish by H5](http://localhost:8080/players/rtc_publisher.html?autostart=true) +> if [WebRTC](https://github.com/ossrs/srs/issues/307) is enabled. + +> Highly recommend that directly run SRS by +> **docker([CN](https://github.com/ossrs/srs/wiki/v4_CN_Home#docker) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_Home#docker))**, +> or **K8s([CN](https://github.com/ossrs/srs/wiki/v4_CN_Home#k8s) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_Home#k8s))**, +> however it's also easy to build SRS from source code, for detail please see +> **Getting Started([CN](https://github.com/ossrs/srs/wiki/v4_CN_Home#getting-started) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_Home#getting-started))**. + +> Note: If need HTTPS, by which WebRTC and modern browsers require, please read +> **HTTPS API([CN](https://github.com/ossrs/srs/wiki/v4_CN_HTTPApi#https-api) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_HTTPApi#https-api))** +> and **HTTPS Live Streaming([CN](https://github.com/ossrs/srs/wiki/v4_EN_DeliveryHttpStream#https-flv-live-stream) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_DeliveryHttpStream#https-flv-live-stream))**, +> however HTTPS proxy also works perfect with SRS such as Nginx. + From 2f6d6a0ac0fb5e9a1b9caf2c477174af0005200a Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 7 Jan 2022 16:41:02 +0800 Subject: [PATCH 26/32] Change warn to trace for release query --- trunk/src/app/srs_app_latest_version.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trunk/src/app/srs_app_latest_version.cpp b/trunk/src/app/srs_app_latest_version.cpp index c2362e63c..4ea8d5fdb 100644 --- a/trunk/src/app/srs_app_latest_version.cpp +++ b/trunk/src/app/srs_app_latest_version.cpp @@ -222,7 +222,7 @@ srs_error_t SrsLatestVersion::cycle() string url; srs_utime_t starttime = srs_update_system_time(); if ((err = query_latest_version(url)) != srs_success) { - srs_warn("query err %s", srs_error_desc(err).c_str()); + srs_trace("query release err %s", srs_error_summary(err).c_str()); srs_freep(err); // Ignore any error. } From 08910e5cce08e085efca84a48b80222f00b068ad Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 8 Jan 2022 19:18:55 +0800 Subject: [PATCH 27/32] Update README --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index ef17ffc61..ac198ac26 100755 --- a/README.md +++ b/README.md @@ -9,10 +9,7 @@ [![](https://ossrs.net/wiki/images/srs-faq.svg)](https://github.com/ossrs/srs/issues/2716) [![](https://ossrs.net/wiki/images/mulan-incubating.svg)](http://mulanos.cn) [![](https://ossrs.net/wiki/images/srs-alternativeto.svg)](https://alternativeto.net/software/srs/about/) -[![](https://ossrs.net/wiki/images/srs-facebook.svg)](https://www.facebook.com/winlinvip) -[![](https://badgen.net/twitter/follow/winlinvip)](https://twitter.com/winlinvip) [![](https://img.shields.io/youtube/channel/views/UCP6ZblCL_fIJoEyUzZxC1ng?style=social)](https://www.youtube.com/channel/UCP6ZblCL_fIJoEyUzZxC1ng) -[![](https://img.shields.io/twitch/status/winlinvip?style=social)](https://www.twitch.tv/winlinvip) [![](https://badgen.net/discord/members/yZ4BnPmHAd)](https://discord.gg/yZ4BnPmHAd) [![](https://opencollective.com/srs-server/tiers/badge.svg)](https://opencollective.com/srs-server/contribute) [![](https://badgen.net/badge/srs/stackoverflow/orange?icon=terminal)](https://stackoverflow.com/questions/tagged/simple-realtime-server) From f178d7aae0c3258e1308b5b488684d577d8cd3d1 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 10 Jan 2022 14:18:22 +0800 Subject: [PATCH 28/32] Update README for HTTPS Callback --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ac198ac26..32b84ddce 100755 --- a/README.md +++ b/README.md @@ -62,8 +62,9 @@ Note that if convert RTMP to WebRTC, please use [`rtmp2rtc.conf`](https://github > however it's also easy to build SRS from source code, for detail please see > **Getting Started([CN](https://github.com/ossrs/srs/wiki/v4_CN_Home#getting-started) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_Home#getting-started))**. -> Note: If need HTTPS, by which WebRTC and modern browsers require, please read -> **HTTPS API([CN](https://github.com/ossrs/srs/wiki/v4_CN_HTTPApi#https-api) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_HTTPApi#https-api))** +> Note: If need HTTPS, by which WebRTC and modern browsers require, please read +> **HTTPS API([CN](https://github.com/ossrs/srs/wiki/v4_CN_HTTPApi#https-api) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_HTTPApi#https-api))** +> and **HTTPS Callback([CN](https://github.com/ossrs/srs/wiki/v4_CN_HTTPCallback#https-callback) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_HTTPCallback#https-callback))** > and **HTTPS Live Streaming([CN](https://github.com/ossrs/srs/wiki/v4_EN_DeliveryHttpStream#https-flv-live-stream) / [EN](https://github.com/ossrs/srs/wiki/v4_EN_DeliveryHttpStream#https-flv-live-stream))**, > however HTTPS proxy also works perfect with SRS such as Nginx. From c85daeb12d9ed33aa65539fab8946c729e6e6a4f Mon Sep 17 00:00:00 2001 From: chundonglinlin Date: Mon, 10 Jan 2022 19:14:11 +0800 Subject: [PATCH 29/32] RTC: fix play crash or no stream for rtmp2rtc tips.(#2728) (#2863) --- trunk/src/app/srs_app_rtc_api.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trunk/src/app/srs_app_rtc_api.cpp b/trunk/src/app/srs_app_rtc_api.cpp index e9593ca90..de5134b8b 100644 --- a/trunk/src/app/srs_app_rtc_api.cpp +++ b/trunk/src/app/srs_app_rtc_api.cpp @@ -187,9 +187,9 @@ srs_error_t SrsGoApiRtcPlay::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMe } // For RTMP to RTC, fail if disabled and RTMP is active, see https://github.com/ossrs/srs/issues/2728 - if (!_srs_config->get_rtc_to_rtmp(ruc.req_->vhost)) { + if (!_srs_config->get_rtc_from_rtmp(ruc.req_->vhost)) { SrsLiveSource* rtmp = _srs_sources->fetch(ruc.req_); - if (!rtmp->inactive()) { + if (rtmp && rtmp->inactive()) { return srs_error_new(ERROR_RTC_DISABLED, "Disabled rtmp_to_rtc of %s, see #2728", ruc.req_->vhost.c_str()); } } From 2bc5e9a8b463d9a853b9daa151c4d7f63e26e1f7 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 10 Jan 2022 19:16:01 +0800 Subject: [PATCH 30/32] RTC: fix play crash or no stream for rtmp2rtc tips.(#2863). v4.0.220 --- trunk/doc/CHANGELOG.md | 9 +++++---- trunk/src/core/srs_core_version4.hpp | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 7eb0775d3..9ab0ff4f4 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,10 +8,11 @@ The changelog for SRS. ## SRS 4.0 Changelog -* v4.0, 2021-01-05, For [#2717](https://github.com/ossrs/srs/issues/2717): When reopening segment, never update the duration. (#2717). v4.0.219 -* v4.0, 2021-01-04, Discover api server and ip as candidates. v4.0.218 -* v4.0, 2021-01-04, Install test-on self-sign certificate. v4.0.217 -* v4.0, 2021-01-03, For [#2824](https://github.com/ossrs/srs/issues/2824): Support config in_docker to fix the detect fail. (#2824). v4.0.216 +* v4.0, 2022-01-20, Merge [#2863](https://github.com/ossrs/srs/pull/2863): RTC: fix play crash or no stream for rtmp2rtc tips.(#2863). v4.0.220 +* v4.0, 2022-01-05, For [#2717](https://github.com/ossrs/srs/issues/2717): When reopening segment, never update the duration. (#2717). v4.0.219 +* v4.0, 2022-01-04, Discover api server and ip as candidates. v4.0.218 +* v4.0, 2022-01-04, Install test-on self-sign certificate. v4.0.217 +* v4.0, 2022-01-03, For [#2824](https://github.com/ossrs/srs/issues/2824): Support config in_docker to fix the detect fail. (#2824). v4.0.216 * v4.0, 2021-12-31, For [#2728](https://github.com/ossrs/srs/issues/2728): Refine error log for rtmp2rtc. (#2728). v4.0.215 * v4.0, 2021-12-29, Merge [#2770](https://github.com/ossrs/srs/pull/2770), [#2820](https://github.com/ossrs/srs/pull/2820): Bugs fixed. (#2770)(#2820). v4.0.214 * v4.0, 2021-12-27, Fix [#2811](https://github.com/ossrs/srs/issues/2811): Fix ulimit issue by detecting epoll on Ubuntu. (#2811). v4.0.213 diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 224d67031..38880bf57 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 219 +#define VERSION_REVISION 220 #endif From 750c58beff5700c020a03cbf66d9b59940f363ac Mon Sep 17 00:00:00 2001 From: chundonglinlin Date: Tue, 11 Jan 2022 08:18:06 +0800 Subject: [PATCH 31/32] RTC: fix play rtc judge for rtmp inactive.(#2863) (#2867) --- trunk/src/app/srs_app_rtc_api.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trunk/src/app/srs_app_rtc_api.cpp b/trunk/src/app/srs_app_rtc_api.cpp index de5134b8b..d72b192e1 100644 --- a/trunk/src/app/srs_app_rtc_api.cpp +++ b/trunk/src/app/srs_app_rtc_api.cpp @@ -189,7 +189,7 @@ srs_error_t SrsGoApiRtcPlay::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMe // For RTMP to RTC, fail if disabled and RTMP is active, see https://github.com/ossrs/srs/issues/2728 if (!_srs_config->get_rtc_from_rtmp(ruc.req_->vhost)) { SrsLiveSource* rtmp = _srs_sources->fetch(ruc.req_); - if (rtmp && rtmp->inactive()) { + if (rtmp && !rtmp->inactive()) { return srs_error_new(ERROR_RTC_DISABLED, "Disabled rtmp_to_rtc of %s, see #2728", ruc.req_->vhost.c_str()); } } From e08c68b917abc5ff99c5ebbc24a74d3ad1f3c7fd Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 11 Jan 2022 08:26:21 +0800 Subject: [PATCH 32/32] Update contribution --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d17a7da13..b08e2cd72 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,5 @@ Welome to contribute to SRS! -1. Please read [FAQ](https://github.com/ossrs/srs/issues/2716) before file new PR. -2. Fix some [issues](https://github.com/ossrs/srs/issues), then follow the [guide](https://github.com/ossrs/srs/wiki/HowToFilePR). +1. Please read **Contribution([CN](https://github.com/ossrs/srs/issues/2866#contribution) EN)** before file new PR. +2. Please start from fixing some [issues](https://github.com/ossrs/srs/issues), then follow the [guide](https://github.com/ossrs/srs/wiki/HowToFilePR). 3. We will review your PR ASAP.