我已經爲win CE構建了一個mp3解碼器directshow過濾器,並且我想測量解碼器的性能。我從msdn站點發現了兩個宏,https://msdn.microsoft.com/en-IN/library/ms932254.aspx,它在基類中的measure.h頭文件中聲明。 在measure.h文件中解釋說,除非定義了宏PERF,否則這些宏將擴展爲無。但是一旦我啓用宏,我得到的鏈接錯誤測量directshow過濾器的性能
「LNK2019:在 功能功能referneced解析外部符號Msr_Start() 「市民:虛擬long_cdecl CMP3Decoder ::收到(結構IMediaSample *)」(?收到@ CMP3Decoder @@ UAAJPAUIMediaSample @@@ Z)
我試圖轉儲符號strmbase.lib,但我找不到任何符號名Msr_Start在裏面。還我搜索了整個基礎類文件夾源代碼
我在哪裏可以找到這些功能的定義?
或者還有其他方法來測量過濾器的性能嗎?
CMP3Decoder ::收到()函數如下
HRESULT CMP3Decoder ::接收(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;
}
目前我已根據[msdn](https://technet.microsoft.com/de-de/subscriptions)鏈接到strmbase.lib,Strmiids.lib,Ole32.lib,Ole32auth.lib,Uuid.lib庫/下載/ aa451221)。 strmiids.lib給出了標準組件的CLSID和IID我認爲 – thomachan
你可以發佈你的「CMP3Decoder :: Recieve」方法嗎? – Ralf
根據[msdn](https://msdn.microsoft.com/en-us/library/windows/desktop/dn553408%28v=vs.85%29.aspx),使用QueryPerformanceCounter(),我找到了解決方法。但是,如果我能得到有關MSR_START和MSR_STOP的詳細信息,那就太棒了 – thomachan