Skip to content

Commit f64f0a1

Browse files
committed
fix srt hevc blackbox test error.
Root Cause: the ffmpeg 5, inside the docker image srs:ubuntu20-cache, do not support enhanced rtmp.
1 parent 9b1301a commit f64f0a1

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

trunk/3rdparty/srs-bench/blackbox/hevc_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,8 @@ func TestSlow_SrtPublish_RtmpPlay_HEVC_Basic(t *testing.T) {
709709
v.dvrFile = path.Join(svr.WorkDir(), "objs", fmt.Sprintf("srs-ffprobe-%v.ts", streamID))
710710
v.streamURL = fmt.Sprintf("rtmp://localhost:%v/live/%v", svr.RTMPPort(), streamID)
711711
v.duration, v.timeout = duration, time.Duration(*srsFFprobeTimeout)*time.Millisecond
712+
v.ffmpegCmdName = "ffmpeg7" // ffmpeg 5 don't support enhanced rtmp, so use ffmpeg 7 instead.
713+
v.ffprobeCmdName = "ffprobe7"
712714
})
713715
wg.Add(1)
714716
go func() {
@@ -807,6 +809,8 @@ func TestSlow_SrtPublish_HttpFlvPlay_HEVC_Basic(t *testing.T) {
807809
v.dvrFile = path.Join(svr.WorkDir(), "objs", fmt.Sprintf("srs-ffprobe-%v.ts", streamID))
808810
v.streamURL = fmt.Sprintf("http://localhost:%v/live/%v.flv", svr.HTTPPort(), streamID)
809811
v.duration, v.timeout = duration, time.Duration(*srsFFprobeTimeout)*time.Millisecond
812+
v.ffmpegCmdName = "ffmpeg7" // ffmpeg 5 don't support enhanced rtmp, so use ffmpeg 7 instead.
813+
v.ffprobeCmdName = "ffprobe7"
810814
})
811815
wg.Add(1)
812816
go func() {

trunk/3rdparty/srs-bench/blackbox/util.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,8 @@ type ffmpegClient struct {
666666
// The backend service process.
667667
process *backendService
668668

669+
// FFmpeg cmd name
670+
ffmpegCmdName string
669671
// FFmpeg cli args, without ffmpeg binary.
670672
args []string
671673
// Let the process quit, do not cancel the case.
@@ -678,6 +680,7 @@ func NewFFmpeg(opts ...func(v *ffmpegClient)) FFmpegClient {
678680
v := &ffmpegClient{
679681
process: newBackendService(),
680682
cancelCaseWhenQuit: true,
683+
ffmpegCmdName: *srsFFmpeg,
681684
}
682685

683686
// Do cleanup.
@@ -702,7 +705,7 @@ func (v *ffmpegClient) ReadyCtx() context.Context {
702705
func (v *ffmpegClient) Run(ctx context.Context, cancel context.CancelFunc) error {
703706
logger.Tf(ctx, "Starting FFmpeg by %v", strings.Join(v.args, " "))
704707

705-
v.process.name = *srsFFmpeg
708+
v.process.name = v.ffmpegCmdName
706709
v.process.args = v.args
707710
v.process.env = os.Environ()
708711
v.process.duration = v.ffmpegDuration
@@ -746,6 +749,10 @@ type ffprobeClient struct {
746749
// The timeout to wait for task to done.
747750
timeout time.Duration
748751

752+
// the FFprobe cmd name
753+
ffprobeCmdName string
754+
// the ffmpeg cmd name
755+
ffmpegCmdName string
749756
// Whether do DVR by FFmpeg, if using SRS DVR, please set to false.
750757
dvrByFFmpeg bool
751758
// The stream to DVR for probing. Ignore if not DVR by ffmpeg
@@ -764,8 +771,10 @@ type ffprobeClient struct {
764771

765772
func NewFFprobe(opts ...func(v *ffprobeClient)) FFprobeClient {
766773
v := &ffprobeClient{
767-
metadata: &ffprobeObject{},
768-
dvrByFFmpeg: true,
774+
metadata: &ffprobeObject{},
775+
dvrByFFmpeg: true,
776+
ffprobeCmdName: *srsFFprobe,
777+
ffmpegCmdName: *srsFFmpeg,
769778
}
770779
v.doneCtx, v.doneCancel = context.WithCancel(context.Background())
771780

@@ -842,7 +851,7 @@ func (v *ffprobeClient) doDVR(ctx context.Context) error {
842851
}
843852

844853
process := newBackendService()
845-
process.name = *srsFFmpeg
854+
process.name = v.ffmpegCmdName
846855
process.args = []string{
847856
"-t", fmt.Sprintf("%v", int64(v.duration/time.Second)),
848857
"-i", v.streamURL, "-c", "copy", "-y", v.dvrFile,
@@ -869,7 +878,7 @@ func (v *ffprobeClient) doDVR(ctx context.Context) error {
869878

870879
func (v *ffprobeClient) doProbe(ctx context.Context, cancel context.CancelFunc) error {
871880
process := newBackendService()
872-
process.name = *srsFFprobe
881+
process.name = v.ffprobeCmdName
873882
process.args = []string{
874883
"-show_error", "-show_private_data", "-v", "quiet", "-find_stream_info",
875884
"-analyzeduration", fmt.Sprintf("%v", int64(v.duration/time.Microsecond)),

trunk/src/app/srs_app_srt_source.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ srs_error_t SrsSrtFrameBuilder::check_vps_sps_pps_change(SrsTsMessage *msg)
692692
&nb_flv)) != srs_success) {
693693
return srs_error_wrap(err, "hevc sh to flv");
694694
}
695-
695+
696696
SrsMessageHeader header;
697697
header.initialize_video(nb_flv, dts, video_streamid_);
698698
SrsRtmpCommonMessage rtmp;

0 commit comments

Comments
 (0)