Index: DShowNET/Helper/DirectShowUtil.cs =================================================================== --- DShowNET/Helper/DirectShowUtil.cs (revision 28031) +++ DShowNET/Helper/DirectShowUtil.cs (working copy) @@ -1738,6 +1738,7 @@ { if (String.Equals(info.achName, filterName)) { + DisconnectAllPins(graphBuilder, filter); hr = graphBuilder.RemoveFilter(filter); DsError.ThrowExceptionForHR(hr); ReleaseComObject(filter); @@ -1746,6 +1747,7 @@ } else { + DisconnectAllPins(graphBuilder, filter); hr = graphBuilder.RemoveFilter(filter); DsError.ThrowExceptionForHR(hr); int i = ReleaseComObject(filter); Index: Player/BaseTSReaderPlayer.cs =================================================================== --- Player/BaseTSReaderPlayer.cs (revision 28031) +++ Player/BaseTSReaderPlayer.cs (working copy) @@ -1527,6 +1527,23 @@ { Log.Error("Error stopping graph: {0}", error.Message); } + + try + { + //Make sure the graph has really stopped + FilterState state; + hr = _mediaCtrl.GetState(1000, out state); + DsError.ThrowExceptionForHR(hr); + if (state != FilterState.Stopped) + { + Log.Error("TSReaderPlayer: graph still running"); + } + } + catch (Exception error) + { + Log.Error("Error checking graph state: {0}", error.Message); + } + if (needRebuild) { // this is a hack for MS Video Decoder and AC3 audio change @@ -1947,6 +1964,7 @@ FilterInfo fInfo; pInfo.filter.QueryFilterInfo(out fInfo); Log.Debug("TSReaderPlayer: Remove filter - {0}", fInfo.achName); + DirectShowUtil.DisconnectAllPins(_graphBuilder, pInfo.filter); _graphBuilder.RemoveFilter(pInfo.filter); DsUtils.FreePinInfo(pInfo); DirectShowUtil.ReleaseComObject(fInfo.pGraph);