Skip to content

Commit

Permalink
Merge pull request jellyfin#11788 from gnattu/override-too-small-tric…
Browse files Browse the repository at this point in the history
…kplay-image-interval

Override too small trickplay image interval
  • Loading branch information
Bond-009 committed May 24, 2024
2 parents 06a5ddd + fa2bff3 commit 60232ce
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ public async Task RefreshTrickplayDataAsync(Video video, bool replace, Cancellat
_logger.LogDebug("Trickplay refresh for {ItemId} (replace existing: {Replace})", video.Id, replace);

var options = _config.Configuration.TrickplayOptions;
if (options.Interval < 1000)
{
_logger.LogWarning("Trickplay image interval {Interval} is too small, reset to the minimum valid value of 1000", options.Interval);
options.Interval = 1000;
}

foreach (var width in options.WidthResolutions)
{
cancellationToken.ThrowIfCancellationRequested();
Expand Down Expand Up @@ -267,7 +273,7 @@ public TrickplayInfo CreateTiles(List<string> images, int width, TrickplayOption
}

// Update bitrate
var bitrate = (int)Math.Ceiling((decimal)new FileInfo(tilePath).Length * 8 / trickplayInfo.TileWidth / trickplayInfo.TileHeight / (trickplayInfo.Interval / 1000));
var bitrate = (int)Math.Ceiling(new FileInfo(tilePath).Length * 8m / trickplayInfo.TileWidth / trickplayInfo.TileHeight / (trickplayInfo.Interval / 1000m));
trickplayInfo.Bandwidth = Math.Max(trickplayInfo.Bandwidth, bitrate);
}

Expand Down

0 comments on commit 60232ce

Please sign in to comment.