测量directshow过滤器的性能

时间:2016-02-17 07:01:30

标签: c++ performance windows-ce directshow

我为win CE构建了一个mp3解码器directshow过滤器,我想测量解码器的性能。我在msdn站点https://msdn.microsoft.com/en-IN/library/ms932254.aspx找到了两个宏,这些宏在基类的 measure.h 头文件中声明。 在 measure.h 文件中解释说,除非定义宏PERF,否则这些宏将扩展为空。但是一旦启用宏,我就会收到链接错误

  

“LNK2019:未解析的外部符号Msr_Start()参考   功能函数“public:virtual long_cdecl   CMP3Decoder :: Recieve(Struct IMediaSample   *)“(?收到@ @@ CMP3Decoder @@@ UAAJPAUIMediaSample Z)

我试图在strmbase.lib中转储符号,但是我找不到任何符号名称Msr_Start。我也搜索了整个基类文件夹的源代码。

我在哪里可以找到这些功能的定义?

或者还有其他方法来衡量过滤器的性能吗?

CMP3Decoder :: recieve()函数如下

HRESULT CMP3Decoder :: Receive(IMediaSample * pSample) {

HRESULT hr;
ASSERT(pSample);
if(pSample == NULL || m_MP3DecHandle == NULL)
{
    return E_FAIL;
}

ASSERT (m_pOutput != NULL) ;

// Start timing the transform (if PERF is defined)
MSR_START(m_idTransform);

// have the derived class transform the data

hr = MP3StartDecode(pSample);//, pOutSample);

// Stop the clock and log it (if PERF is defined)
MSR_STOP(m_idTransform);

if (FAILED(hr)) {
    //DbgLog((LOG_TRACE,1,TEXT("Error from transform")));
} else {
    // the Transform() function can return S_FALSE to indicate that the
    // sample should not be delivered; we only deliver the sample if it's
    // really S_OK (same as NOERROR, of course.)
    if (hr == NOERROR) {
        //hr = m_pOutput->Deliver(pOutSample);
        m_bSampleSkipped = FALSE;   // last thing no longer dropped
    } else {
        // S_FALSE returned from Transform is a PRIVATE agreement
        // We should return NOERROR from Receive() in this cause because returning S_FALSE
        // from Receive() means that this is the end of the stream and no more data should
        // be sent.
        if (S_FALSE == hr) {

            //  Release the sample before calling notify to avoid
            //  deadlocks if the sample holds a lock on the system
            //  such as DirectDraw buffers do
            //pOutSample->Release();
            m_bSampleSkipped = TRUE;
            if (!m_bQualityChanged) {
                NotifyEvent(EC_QUALITY_CHANGE,0,0);
                m_bQualityChanged = TRUE;
            }
            return NOERROR;
        }
    }
}
// release the output buffer. If the connected pin still needs it,
// it will have addrefed it itself.
//pOutSample->Release();

return hr;

}

1 个答案:

答案 0 :(得分:0)

根据MSDN,您需要链接到Strmiids.lib。

  

或者还有其他方法来衡量过滤器的性能吗?

为了测量滤波器的性能,我通常在要测量的滤波器之前和之后插入自定义的就地滤波器。 Trans-in-place过滤器以高分辨率将采样时间和当前时间输出到日志文件。您可以通过从after中减去当前时间并对其进行平均来计算滤波器处理时间等。此外,只有在您不想干扰测量本身后才能停止图形后才能完成file-io。

更新: 转储Strmiids.lib中的符号似乎确认在Strmiids.lib中未定义Msr_xxx函数。看起来MSDN文章不正确。