(1)VideoCapture与之对接的USB CAMERA的缓冲数目修改的一种方法:
对下一级FILTER的INPUT中ALLOCATOR_PROPERTIES进行修改
IBaseFilter *pSmartFilter = NULL;
hr = m_pGraph->FindFilterByName(L"SmartTee", &pSmartFilter) ;
if (SUCCEEDED(hr) && (pSmartFilter != NULL))
{
IPin *pInput = NULL;
hr = m_pCaptureGraphBuilder->FindPin(pSmartFilter,PINDIR_INPUT,NULL,&MEDIATYPE_Video,FALSE,0,&pInput);
if(SUCCEEDED(hr) && pInput != NULL)
{
IMemInputPin *pMemPin = NULL;
hr = pInput->QueryInterface(IID_IMemInputPin,(void **)&pMemPin);
if(SUCCEEDED(hr) && pMemPin != NULL)
{
IMemAllocator *pAlloc = NULL;
hr = pMemPin->GetAllocator(&pAlloc);
ALLOCATOR_PROPERTIES prop;
ALLOCATOR_PROPERTIES prop1;
if(SUCCEEDED(hr) && pAlloc != NULL)
{
pAlloc->GetProperties(&prop);
prop.cBuffers = 6;
pAlloc->SetProperties(&prop,&prop1);
pAlloc->Commit();
}
pMemPin->Release();
pMemPin = NULL;
}
pInput->Release();
pInput = NULL;
}
pSmartFilter->Release();
pSmartFilter = NULL;
}
(2)录音停止问题:
测试发现录音停止一定要调用 waveInReset,调用waveInStop没效果,同时最好跟回调中处理做一下互斥
{
CAutoLock lock(&m_Lock);
hr = waveInReset(m_hWaveIn);
m_bReset = true;
}