From 98e56f53258a887830389a9db71c4c036e735a9a Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 28 Jun 2021 08:34:00 +0800 Subject: [PATCH 1/5] Refine the random id by srs_random_str --- trunk/src/app/srs_app_latest_version.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/trunk/src/app/srs_app_latest_version.cpp b/trunk/src/app/srs_app_latest_version.cpp index c66b198e9..a3168c1d3 100644 --- a/trunk/src/app/srs_app_latest_version.cpp +++ b/trunk/src/app/srs_app_latest_version.cpp @@ -54,12 +54,7 @@ srs_error_t SrsLatestVersion::start() return srs_success; } - char buf[10]; - srs_random_generate(buf, sizeof(buf)); - for (int i = 0; i < (int)sizeof(buf); i++) { - buf[i] = 'a' + uint8_t(buf[i])%25; - } - server_id_ = string(buf, sizeof(buf)); + server_id_ = srs_random_str(10); return trd_->start(); } From cbca6d94d1e39641a1c2b203d520b6f7b0fdebb1 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 28 Jun 2021 14:45:33 +0800 Subject: [PATCH 2/5] Add API path document --- README.md | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 73ab0b604..7dad6ea17 100755 --- a/README.md +++ b/README.md @@ -106,26 +106,40 @@ A big THANK YOU goes to: The ports used by SRS, kernel services: -* tcp://1935, for RTMP live streaming server([CN][v4_CN_DeliveryRTMP],[EN][v4_EN_DeliveryRTMP]). -* tcp://1985, HTTP API server, for HTTP-API([CN][v4_CN_HTTPApi], [EN][v4_EN_HTTPApi]), WebRTC([CN][v4_CN_WebRTC], [EN][v4_EN_WebRTC]), etc. -* tcp://8080, HTTP live streaming server, HTTP-FLV([CN][v4_CN_SampleHttpFlv], [EN][v4_EN_SampleHttpFlv]), HLS([CN][v4_CN_SampleHLS], [EN][v4_EN_SampleHLS]) as such. -* udp://8000, WebRTC Media([CN][v4_CN_WebRTC], [EN][v4_EN_WebRTC]) server. +* `tcp://1935`, for RTMP live streaming server([CN][v4_CN_DeliveryRTMP],[EN][v4_EN_DeliveryRTMP]). +* `tcp://1985`, HTTP API server, for HTTP-API([CN][v4_CN_HTTPApi], [EN][v4_EN_HTTPApi]), WebRTC([CN][v4_CN_WebRTC], [EN][v4_EN_WebRTC]), etc. +* `tcp://8080`, HTTP live streaming server, HTTP-FLV([CN][v4_CN_SampleHttpFlv], [EN][v4_EN_SampleHttpFlv]), HLS([CN][v4_CN_SampleHLS], [EN][v4_EN_SampleHLS]) as such. +* `udp://8000`, WebRTC Media([CN][v4_CN_WebRTC], [EN][v4_EN_WebRTC]) server. For optional HTTPS services, which might be provided by other web servers: -* tcp://8088, HTTPS live streaming server. -* tcp://1990, HTTPS API server. +* `tcp://8088`, HTTPS live streaming server. +* `tcp://1990`, HTTPS API server. For optional stream caster services, to push streams to SRS: -* udp://8935, Stream Caster: [Push MPEGTS over UDP](https://github.com/ossrs/srs/wiki/v4_CN_Streamer#push-mpeg-ts-over-udp) server. -* tcp://554, Stream Caster: [Push RTSP](https://github.com/ossrs/srs/wiki/v4_CN_Streamer#push-rtsp-to-srs) server. -* tcp://8936, Stream Caster: [Push HTTP-FLV](https://github.com/ossrs/srs/wiki/v4_CN_Streamer#push-http-flv-to-srs) server. -* udp://10080, Stream Caster: [Push SRT Media](https://github.com/ossrs/srs/issues/1147#issuecomment-577469119) server. +* `udp://8935`, Stream Caster: [Push MPEGTS over UDP](https://github.com/ossrs/srs/wiki/v4_CN_Streamer#push-mpeg-ts-over-udp) server. +* `tcp://554`, Stream Caster: [Push RTSP](https://github.com/ossrs/srs/wiki/v4_CN_Streamer#push-rtsp-to-srs) server. +* `tcp://8936`, Stream Caster: [Push HTTP-FLV](https://github.com/ossrs/srs/wiki/v4_CN_Streamer#push-http-flv-to-srs) server. +* `udp://10080`, Stream Caster: [Push SRT Media](https://github.com/ossrs/srs/issues/1147#issuecomment-577469119) server. For external services to work with SRS: -* udp://1989, [WebRTC Signaling](https://github.com/ossrs/signaling#usage) server. +* `udp://1989`, [WebRTC Signaling](https://github.com/ossrs/signaling#usage) server. + +## APIs + +The API used by SRS: + +* `/api/v1/` The HTTP API path. +* `/rtc/v1/` The HTTP API path for RTC. +* `/sig/v1/` The [demo signaling](https://github.com/ossrs/signaling) API. + +Other API used by [ossrs.net](https://ossrs.net): + +* `/gif/v1` The statistic API. +* `/service/v1/` The latest available version API. +* `/ws-service/v1/` The latest available version API, by websocket. ## Features From cff4c07be43da56fc30032efb3f416477575de69 Mon Sep 17 00:00:00 2001 From: long Date: Wed, 30 Jun 2021 07:24:12 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=89=93=E5=BC=80rtmp=E8=BD=ACrtc=EF=BC=8C?= =?UTF-8?q?=E5=BD=93rtmp=E9=87=8D=E5=A4=8D=E6=8E=A8=E6=B5=81=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E7=AC=AC2=E8=B7=AF=E4=BC=9A=E5=BD=B1=E5=93=8D?= =?UTF-8?q?=E7=AC=AC1=E8=B7=AF=E6=B5=81=E7=9A=84=E6=AD=A3=E5=B8=B8?= =?UTF-8?q?=E6=92=AD=E6=94=BE=E3=80=82=20(#2448)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update srs_app_rtmp_conn.cpp 修复推重复的RTMP流导致的RTC和RTMP播放的问题 * change ERROR_RTC_SOURCE_BUSY to ERROR_SYSTEM_STREAM_BUSY change ERROR_RTC_SOURCE_BUSY to ERROR_SYSTEM_STREAM_BUSY Co-authored-by: Haibo Chen <495810242@qq.com> --- trunk/src/app/srs_app_rtmp_conn.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index 78ce829f8..246dcfd62 100644 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -944,6 +944,11 @@ srs_error_t SrsRtmpConn::acquire_publish(SrsLiveSource* source) SrsRequest* req = info->req; + // Check whether RTMP stream is busy. + if (!source->can_publish(info->edge)) { + return srs_error_new(ERROR_SYSTEM_STREAM_BUSY, "rtmp: stream %s is busy", req->get_stream_url().c_str()); + } + // Check whether RTC stream is busy. #ifdef SRS_RTC SrsRtcSource *rtc = NULL; @@ -955,16 +960,11 @@ srs_error_t SrsRtmpConn::acquire_publish(SrsLiveSource* source) } if (!rtc->can_publish()) { - return srs_error_new(ERROR_RTC_SOURCE_BUSY, "rtc stream %s busy", req->get_stream_url().c_str()); + return srs_error_new(ERROR_SYSTEM_STREAM_BUSY, "rtc stream %s busy", req->get_stream_url().c_str()); } } #endif - // Check whether RTMP stream is busy. - if (!source->can_publish(info->edge)) { - return srs_error_new(ERROR_SYSTEM_STREAM_BUSY, "rtmp: stream %s is busy", req->get_stream_url().c_str()); - } - // Bridge to RTC streaming. #if defined(SRS_RTC) && defined(SRS_FFMPEG_FIT) if (rtc) { From 7e164b006116d4db13a97ad1fa750c0c10ef96e5 Mon Sep 17 00:00:00 2001 From: "Alex.CR" Date: Wed, 30 Jun 2021 07:14:56 +0800 Subject: [PATCH 4/5] SRT: Fix bug for multiple NALUs, when configure OBS in zerolatency. (#2440) * solve srt push bugs * solve h264 mutiple nalus in srt when obs is configured in zerolatency * optimize error code * optimize error code * optimize error code * add commemnt:we only skip pps/sps frame and send left nalus in srt * add commemnt:we only skip pps/sps frame and send left nalus in srt Co-authored-by: shiwei --- trunk/src/srt/srt_to_rtmp.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/trunk/src/srt/srt_to_rtmp.cpp b/trunk/src/srt/srt_to_rtmp.cpp index c8de5e3d5..571d5eaf4 100644 --- a/trunk/src/srt/srt_to_rtmp.cpp +++ b/trunk/src/srt/srt_to_rtmp.cpp @@ -466,14 +466,14 @@ srs_error_t rtmp_client::on_ts_video(std::shared_ptr avs_ptr, uint64_ return srs_error_wrap(err, "demux annexb"); } - //srs_trace_data(frame, frame_size, "video annexb demux:"); // 5bits, 7.3.1 NAL unit syntax, // ISO_IEC_14496-10-AVC-2003.pdf, page 44. // 7: SPS, 8: PPS, 5: I Frame, 1: P Frame SrsAvcNaluType nal_unit_type = (SrsAvcNaluType)(frame[0] & 0x1f); - // ignore the nalu type sps(7), pps(8), aud(9) - if (nal_unit_type == SrsAvcNaluTypeAccessUnitDelimiter) { + // ignore the nalu type aud(9), pad(12) + if ((nal_unit_type == SrsAvcNaluTypeAccessUnitDelimiter) + || (nal_unit_type == SrsAvcNaluTypeFilterData)) { continue; } @@ -523,12 +523,14 @@ srs_error_t rtmp_client::on_ts_video(std::shared_ptr avs_ptr, uint64_ } // ibp frame. - // TODO: FIXME: we should group all frames to a rtmp/flv message from one ts message. - srs_info("mpegts: demux avc ibp frame size=%d, dts=%d", frame_size, dts); - if ((err = write_h264_ipb_frame(frame, frame_size, dts, pts)) != srs_success) { + // for Issue: https://github.com/ossrs/srs/issues/2390 + // we only skip pps/sps frame and send left nalus. + srs_info("mpegts: demux avc ibp frame size=%d, dts=%d", avs_ptr->left() + frame_size, dts); + if ((err = write_h264_ipb_frame(avs_ptr->head() - frame_size, avs_ptr->left() + frame_size, dts, pts)) != srs_success) { return srs_error_wrap(err, "write frame"); } _last_live_ts = now_ms(); + break; } return err; From ef43532cf40f67a3b9daf39be567cb06a6251927 Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 30 Jun 2021 07:17:25 +0800 Subject: [PATCH 5/5] Merge #2440, fix #2390, SRT bug for zerolatency. 4.0.137 --- CHANGELOG.md | 1 + trunk/src/core/srs_core_version4.hpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d63e07548..451e04c15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2021-06-30, Merge [#2440](https://github.com/ossrs/srs/pull/2440), fix [#2390](https://github.com/ossrs/srs/issues/2390), SRT bug for zerolatency. 4.0.137 * v4.0, 2021-06-28, Merge [#2435](https://github.com/ossrs/srs/pull/2435), fix bug for HTTP-RAW-API to check vhost. 4.0.136 * v4.0, 2021-06-28, Fix [#2431](https://github.com/ossrs/srs/issues/2431), configure FFmpeg bug. 4.0.135 * v4.0, 2021-06-28, Merge [#2444](https://github.com/ossrs/srs/pull/2444), add libavcodec/crystalhd.c for FFmpeg. 4.0.134 diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index f9ba8dad6..df8223768 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 136 +#define VERSION_REVISION 137 #endif