Explorar o código

Updated ffprobe to not use WaitForExit, to avoid thread-blocking.

LukePulverenti Luke Pulverenti luke pulverenti %!s(int64=13) %!d(string=hai) anos
pai
achega
d09e82dfc3
Modificáronse 1 ficheiros con 9 adicións e 4 borrados
  1. 9 4
      MediaBrowser.Controller/FFMpeg/FFProbe.cs

+ 9 - 4
MediaBrowser.Controller/FFMpeg/FFProbe.cs

@@ -112,6 +112,10 @@ namespace MediaBrowser.Controller.FFMpeg
             Process process = new Process();
             process.StartInfo = startInfo;
 
+            process.EnableRaisingEvents = true;
+
+            process.Exited += process_Exited;
+
             try
             {
                 process.Start();
@@ -137,10 +141,11 @@ namespace MediaBrowser.Controller.FFMpeg
 
                 return null;
             }
-            finally
-            {
-                process.Dispose();
-            }
+        }
+
+        static void process_Exited(object sender, EventArgs e)
+        {
+            (sender as Process).Dispose();
         }
 
         private static string GetFFProbeCachePath(Audio item)