我开发了一个视频采集应用程序,其中CPU为624MHz(ARM920T-PAX310),RAM为72MB。捕获的视频为1分钟,但保存视频文件大约需要10分钟。我设置了一个断点,发现它花了很长时间。
//------------------- set filename
HRESULT hResult;
CComPtr<IFileSinkFilter> pFileSinkFilter;
m_pMediaControl->Stop();
m_pMediaControl->Run();
CHK(m_pASFMultiplexer->QueryInterface(&pFileSinkFilter)); CHK(pFileSinkFilter->SetFileName(L"\\windows\\sample.asf",NULL));// pFileSinkFilter.Release();
//------------------start record
LONGLONG dwStart = 0, dwEnd = 0;
WORD wStartCookie = 1, wEndCookie = 2;
HRESULT hResult = 0;
if( m_pCaptureGraphBuilder == NULL )
{
return FALSE;
}
//
dwStart=0;
dwEnd=MAXLONGLONG;
hResult = m_pCaptureGraphBuilder->ControlStream( &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, m_pVideoCaptureFilter, &dwStart, &dwEnd, wStartCookie, wEndCookie );
Sleep(60000);//1 minute
//------------------stop record
HRESULT hResult = S_OK;
LONGLONG dwStart = 0, dwEnd = 0;
WORD wStartCookie = 1, wEndCookie = 2;
LONG lEventCode = 0;
LONG lParam1 = 0;
LONG lParam2 = 0;
if( m_pCaptureGraphBuilder == NULL )
{
return FALSE;
}
//
dwStart = 0;
hResult = m_pMediaSeeking->GetCurrentPosition( &dwEnd );
hResult = m_pCaptureGraphBuilder->ControlStream( &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, m_pVideoCaptureFilter, &dwStart, &dwEnd, wStartCookie, wEndCookie );
//
while (true)
{
m_pMediaEvent->GetEvent( &lEventCode, &lParam1, &lParam2, INFINITE );
m_pMediaEvent->FreeEventParams( lEventCode, lParam1, lParam2 );
if( lEventCode == EC_STREAM_CONTROL_STOPPED ) {
TRACE(L"Record stop\n");
break;
}
Sleep(100);
NKDbgPrintfW(L"lEventCode = %d dwEnd = %d\n",lEventCode,dwEnd);
}
我发现文件的大小从&#34;开始记录&#34;继续增加。为什么需要很长时间才能停止记录&#34;我应该怎么做&#34;停止记录&#34; ???