playback: decrease concatenation tolerance to 0.5 secs (#3199)

This commit is contained in:
Alessandro Ros 2024-04-07 13:51:23 +02:00 committed by GitHub
parent c263fc6f7b
commit b64e082253
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)
}