Simplify condition check

Signed-off-by: gnattu <gnattuoc@me.com>
This commit is contained in:
gnattu 2024-07-17 21:25:29 +08:00
parent 0340eccb52
commit b28d22545a

View File

@ -814,10 +814,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
var options = allowHwAccel ? _configurationManager.GetEncodingOptions() : new EncodingOptions();
threads ??= _threads;
if (enableKeyFrameOnlyExtraction)
if (allowHwAccel && enableKeyFrameOnlyExtraction)
{
var supportsKeyFrameOnly = !allowHwAccel
|| (string.Equals(options.HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase) && options.EnableEnhancedNvdecDecoder)
var supportsKeyFrameOnly = (string.Equals(options.HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase) && options.EnableEnhancedNvdecDecoder)
|| (string.Equals(options.HardwareAccelerationType, "amf", StringComparison.OrdinalIgnoreCase) && OperatingSystem.IsWindows() && options.PreferSystemNativeHwDecoder)
|| (string.Equals(options.HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase) && options.PreferSystemNativeHwDecoder)
|| string.Equals(options.HardwareAccelerationType, "vaapi", StringComparison.OrdinalIgnoreCase)