清理DirectShow图-DirectShow图不会停止 [英] Clean up DirectShow Graph - DirectShow graph is not stopping

查看:114
本文介绍了清理DirectShow图-DirectShow图不会停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用DirectShowNet,并且当我的图形停止时,我释放com对象。

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

问题是,当我尝试释放COM对象[过滤器,接口]时,有时此清理会导致DirectShow图形未停止。它挂起。

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

如果我不抓紧[释放com对象]一切都很好[除了我有内存泄漏] ...

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

这是我清理的方式:

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"?

推荐答案

您没有提到确切的调用已停止(冻结)以及调用的是什么?

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

这是典型的情况,即过滤器出现故障,或者可能是 Sample Grabber 过滤器带有一个错误的回调,无法同步接收停止请求的主线程以及后台线程上的工作线程或工作线程活动,并最终锁定为死状态。您应该能够通过在调试器下检查线程状态来确定损坏的组件。

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.

这篇关于清理DirectShow图-DirectShow图不会停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆