Merge pull request #23 from nyanmisaka/fix-deadlock
Fix the deadlock of ffmpeg process on Windows
This commit is contained in:
commit
d5f57f3ca7
@ -114,9 +114,14 @@ public static class Chromaprint
|
|||||||
|
|
||||||
var info = new ProcessStartInfo(ffmpegPath, args)
|
var info = new ProcessStartInfo(ffmpegPath, args)
|
||||||
{
|
{
|
||||||
|
WindowStyle = ProcessWindowStyle.Hidden,
|
||||||
CreateNoWindow = true,
|
CreateNoWindow = true,
|
||||||
|
UseShellExecute = false,
|
||||||
|
ErrorDialog = false,
|
||||||
|
|
||||||
|
// We only consume standardOutput.
|
||||||
RedirectStandardOutput = true,
|
RedirectStandardOutput = true,
|
||||||
RedirectStandardError = true
|
RedirectStandardError = false
|
||||||
};
|
};
|
||||||
|
|
||||||
var ffmpeg = new Process
|
var ffmpeg = new Process
|
||||||
@ -125,7 +130,6 @@ public static class Chromaprint
|
|||||||
};
|
};
|
||||||
|
|
||||||
ffmpeg.Start();
|
ffmpeg.Start();
|
||||||
ffmpeg.WaitForExit(timeout);
|
|
||||||
|
|
||||||
using (MemoryStream ms = new MemoryStream())
|
using (MemoryStream ms = new MemoryStream())
|
||||||
{
|
{
|
||||||
@ -139,6 +143,8 @@ public static class Chromaprint
|
|||||||
}
|
}
|
||||||
while (bytesRead > 0);
|
while (bytesRead > 0);
|
||||||
|
|
||||||
|
ffmpeg.WaitForExit(timeout);
|
||||||
|
|
||||||
return ms.ToArray().AsSpan();
|
return ms.ToArray().AsSpan();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user