Преглед на файлове

exclude mpeg4 with level -99 from vaapi

Luke Pulverenti преди 8 години
родител
ревизия
ccaf2f43a6

+ 20 - 1
MediaBrowser.Api/Playback/BaseStreamingService.cs

@@ -317,13 +317,32 @@ namespace MediaBrowser.Api.Playback
                 }
                 if (string.Equals(hwType, "vaapi", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrWhiteSpace(encodingOptions.VaapiDevice))
                 {
-                    return GetAvailableEncoder("h264_vaapi", defaultEncoder);
+                    if (IsVaapiSupported(state))
+                    {
+                        return GetAvailableEncoder("h264_vaapi", defaultEncoder);
+                    }
                 }
             }
 
             return defaultEncoder;
         }
 
+        private bool IsVaapiSupported(StreamState state)
+        {
+            var videoStream = state.VideoStream;
+
+            if (videoStream != null)
+            {
+                // vaapi will throw an error with this input
+                // [vaapi @ 0x7faed8000960] No VAAPI support for codec mpeg4 profile -99.
+                if (string.Equals(videoStream.Codec, "mpeg4", StringComparison.OrdinalIgnoreCase) && videoStream.Level == -99)
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
+
         private string GetAvailableEncoder(string preferredEncoder, string defaultEncoder)
         {
             if (MediaEncoder.SupportsEncoder(preferredEncoder))

+ 20 - 1
MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs

@@ -588,13 +588,32 @@ namespace MediaBrowser.MediaEncoding.Encoder
                 }
                 if (string.Equals(hwType, "vaapi", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrWhiteSpace(options.VaapiDevice))
                 {
-                    return GetAvailableEncoder(mediaEncoder, "h264_vaapi", defaultEncoder);
+                    if (IsVaapiSupported(state))
+                    {
+                        return GetAvailableEncoder(mediaEncoder, "h264_vaapi", defaultEncoder);
+                    }
                 }
             }
 
             return defaultEncoder;
         }
 
+        private static bool IsVaapiSupported(EncodingJob state)
+        {
+            var videoStream = state.VideoStream;
+
+            if (videoStream != null)
+            {
+                // vaapi will throw an error with this input
+                // [vaapi @ 0x7faed8000960] No VAAPI support for codec mpeg4 profile -99.
+                if (string.Equals(videoStream.Codec, "mpeg4", StringComparison.OrdinalIgnoreCase) && videoStream.Level == -99)
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
+
         internal static bool CanStreamCopyVideo(EncodingJobOptions request, MediaStream videoStream)
         {
             if (videoStream.IsInterlaced)

+ 1 - 1
MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs

@@ -1947,7 +1947,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
                 }
                 else
                 {
-                    timers = timers.Where(i => !(i.Item1.Status == RecordingStatus.New));
+                    timers = timers.Where(i => i.Item1.Status != RecordingStatus.New);
                 }
             }