From a6bde0943e7feda25eba15e23a2307227de87d4e Mon Sep 17 00:00:00 2001 From: PloughPuff Date: Thu, 14 Feb 2019 22:01:09 +0000 Subject: [PATCH 1/5] Implement proper FFmpeg version checking Three routes to determine FFmpeg version: 1) Grab the 'ffmpeg version x.y' from from the -version output. This should work for all pre-built binaries. 2) Compare the library versions against known contents of FFmpeg versions. This is fallback aimed at custom builds. 3) Compare libavcodec version to determine if newer than latest known release. This suggests user is running within latest/HEAD/master build. --- .../Encoder/EncoderValidator.cs | 188 +++++++++++++++++- 1 file changed, 181 insertions(+), 7 deletions(-) diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index 262772959a..275062df5f 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Globalization; +using System.Collections.ObjectModel; using System.Linq; using System.Text.RegularExpressions; using MediaBrowser.Model.Diagnostics; @@ -8,6 +8,71 @@ using Microsoft.Extensions.Logging; namespace MediaBrowser.MediaEncoding.Encoder { + public class FFmpegVersion + { + private int _version; + private int _multi => 100; + private const int _unknown = 0; + private const int _experimental = -1; + + public FFmpegVersion(int p1) + { + _version = p1; + } + + public FFmpegVersion(string p1) + { + var match = Regex.Match(p1, @"(?\d+)\.(?\d+)"); + + if (match.Groups["major"].Success && match.Groups["minor"].Success) + { + int major = int.Parse(match.Groups["major"].Value); + int minor = int.Parse(match.Groups["minor"].Value); + _version = (major * _multi) + minor; + } + } + + public override string ToString() + { + switch (_version) + { + case _unknown: + return "Unknown"; + case _experimental: + return "Experimental"; + default: + string major = Convert.ToString(_version / _multi); + string minor = Convert.ToString(_version % _multi); + return string.Concat(major, ".", minor); + } + } + + public bool Unknown() + { + return _version == _unknown; + } + + public int Version() + { + return _version; + } + + public bool Experimental() + { + return _version == _experimental; + } + + public bool Below(FFmpegVersion checkAgainst) + { + return (_version > 0) && (_version < checkAgainst._version); + } + + public bool Suitable(FFmpegVersion checkAgainst) + { + return (_version > 0) && (_version >= checkAgainst._version); + } + } + public class EncoderValidator { private readonly ILogger _logger; @@ -58,18 +123,127 @@ namespace MediaBrowser.MediaEncoding.Encoder return false; } - output = " " + output + " "; + // The minimum FFmpeg version required to run jellyfin successfully + FFmpegVersion required = new FFmpegVersion("4.0"); - for (var i = 2013; i <= 2015; i++) + // Work out what the version under test is + FFmpegVersion underTest = GetFFmpegVersion(output); + + if (logOutput) { - var yearString = i.ToString(CultureInfo.InvariantCulture); - if (output.IndexOf(" " + yearString + " ", StringComparison.OrdinalIgnoreCase) != -1) + if (underTest.Unknown()) { - return false; + _logger.LogWarning("FFmpeg validation: Unknown version"); + } + else if (underTest.Below(required)) + { + _logger.LogWarning("FFmpeg validation: Found version {0} which is below the minimum recommended of {1}", + underTest.ToString(), required.ToString()); + } + else if (underTest.Experimental()) + { + _logger.LogWarning("FFmpeg validation: Unknown version: {0}?", underTest.ToString()); + } + else + { + _logger.LogInformation("FFmpeg validation: Detected version {0}", underTest.ToString()); } } - return true; + return underTest.Suitable(required); + } + + /// + /// Using the output from "ffmpeg -version" work out the FFmpeg version. + /// For pre-built binaries the first line should contain a string like "ffmpeg version x.y", which is easy + /// to parse. If this is not available, then we try to match known library versions to FFmpeg versions. + /// If that fails then we use one of the main libraries to determine if it's new/older than the latest + /// we have stored. + /// + /// + /// + static private FFmpegVersion GetFFmpegVersion(string output) + { + // For pre-built binaries the FFmpeg version should be mentioned at the very start of the output + var match = Regex.Match(output, @"ffmpeg version (\d+\.\d+)"); + + if (match.Success) + { + return new FFmpegVersion(match.Groups[1].Value); + } + else + { + // Try and use the individual library versions to determine a FFmpeg version + // This lookup table is to be maintained with the following command line: + // $ ./ffmpeg.exe -version | perl -ne ' print "$1=$2.$3," if /^(lib\w+)\s+(\d+)\.\s*(\d+)/' + ReadOnlyDictionary lut = new ReadOnlyDictionary + (new Dictionary + { + { new FFmpegVersion("4.1"), "libavutil=56.22,libavcodec=58.35,libavformat=58.20,libavdevice=58.5,libavfilter=7.40,libswscale=5.3,libswresample=3.3,libpostproc=55.3," }, + { new FFmpegVersion("4.0"), "libavutil=56.14,libavcodec=58.18,libavformat=58.12,libavdevice=58.3,libavfilter=7.16,libswscale=5.1,libswresample=3.1,libpostproc=55.1," }, + { new FFmpegVersion("3.4"), "libavutil=55.78,libavcodec=57.107,libavformat=57.83,libavdevice=57.10,libavfilter=6.107,libswscale=4.8,libswresample=2.9,libpostproc=54.7," }, + { new FFmpegVersion("3.3"), "libavutil=55.58,libavcodec=57.89,libavformat=57.71,libavdevice=57.6,libavfilter=6.82,libswscale=4.6,libswresample=2.7,libpostproc=54.5," }, + { new FFmpegVersion("3.2"), "libavutil=55.34,libavcodec=57.64,libavformat=57.56,libavdevice=57.1,libavfilter=6.65,libswscale=4.2,libswresample=2.3,libpostproc=54.1," }, + { new FFmpegVersion("2.8"), "libavutil=54.31,libavcodec=56.60,libavformat=56.40,libavdevice=56.4,libavfilter=5.40,libswscale=3.1,libswresample=1.2,libpostproc=53.3," } + }); + + // Create a reduced version string and lookup key from dictionary + var reducedVersion = GetVersionString(output); + var found = lut.FirstOrDefault(x => x.Value == reducedVersion).Key; + + if (found != null) + { + return found; + } + else + { + // Unknown version. Test the main libavcoder version in the candidate with the + // latest from the dictionary. If candidate is greater than dictionary chances are + // the user if running HEAD/master ffmpeg build (which is probably ok) + var firstElement = lut.FirstOrDefault(); + + var reqVer = Regex.Match(firstElement.Value, @"libavcodec=(\d+\.\d+)"); + var gotVer = Regex.Match(reducedVersion, @"libavcodec=(\d+\.\d+)"); + + if (reqVer.Success && gotVer.Success) + { + var req = new FFmpegVersion(reqVer.Groups[1].Value); + var got = new FFmpegVersion(gotVer.Groups[1].Value); + + // The library versions are not comparable with the FFmpeg version so must check + // candidate (got) against value from dictionary (req). Return Experimental if suitable + if( got.Suitable(req) ) + { + return new FFmpegVersion(-1); + + } + } + } + } + + // Default to return Unknown + return new FFmpegVersion(0); + } + + /// + /// Grabs the library names and major.minor version numbers from the 'ffmpeg -version' output + /// and condenses them on to one line. Output format is "name1=major.minor,name2=major.minor,etc." + /// + /// + /// + static private string GetVersionString(string output) + { + string pattern = @"((?lib\w+)\s+(?\d+)\.\s*(?\d+))"; + RegexOptions options = RegexOptions.Multiline; + + string rc = null; + + foreach (Match m in Regex.Matches(output, pattern, options)) + { + rc += string.Concat(m.Groups["name"], '=', m.Groups["major"], '.', m.Groups["minor"], ','); + } + + return rc; } private static readonly string[] requiredDecoders = new[] From d8d237f6f295990c54bb2b0e36e0be04bacbdc3b Mon Sep 17 00:00:00 2001 From: PloughPuff Date: Fri, 15 Feb 2019 23:51:22 +0000 Subject: [PATCH 2/5] Review comments Addressed review comments from JustAMan. Removed code to determine experimental version. Store major and minor as two ints. Allow control of a min and max recommended version. --- .../Encoder/EncoderValidator.cs | 120 +++++++----------- 1 file changed, 47 insertions(+), 73 deletions(-) diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index 275062df5f..ad777a9aa9 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -10,15 +10,10 @@ namespace MediaBrowser.MediaEncoding.Encoder { public class FFmpegVersion { - private int _version; - private int _multi => 100; - private const int _unknown = 0; - private const int _experimental = -1; + private readonly int _major; + private readonly int _minor; - public FFmpegVersion(int p1) - { - _version = p1; - } + private const int _unknown = 0; public FFmpegVersion(string p1) { @@ -26,50 +21,50 @@ namespace MediaBrowser.MediaEncoding.Encoder if (match.Groups["major"].Success && match.Groups["minor"].Success) { - int major = int.Parse(match.Groups["major"].Value); - int minor = int.Parse(match.Groups["minor"].Value); - _version = (major * _multi) + minor; + _major = int.Parse(match.Groups["major"].Value); + _minor = int.Parse(match.Groups["minor"].Value); + } + else + { + _major = _unknown; + _minor = _unknown; } } public override string ToString() { - switch (_version) + switch (_major) { case _unknown: return "Unknown"; - case _experimental: - return "Experimental"; default: - string major = Convert.ToString(_version / _multi); - string minor = Convert.ToString(_version % _multi); - return string.Concat(major, ".", minor); + return string.Format("{0}.{1}",_major,_minor); } } public bool Unknown() { - return _version == _unknown; - } - - public int Version() - { - return _version; - } - - public bool Experimental() - { - return _version == _experimental; + return _major == _unknown; } public bool Below(FFmpegVersion checkAgainst) { - return (_version > 0) && (_version < checkAgainst._version); + return ToScalar() < checkAgainst.ToScalar(); } - public bool Suitable(FFmpegVersion checkAgainst) + public bool Above(FFmpegVersion checkAgainst) { - return (_version > 0) && (_version >= checkAgainst._version); + return ToScalar() > checkAgainst.ToScalar(); + } + + public bool Same(FFmpegVersion checkAgainst) + { + return ToScalar() == checkAgainst.ToScalar(); + } + + private int ToScalar() + { + return (_major * 1000) + _minor; } } @@ -123,34 +118,43 @@ namespace MediaBrowser.MediaEncoding.Encoder return false; } - // The minimum FFmpeg version required to run jellyfin successfully - FFmpegVersion required = new FFmpegVersion("4.0"); + // The min and max FFmpeg versions required to run jellyfin successfully + FFmpegVersion minRequired = new FFmpegVersion("4.0"); + FFmpegVersion maxRequired = new FFmpegVersion("4.0"); // Work out what the version under test is FFmpegVersion underTest = GetFFmpegVersion(output); if (logOutput) { + _logger.LogInformation("FFmpeg validation: Found ffmpeg version {0}", underTest.ToString()); + if (underTest.Unknown()) { - _logger.LogWarning("FFmpeg validation: Unknown version"); + if (minRequired.Same(maxRequired)) + { + _logger.LogWarning("FFmpeg validation: We recommend ffmpeg version {0}", minRequired.ToString()); + } + else + { + _logger.LogWarning("FFmpeg validation: We recommend a minimum of {0} and maximum of {1}", minRequired.ToString(), maxRequired.ToString()); + } } - else if (underTest.Below(required)) + else if (underTest.Below(minRequired)) { - _logger.LogWarning("FFmpeg validation: Found version {0} which is below the minimum recommended of {1}", - underTest.ToString(), required.ToString()); + _logger.LogWarning("FFmpeg validation: The minimum recommended ffmpeg version is {0}", minRequired.ToString()); } - else if (underTest.Experimental()) + else if (underTest.Above(maxRequired)) { - _logger.LogWarning("FFmpeg validation: Unknown version: {0}?", underTest.ToString()); + _logger.LogWarning("FFmpeg validation: The maximum recommended ffmpeg version is {0}", maxRequired.ToString()); } else { - _logger.LogInformation("FFmpeg validation: Detected version {0}", underTest.ToString()); + // Version is ok so no warning required } } - return underTest.Suitable(required); + return !underTest.Below(minRequired) && !underTest.Above(maxRequired); } /// @@ -176,7 +180,7 @@ namespace MediaBrowser.MediaEncoding.Encoder // Try and use the individual library versions to determine a FFmpeg version // This lookup table is to be maintained with the following command line: // $ ./ffmpeg.exe -version | perl -ne ' print "$1=$2.$3," if /^(lib\w+)\s+(\d+)\.\s*(\d+)/' - ReadOnlyDictionary lut = new ReadOnlyDictionary + var lut = new ReadOnlyDictionary (new Dictionary { { new FFmpegVersion("4.1"), "libavutil=56.22,libavcodec=58.35,libavformat=58.20,libavdevice=58.5,libavfilter=7.40,libswscale=5.3,libswresample=3.3,libpostproc=55.3," }, @@ -191,38 +195,8 @@ namespace MediaBrowser.MediaEncoding.Encoder var reducedVersion = GetVersionString(output); var found = lut.FirstOrDefault(x => x.Value == reducedVersion).Key; - if (found != null) - { - return found; - } - else - { - // Unknown version. Test the main libavcoder version in the candidate with the - // latest from the dictionary. If candidate is greater than dictionary chances are - // the user if running HEAD/master ffmpeg build (which is probably ok) - var firstElement = lut.FirstOrDefault(); - - var reqVer = Regex.Match(firstElement.Value, @"libavcodec=(\d+\.\d+)"); - var gotVer = Regex.Match(reducedVersion, @"libavcodec=(\d+\.\d+)"); - - if (reqVer.Success && gotVer.Success) - { - var req = new FFmpegVersion(reqVer.Groups[1].Value); - var got = new FFmpegVersion(gotVer.Groups[1].Value); - - // The library versions are not comparable with the FFmpeg version so must check - // candidate (got) against value from dictionary (req). Return Experimental if suitable - if( got.Suitable(req) ) - { - return new FFmpegVersion(-1); - - } - } - } + return found ?? new FFmpegVersion("Unknown"); } - - // Default to return Unknown - return new FFmpegVersion(0); } /// From 69ea15f73a053e2526457b0eec757fb6f1ca1cd7 Mon Sep 17 00:00:00 2001 From: PloughPuff Date: Sat, 16 Feb 2019 00:47:38 +0000 Subject: [PATCH 3/5] Use string interpolation Two further review comments from JustAMan. --- MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index ad777a9aa9..be33ea58ef 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -38,7 +38,7 @@ namespace MediaBrowser.MediaEncoding.Encoder case _unknown: return "Unknown"; default: - return string.Format("{0}.{1}",_major,_minor); + return $"{_major}.{_minor}"; } } @@ -150,7 +150,7 @@ namespace MediaBrowser.MediaEncoding.Encoder } else { - // Version is ok so no warning required + _logger.LogInformation("FFmpeg validation: Found suitable ffmpeg version"); } } From 7668ecf9c95fe7deb8211704c24266d5b17f6c8c Mon Sep 17 00:00:00 2001 From: PloughPuff Date: Wed, 27 Feb 2019 18:20:48 +0000 Subject: [PATCH 4/5] Use Version Class to ease comparisons --- .../Encoder/EncoderValidator.cs | 105 ++++-------------- 1 file changed, 23 insertions(+), 82 deletions(-) diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index be33ea58ef..5ebd189ace 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -8,66 +8,6 @@ using Microsoft.Extensions.Logging; namespace MediaBrowser.MediaEncoding.Encoder { - public class FFmpegVersion - { - private readonly int _major; - private readonly int _minor; - - private const int _unknown = 0; - - public FFmpegVersion(string p1) - { - var match = Regex.Match(p1, @"(?\d+)\.(?\d+)"); - - if (match.Groups["major"].Success && match.Groups["minor"].Success) - { - _major = int.Parse(match.Groups["major"].Value); - _minor = int.Parse(match.Groups["minor"].Value); - } - else - { - _major = _unknown; - _minor = _unknown; - } - } - - public override string ToString() - { - switch (_major) - { - case _unknown: - return "Unknown"; - default: - return $"{_major}.{_minor}"; - } - } - - public bool Unknown() - { - return _major == _unknown; - } - - public bool Below(FFmpegVersion checkAgainst) - { - return ToScalar() < checkAgainst.ToScalar(); - } - - public bool Above(FFmpegVersion checkAgainst) - { - return ToScalar() > checkAgainst.ToScalar(); - } - - public bool Same(FFmpegVersion checkAgainst) - { - return ToScalar() == checkAgainst.ToScalar(); - } - - private int ToScalar() - { - return (_major * 1000) + _minor; - } - } - public class EncoderValidator { private readonly ILogger _logger; @@ -119,19 +59,19 @@ namespace MediaBrowser.MediaEncoding.Encoder } // The min and max FFmpeg versions required to run jellyfin successfully - FFmpegVersion minRequired = new FFmpegVersion("4.0"); - FFmpegVersion maxRequired = new FFmpegVersion("4.0"); + var minRequired = new Version(4, 0); + var maxRequired = new Version(4, 0); // Work out what the version under test is - FFmpegVersion underTest = GetFFmpegVersion(output); + var underTest = GetFFmpegVersion(output); if (logOutput) { - _logger.LogInformation("FFmpeg validation: Found ffmpeg version {0}", underTest.ToString()); + _logger.LogInformation("FFmpeg validation: Found ffmpeg version {0}", underTest != null ? underTest.ToString() : "unknown"); - if (underTest.Unknown()) + if (underTest == null) // Version is unknown { - if (minRequired.Same(maxRequired)) + if (minRequired.Equals(maxRequired)) { _logger.LogWarning("FFmpeg validation: We recommend ffmpeg version {0}", minRequired.ToString()); } @@ -140,21 +80,22 @@ namespace MediaBrowser.MediaEncoding.Encoder _logger.LogWarning("FFmpeg validation: We recommend a minimum of {0} and maximum of {1}", minRequired.ToString(), maxRequired.ToString()); } } - else if (underTest.Below(minRequired)) + else if (underTest.CompareTo(minRequired) < 0) // Version is below what we recommend { _logger.LogWarning("FFmpeg validation: The minimum recommended ffmpeg version is {0}", minRequired.ToString()); } - else if (underTest.Above(maxRequired)) + else if (underTest.CompareTo(maxRequired) > 0) // Version is above what we recommend { _logger.LogWarning("FFmpeg validation: The maximum recommended ffmpeg version is {0}", maxRequired.ToString()); } - else + else // Version is ok { _logger.LogInformation("FFmpeg validation: Found suitable ffmpeg version"); } } - return !underTest.Below(minRequired) && !underTest.Above(maxRequired); + // underTest shall be null if versions is unknown + return (underTest == null) ? false : !(underTest.CompareTo(minRequired) < 0) && !(underTest.CompareTo(maxRequired) > 0); } /// @@ -166,36 +107,36 @@ namespace MediaBrowser.MediaEncoding.Encoder /// /// /// - static private FFmpegVersion GetFFmpegVersion(string output) + static private Version GetFFmpegVersion(string output) { // For pre-built binaries the FFmpeg version should be mentioned at the very start of the output var match = Regex.Match(output, @"ffmpeg version (\d+\.\d+)"); if (match.Success) { - return new FFmpegVersion(match.Groups[1].Value); + return new Version(match.Groups[1].Value); } else { // Try and use the individual library versions to determine a FFmpeg version // This lookup table is to be maintained with the following command line: // $ ./ffmpeg.exe -version | perl -ne ' print "$1=$2.$3," if /^(lib\w+)\s+(\d+)\.\s*(\d+)/' - var lut = new ReadOnlyDictionary - (new Dictionary + var lut = new ReadOnlyDictionary + (new Dictionary { - { new FFmpegVersion("4.1"), "libavutil=56.22,libavcodec=58.35,libavformat=58.20,libavdevice=58.5,libavfilter=7.40,libswscale=5.3,libswresample=3.3,libpostproc=55.3," }, - { new FFmpegVersion("4.0"), "libavutil=56.14,libavcodec=58.18,libavformat=58.12,libavdevice=58.3,libavfilter=7.16,libswscale=5.1,libswresample=3.1,libpostproc=55.1," }, - { new FFmpegVersion("3.4"), "libavutil=55.78,libavcodec=57.107,libavformat=57.83,libavdevice=57.10,libavfilter=6.107,libswscale=4.8,libswresample=2.9,libpostproc=54.7," }, - { new FFmpegVersion("3.3"), "libavutil=55.58,libavcodec=57.89,libavformat=57.71,libavdevice=57.6,libavfilter=6.82,libswscale=4.6,libswresample=2.7,libpostproc=54.5," }, - { new FFmpegVersion("3.2"), "libavutil=55.34,libavcodec=57.64,libavformat=57.56,libavdevice=57.1,libavfilter=6.65,libswscale=4.2,libswresample=2.3,libpostproc=54.1," }, - { new FFmpegVersion("2.8"), "libavutil=54.31,libavcodec=56.60,libavformat=56.40,libavdevice=56.4,libavfilter=5.40,libswscale=3.1,libswresample=1.2,libpostproc=53.3," } + { new Version("4.1"), "libavutil=56.22,libavcodec=58.35,libavformat=58.20,libavdevice=58.5,libavfilter=7.40,libswscale=5.3,libswresample=3.3,libpostproc=55.3," }, + { new Version("4.0"), "libavutil=56.14,libavcodec=58.18,libavformat=58.12,libavdevice=58.3,libavfilter=7.16,libswscale=5.1,libswresample=3.1,libpostproc=55.1," }, + { new Version("3.4"), "libavutil=55.78,libavcodec=57.107,libavformat=57.83,libavdevice=57.10,libavfilter=6.107,libswscale=4.8,libswresample=2.9,libpostproc=54.7," }, + { new Version("3.3"), "libavutil=55.58,libavcodec=57.89,libavformat=57.71,libavdevice=57.6,libavfilter=6.82,libswscale=4.6,libswresample=2.7,libpostproc=54.5," }, + { new Version("3.2"), "libavutil=55.34,libavcodec=57.64,libavformat=57.56,libavdevice=57.1,libavfilter=6.65,libswscale=4.2,libswresample=2.3,libpostproc=54.1," }, + { new Version("2.8"), "libavutil=54.31,libavcodec=56.60,libavformat=56.40,libavdevice=56.4,libavfilter=5.40,libswscale=3.1,libswresample=1.2,libpostproc=53.3," } }); // Create a reduced version string and lookup key from dictionary var reducedVersion = GetVersionString(output); - var found = lut.FirstOrDefault(x => x.Value == reducedVersion).Key; - return found ?? new FFmpegVersion("Unknown"); + // Try to lookup the string and return Key, otherwise if not found returns null + return lut.FirstOrDefault(x => x.Value == reducedVersion).Key; } } From f1086a72bf1ebf486464c877efb66bb4f87771fe Mon Sep 17 00:00:00 2001 From: Vasily Date: Thu, 28 Feb 2019 15:58:41 +0000 Subject: [PATCH 5/5] Improve logic when determining return value Co-Authored-By: ploughpuff <33969763+ploughpuff@users.noreply.github.com> --- MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index 5ebd189ace..f725d2c019 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -95,7 +95,7 @@ namespace MediaBrowser.MediaEncoding.Encoder } // underTest shall be null if versions is unknown - return (underTest == null) ? false : !(underTest.CompareTo(minRequired) < 0) && !(underTest.CompareTo(maxRequired) > 0); + return (underTest == null) ? false : (underTest.CompareTo(minRequired) >= 0 && underTest.CompareTo(maxRequired) <= 0); } ///