private void Close() { lock (lockObject) { if (streamSource != null) { streamSource.Dispose(); streamSource = null; } if (this.configurator != null) { this.configurator.Dispose(); this.configurator = null; } if (this.mediaControl != null) { this.mediaControl.Stop(); this.mediaControl = null; } if (this.filterGraph != null) { ((IMediaEventSink)this.filterGraph).Notify(EventCode.UserAbort, IntPtr.Zero, IntPtr.Zero); Marshal.ReleaseComObject(this.filterGraph); this.filterGraph = null; } } GC.Collect(); }