Clean up DirectShow Graph - DirectShow graph is not stopping

只愿长相守 提交于 2019-12-24 08:16:22

问题


I use DirectShowNet and when my Graph is stopped I release com objects.

The problem is that while I try to release COM objects [ filters, interface] ,sometimes this cleanup cause directshow graph not STOPPED.It "suspend".

If I do not make clen up [ release com objects] everthing is OK [ except i have memory leaks] ...

Here is how i make clean up:

if (videoWindow != nullptr) 
{
    Marshal::ReleaseComObject(videoWindow);
    videoWindow = nullptr;

}

if (mediaControl != nullptr) 
{
    Marshal::ReleaseComObject(mediaControl);
    mediaControl = nullptr;             
}


if (graphBuilder != nullptr)
{
   Marshal::ReleaseComObject(graphBuilder);
   graphBuilder = nullptr;

}

....

What may be wrong? Do I relase filters in a wrong way? What may cause this "unstopable graph"?


回答1:


You did not mention which exactly call stopped (froze) and what was the call stack.

It is a typical scenario that a faulty filter, or it might be a Sample Grabber filter with a faulty callback, fails to synchronize "main" thread on which it receives stop request, and a worker thread or worker activity on background thread, and eventually locks dead. You should be able to identify a broken component by checking thread states under debugger.

Another method to isolate the problem to specific filter is to temporarily remove certain fragment from the pipeline and find out addition/removal of which fragment leads to the problems.



来源:https://stackoverflow.com/questions/9792775/clean-up-directshow-graph-directshow-graph-is-not-stopping

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!