Fix seeking beyond EOF again (#13871)

This commit is contained in:
Nyanmisaka 2025-04-08 20:58:55 +00:00 committed by GitHub
parent 1e10cd003d
commit 98697e75ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2872,10 +2872,10 @@ namespace MediaBrowser.Controller.MediaEncoding
var seekTick = isHlsRemuxing ? time + 5000000L : time;
// Seeking beyond EOF makes no sense in transcoding. Clamp the seekTick value to
// [0, RuntimeTicks - 0.5s], so that the muxer gets packets and avoid error codes.
// [0, RuntimeTicks - 5.0s], so that the muxer gets packets and avoid error codes.
if (maxTime > 0)
{
seekTick = Math.Clamp(seekTick, 0, Math.Max(maxTime - 5000000L, 0));
seekTick = Math.Clamp(seekTick, 0, Math.Max(maxTime - 50000000L, 0));
}
seekParam += string.Format(CultureInfo.InvariantCulture, "-ss {0}", _mediaEncoder.GetTimeParameter(seekTick));