From d09e82dfc36577aa63a680ae1a4aaa2c323efd7e Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Thu, 23 Aug 2012 18:20:50 -0400 Subject: [PATCH] Updated ffprobe to not use WaitForExit, to avoid thread-blocking. --- MediaBrowser.Controller/FFMpeg/FFProbe.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/MediaBrowser.Controller/FFMpeg/FFProbe.cs b/MediaBrowser.Controller/FFMpeg/FFProbe.cs index fac1d4667..831ae50a3 100644 --- a/MediaBrowser.Controller/FFMpeg/FFProbe.cs +++ b/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)