From b64e082253e3604a871051854ff9e32d23df0d97 Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Sun, 7 Apr 2024 13:51:23 +0200 Subject: [PATCH] playback: decrease concatenation tolerance to 0.5 secs (#3199) --- internal/playback/fmp4.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/playback/fmp4.go b/internal/playback/fmp4.go index dcfbd8470a1..95ecef9757a 100644 --- a/internal/playback/fmp4.go +++ b/internal/playback/fmp4.go @@ -14,7 +14,7 @@ import ( const ( sampleFlagIsNonSyncSample = 1 << 16 - concatenationTolerance = 1 * time.Second + concatenationTolerance = 500 * time.Millisecond fmp4Timescale = 90000 ) @@ -266,8 +266,6 @@ func fmp4ReadMaxDuration(r io.ReadSeeker) (time.Duration, error) { return 0, fmt.Errorf("invalid tfdt box: %w", err) } - elapsed := tfdt.BaseMediaDecodeTimeV1 - // parse trun _, err = io.ReadFull(r, buf) @@ -294,6 +292,8 @@ func fmp4ReadMaxDuration(r io.ReadSeeker) (time.Duration, error) { return 0, fmt.Errorf("invalid trun box: %w", err) } + elapsed := tfdt.BaseMediaDecodeTimeV1 + for _, entry := range trun.Entries { elapsed += uint64(entry.SampleDuration) }