From 0391e71682498da50dab0650a32bfde1d48ca2e1 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 28 Jun 2021 08:02:49 +0800 Subject: [PATCH 1/2] Squash: Merge SRS4 --- 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 e89a58005..733131a7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* 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 * v4.0, 2021-06-28, Merge [#2438](https://github.com/ossrs/srs/pull/2438), fix losing of last HLS ts file 4.0.133 diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 7890accec..f9ba8dad6 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 135 +#define VERSION_REVISION 136 #endif From 346cc96d7a5dbdbb1bf049345c15791d575e3d0c Mon Sep 17 00:00:00 2001 From: "Alex.CR" Date: Wed, 30 Jun 2021 07:14:56 +0800 Subject: [PATCH 2/2] 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;