When closing my application normally, the videostream is stopped and dealt with accordingly.
However, when an unexpected exception occurs and the application crashes, ffmpeg.exe will still be running.
This is causing a lot of issues for me, mainly because the TCP ports used by my application will remain open until ffmpeg.exe is shut down manually through the Task Manager.
Solution
The problem can be solved by either:
Setting UseShellExecute = true in the ProcessStartInfo in the StartFrameReaderAsync method
Adding an extra (optional) parameter: StartFrameReaderAsync(InputSource inputSource, OutputImageFormat outputImageFormat, CancellationToken cancellationToken, bool useShellExecute = false)
Context
Running on Windows 10 and .NET framework 4.8
This is how I start the video stream:
And this is how it is stopped and disposed:
Problem
When closing my application normally, the videostream is stopped and dealt with accordingly. However, when an unexpected exception occurs and the application crashes, ffmpeg.exe will still be running. This is causing a lot of issues for me, mainly because the TCP ports used by my application will remain open until ffmpeg.exe is shut down manually through the Task Manager.
Solution
The problem can be solved by either: