From 6f78ac2ff36b067ee3448fc5bf3030814b10e79b Mon Sep 17 00:00:00 2001 From: gnattu Date: Tue, 30 Apr 2024 19:41:46 +0800 Subject: Use more accurate rounding in GetFixedOutputSize (#11435) * Use more accurate rounding in GetFixedOutputSize Signed-off-by: gnattu * Force trickplay thumbnails to have even width Signed-off-by: gnattu * Use Convert.ToInt32 Signed-off-by: gnattu * Force video size as thumbnail size if the trickplay width setting is larger This will fix an issue when the trickplay setting contains a very huge width, but the video has a lower resolution than that setting. Our scaling filter logic will not do any upscale, and we have to force to use the video width Signed-off-by: gnattu --------- Signed-off-by: gnattu --- MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs') diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 9c087f011..d6907fdf9 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -2984,8 +2984,8 @@ namespace MediaBrowser.Controller.MediaEncoding var scaleW = (double)maximumWidth / outputWidth; var scaleH = (double)maximumHeight / outputHeight; var scale = Math.Min(scaleW, scaleH); - outputWidth = Math.Min(maximumWidth, (int)(outputWidth * scale)); - outputHeight = Math.Min(maximumHeight, (int)(outputHeight * scale)); + outputWidth = Math.Min(maximumWidth, Convert.ToInt32(outputWidth * scale)); + outputHeight = Math.Min(maximumHeight, Convert.ToInt32(outputHeight * scale)); } outputWidth = 2 * (outputWidth / 2); -- cgit v1.2.3