【发布时间】:2016-02-17 19:38:05
【问题描述】:
我已经为 win CE 构建了一个 mp3 解码器 directshow 过滤器,我想测量解码器的性能。我从 msdn 站点找到了两个宏,https://msdn.microsoft.com/en-IN/library/ms932254.aspx,它们在基类的 measure.h 头文件中声明。 measure.h 文件中解释说,除非定义了宏 PERF,否则这些宏将扩展为空。但是一旦启用宏,就会出现链接错误
“LNK2019:未解析的外部符号 Msr_Start() 在 函数函数“公共:虚拟long_cdecl CMP3Decoder::Recieve(Struct IMediaSample *)"(?Recieve@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;
}
【问题讨论】:
标签: c++ performance windows-ce directshow