Fix OverflowException when scanning media with a very short duration (#13949)

This commit is contained in:
Bond-009
2025-04-19 21:08:29 +02:00
committed by GitHub
parent 7df6e0b16f
commit 74230131a1
3 changed files with 244 additions and 1 deletions

View File

@@ -965,7 +965,7 @@ namespace MediaBrowser.MediaEncoding.Probing
// Get average bitrate info from tag "NUMBER_OF_BYTES" and "DURATION" if possible.
var durationInSeconds = GetRuntimeSecondsFromTags(streamInfo);
var bytes = GetNumberOfBytesFromTags(streamInfo);
if (durationInSeconds is not null && bytes is not null)
if (durationInSeconds is not null && durationInSeconds.Value >= 1 && bytes is not null)
{
bps = Convert.ToInt32(bytes * 8 / durationInSeconds, CultureInfo.InvariantCulture);
if (bps > 0)