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) {