AydinAdn/MediaToolkit

Engine.Dispose() does not end or kill FFMpeg process

Closed this issue · 2 comments

The Engine.Dispose() should end or kill the FFMpeg process.

Currently if I close the application by stopping the debugger in the VS the FFMpeg process keeps running. Opening the application and starting a new task will create another FFMPeg process.

Okay maybe it did not had a chance to dispose the Engine but running the program again should kill the previous priocess:

    private void EnsureFFmpegIsNotUsed()
    {
      if (!Document.IsLocked(this.FFmpegFilePath))
        return;
      try
      {
        this.Mutex.WaitOne();
        EngineBase.KillFFmpegProcesses();
      }
      finally
      {
        this.Mutex.ReleaseMutex();
      }
    }

What if the "Document" is not locked? Then it just create a new instance of the FFMpeg.

Fixed with dac7f88, cheers!

Nice!