diff --git a/trunk/3rdparty/srs-bench/blackbox/hevc_test.go b/trunk/3rdparty/srs-bench/blackbox/hevc_test.go index 2c969dbfd..892c6643c 100644 --- a/trunk/3rdparty/srs-bench/blackbox/hevc_test.go +++ b/trunk/3rdparty/srs-bench/blackbox/hevc_test.go @@ -709,6 +709,8 @@ func TestSlow_SrtPublish_RtmpPlay_HEVC_Basic(t *testing.T) { v.dvrFile = path.Join(svr.WorkDir(), "objs", fmt.Sprintf("srs-ffprobe-%v.ts", streamID)) v.streamURL = fmt.Sprintf("rtmp://localhost:%v/live/%v", svr.RTMPPort(), streamID) v.duration, v.timeout = duration, time.Duration(*srsFFprobeTimeout)*time.Millisecond + v.ffmpegCmdName = "ffmpeg7" // ffmpeg 5 don't support enhanced rtmp, so use ffmpeg 7 instead. + v.ffprobeCmdName = "ffprobe7" }) wg.Add(1) go func() { @@ -807,6 +809,8 @@ func TestSlow_SrtPublish_HttpFlvPlay_HEVC_Basic(t *testing.T) { v.dvrFile = path.Join(svr.WorkDir(), "objs", fmt.Sprintf("srs-ffprobe-%v.ts", streamID)) v.streamURL = fmt.Sprintf("http://localhost:%v/live/%v.flv", svr.HTTPPort(), streamID) v.duration, v.timeout = duration, time.Duration(*srsFFprobeTimeout)*time.Millisecond + v.ffmpegCmdName = "ffmpeg7" // ffmpeg 5 don't support enhanced rtmp, so use ffmpeg 7 instead. + v.ffprobeCmdName = "ffprobe7" }) wg.Add(1) go func() { diff --git a/trunk/3rdparty/srs-bench/blackbox/util.go b/trunk/3rdparty/srs-bench/blackbox/util.go index 53a6e9d29..d1c691e97 100644 --- a/trunk/3rdparty/srs-bench/blackbox/util.go +++ b/trunk/3rdparty/srs-bench/blackbox/util.go @@ -666,6 +666,8 @@ type ffmpegClient struct { // The backend service process. process *backendService + // FFmpeg cmd name + ffmpegCmdName string // FFmpeg cli args, without ffmpeg binary. args []string // Let the process quit, do not cancel the case. @@ -678,6 +680,7 @@ func NewFFmpeg(opts ...func(v *ffmpegClient)) FFmpegClient { v := &ffmpegClient{ process: newBackendService(), cancelCaseWhenQuit: true, + ffmpegCmdName: *srsFFmpeg, } // Do cleanup. @@ -702,7 +705,7 @@ func (v *ffmpegClient) ReadyCtx() context.Context { func (v *ffmpegClient) Run(ctx context.Context, cancel context.CancelFunc) error { logger.Tf(ctx, "Starting FFmpeg by %v", strings.Join(v.args, " ")) - v.process.name = *srsFFmpeg + v.process.name = v.ffmpegCmdName v.process.args = v.args v.process.env = os.Environ() v.process.duration = v.ffmpegDuration @@ -746,6 +749,10 @@ type ffprobeClient struct { // The timeout to wait for task to done. timeout time.Duration + // the FFprobe cmd name + ffprobeCmdName string + // the ffmpeg cmd name + ffmpegCmdName string // Whether do DVR by FFmpeg, if using SRS DVR, please set to false. dvrByFFmpeg bool // The stream to DVR for probing. Ignore if not DVR by ffmpeg @@ -764,8 +771,10 @@ type ffprobeClient struct { func NewFFprobe(opts ...func(v *ffprobeClient)) FFprobeClient { v := &ffprobeClient{ - metadata: &ffprobeObject{}, - dvrByFFmpeg: true, + metadata: &ffprobeObject{}, + dvrByFFmpeg: true, + ffprobeCmdName: *srsFFprobe, + ffmpegCmdName: *srsFFmpeg, } v.doneCtx, v.doneCancel = context.WithCancel(context.Background()) @@ -842,7 +851,7 @@ func (v *ffprobeClient) doDVR(ctx context.Context) error { } process := newBackendService() - process.name = *srsFFmpeg + process.name = v.ffmpegCmdName process.args = []string{ "-t", fmt.Sprintf("%v", int64(v.duration/time.Second)), "-i", v.streamURL, "-c", "copy", "-y", v.dvrFile, @@ -869,7 +878,7 @@ func (v *ffprobeClient) doDVR(ctx context.Context) error { func (v *ffprobeClient) doProbe(ctx context.Context, cancel context.CancelFunc) error { process := newBackendService() - process.name = *srsFFprobe + process.name = v.ffprobeCmdName process.args = []string{ "-show_error", "-show_private_data", "-v", "quiet", "-find_stream_info", "-analyzeduration", fmt.Sprintf("%v", int64(v.duration/time.Microsecond)), diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 21d32a441..d31d80308 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -7,6 +7,7 @@ The changelog for SRS. ## SRS 7.0 Changelog +* v7.0, 2025-09-09, Merge [#4446](https://github.com/ossrs/srs/pull/4446): SRT2RTMP: fix srt bridge hevc to rtmp error. v7.0.84 (#4446) * v7.0, 2025-09-09, Merge [#4482](https://github.com/ossrs/srs/pull/4482): AI: Fix naming issue for protocol module. v7.0.83 (#4482) * v7.0, 2025-09-07, Merge [#4479](https://github.com/ossrs/srs/pull/4479): AI: Fix naming problem in kernel module. v7.0.82 (#4479) * v7.0, 2025-09-06, Merge [#4478](https://github.com/ossrs/srs/pull/4478): AI: Add more utests for kernel module. v7.0.81 (#4478) diff --git a/trunk/src/app/srs_app_srt_source.cpp b/trunk/src/app/srs_app_srt_source.cpp index e70222cfc..7843ac65d 100644 --- a/trunk/src/app/srs_app_srt_source.cpp +++ b/trunk/src/app/srs_app_srt_source.cpp @@ -671,6 +671,7 @@ srs_error_t SrsSrtFrameBuilder::check_vps_sps_pps_change(SrsTsMessage *msg) // ts tbn to flv tbn. uint32_t dts = (uint32_t)(msg->dts_ / 90); + uint32_t pts = (uint32_t)(msg->pts_ / 90); std::string sh; SrsUniquePtr hevc(new SrsRawHEVCStream()); @@ -682,8 +683,14 @@ srs_error_t SrsSrtFrameBuilder::check_vps_sps_pps_change(SrsTsMessage *msg) // h265 packet to flv packet. char *flv = NULL; int nb_flv = 0; - if ((err = hevc->mux_avc2flv(sh, SrsVideoAvcFrameTypeKeyFrame, SrsVideoAvcFrameTraitSequenceHeader, dts, dts, &flv, &nb_flv)) != srs_success) { - return srs_error_wrap(err, "avc to flv"); + if ((err = hevc->mux_avc2flv_enhanced(sh, + SrsVideoAvcFrameTypeKeyFrame, + SrsVideoHEVCFrameTraitPacketTypeSequenceStart, + dts, + pts, + &flv, + &nb_flv)) != srs_success) { + return srs_error_wrap(err, "hevc sh to flv"); } SrsMessageHeader header; @@ -713,8 +720,6 @@ srs_error_t SrsSrtFrameBuilder::on_hevc_frame(SrsTsMessage *msg, vectordts_ / 90); - uint32_t pts = (uint32_t)(msg->pts_ / 90); - int32_t cts = pts - dts; // for IDR frame, the frame is keyframe. SrsVideoAvcFrameType frame_type = SrsVideoAvcFrameTypeInterFrame; @@ -736,16 +741,9 @@ srs_error_t SrsSrtFrameBuilder::on_hevc_frame(SrsTsMessage *msg, vector