public RecEngine() { this._cmdHelper = new CLIHelper(); this._frameDropChecker = new FrameDropChecker(); this._cmdHelper.CommandDataReceived += cmdHelper_CommandDataReceived; this._frameDropChecker.FrameDroped += _frameDropChecker_FrameDroped; }
protected virtual void Dispose(bool disposing) { if (disposed) { return; } //memory free is here if (disposing) { System.Diagnostics.Process[] procs = System.Diagnostics.Process.GetProcessesByName(FFMPEG_PROCESS_NAME); foreach (var item in procs) { item.StandardInput.Write(STOP_COMMAND); item.WaitForExit(); } if (_cmdHelper != null) { _cmdHelper.CommandDataReceived -= cmdHelper_CommandDataReceived; _cmdHelper.Dispose(); _cmdHelper = null; } if (_frameDropChecker != null) { _frameDropChecker.FrameDroped -= _frameDropChecker_FrameDroped; _frameDropChecker.Dispose(); _frameDropChecker = null; } } disposed = true; }