From 908c2f2a30893f78af9d1869bd7f25ed73248132 Mon Sep 17 00:00:00 2001 From: Jacob Su Date: Fri, 14 Jun 2024 18:56:07 +0800 Subject: [PATCH] Fix hevc test failures (#4087) Try to fix two blackbox test: 1. TestSlow_SrtPublish_HttpTsPlay_HEVC_Basic: fixed by enlarge the wait time from 3 seconds to 4 before run ffprobe task, which will record the stream by ffmpeg first. 2 TestSlow_SrtPublish_HlsPlay_HEVC_Basic: fixed by wait 16 seconds before run ffprobe task. About the 2 case: it seems ridiculous to add 16 seconds delay before run ffprobe task. > So, I start #4088 to check the github action workflow process, I start this branch from a very earlier version `6.0.113 (srs/core/srs_core_version6.hpp)`, what I found it that, inside `SRS blackbox-test`, the srs version `6.0.128`, the latest version, was printed. That's really wired. I confirmed this is not the SRS source code's problem, check https://github.com/suzp1984/srs/actions/runs/9511600525/job/26218025559 the srs code 6.0.113 was checkout and running actions based on them, still met same problem. --------- Co-authored-by: winlin --- .../3rdparty/srs-bench/blackbox/hevc_test.go | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/trunk/3rdparty/srs-bench/blackbox/hevc_test.go b/trunk/3rdparty/srs-bench/blackbox/hevc_test.go index 4c6571fc77..3b62e8a8cb 100644 --- a/trunk/3rdparty/srs-bench/blackbox/hevc_test.go +++ b/trunk/3rdparty/srs-bench/blackbox/hevc_test.go @@ -900,6 +900,14 @@ func TestSlow_SrtPublish_HttpTsPlay_HEVC_Basic(t *testing.T) { r1 = ffmpeg.Run(ctx, cancel) }() + // Should wait for TS to generate the contents. + select { + case <-ctx.Done(): + r2 = fmt.Errorf("timeout") + return + case <-time.After(5 * time.Second): + } + // Start FFprobe to detect and verify stream. duration := time.Duration(*srsFFprobeDuration) * time.Millisecond ffprobe := NewFFprobe(func(v *ffprobeClient) { @@ -912,9 +920,6 @@ func TestSlow_SrtPublish_HttpTsPlay_HEVC_Basic(t *testing.T) { defer wg.Done() <-svr.ReadyCtx().Done() - // wait for ffmpeg - time.Sleep(3 * time.Second) - r2 = ffprobe.Run(ctx, cancel) }() @@ -949,7 +954,6 @@ func TestSlow_SrtPublish_HlsPlay_HEVC_Basic(t *testing.T) { // Setup the max timeout for this case. ctx, cancel := context.WithTimeout(logger.WithContext(context.Background()), time.Duration(*srsTimeout)*time.Millisecond) defer cancel() - // Check a set of errors. var r0, r1, r2, r3, r4 error defer func(ctx context.Context) { @@ -995,12 +999,17 @@ func TestSlow_SrtPublish_HlsPlay_HEVC_Basic(t *testing.T) { defer wg.Done() <-svr.ReadyCtx().Done() - // wait for ffmpeg - time.Sleep(3 * time.Second) - r1 = ffmpeg.Run(ctx, cancel) }() + // Should wait for HLS to generate the ts files. + select { + case <-ctx.Done(): + r2 = fmt.Errorf("timeout") + return + case <-time.After(20 * time.Second): + } + // Start FFprobe to detect and verify stream. duration := time.Duration(*srsFFprobeDuration) * time.Millisecond ffprobe := NewFFprobe(func(v *ffprobeClient) {