1

我开发了一个视频捕获应用程序,其中 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);
    }

我发现文件的大小从“开始记录”开始不断增加。为什么“停止记录”需要很长时间“停止记录”我应该做什么???

4

0 回答 0