当改变文件名,拍摄开始逾期3秒。(When changing a file name, Record

2019-07-29 23:17发布

使用在graph.One正在WMV文件中的两个ASFWriter过滤器,Anather是现场直播。

开展流媒体,当改变文件名,拍摄开始逾期3秒。 因此,新的WMV的头不见了。 它的困扰。

CAMERA ------ InfTee过滤器--- AsfWriter过滤→WMV文件

                        X

话筒--- InfTee过滤器2 --- AsfWriter过滤器2→直播

void RecStart()
{
        ...

    ConnectFilters(pInfTee,"Infinite Pin Tee Filter(1)",L"Output1",pASFWriter,"ASFWriter",L"Video Input 01"));
    ConnectFilters(pInfTee,"Infinite Pin Tee Filter(2)",L"Output2",pASFWriter2,"ASFWriter",L"Video Input 01"));
    ConnectFilters(pSrcAudio,"Audio Source",L"Capture",pInfTee2,"Infinite Pin Tee Filter",L"Input"));
    ConnectFilters(pInfTee2,"Infinite Pin Tee Filter(1)A",L"Output1",pASFWriter,"ASFWriter",L"Audio Input 01"));
    ConnectFilters(pInfTee2,"Infinite Pin Tee Filter(2)A",L"Output2",pASFWriter2,"ASFWriter",L"Audio Input 01"));


    pASFWriter2->QueryInterface(IID_IConfigAsfWriter,(void**)&pConfig);

    pConfig->QueryInterface(IID_IServiceProvider,(void**)&pProvider);

    pProvider->QueryService(IID_IWMWriterAdvanced2, IID_IWMWriterAdvanced2, (void**)&mpWriter2);

    mpWriter2->SetLiveSource(TRUE);

    mpWriter2->RemoveSink(0);

    WMCreateWriterNetworkSink(&mpNetSink);

    DWORD dwPort = (DWORD)streamingPortNo;
    mpNetSink->Open(&dwPort);

    mpNetSink->GetHostURL(url, &url_len);

    hr =mpWriter2->AddSink(mpNetSink);


    pGraph->QueryInterface(IID_IMediaEventEx,(void **)&pMediaIvent);

    pMediaIvent->SetNotifyWindow((OAHWND)this->m_hWnd,WM_GRAPHNOTIFY,0);

    pGraph->QueryInterface(IID_IMediaControl,(void **)&pMediaControl);

    pMediaControl->Run();
}


void OnTimer()
{

    pMediaControl->Stop();

    CComQIPtr<IFileSinkFilter,&IID_IFileSinkFilter> pIFS = pASFWriter;
    pIFS->SetFileName(NewFilename,NULL);

    pMediaControl->Run();
}

---------------------------------------------------------------------------
→ I think ... In order to wait for starting of streaming, 
it is missing for 3 seconds in head of New WMV File.
Are there any measures? 
---------------------------------------------------------------------------

Answer 1:

当您重新启动的图形,你难免会错过数据的片段,由于初始化开销。 而且,它是不可能的切换文件,而无需停止图。 该解决方案是使用多个图形,并保持捕获而与文件写入的一部分,正在重新初始化。

见的DirectShow桥梁的典型解决方案解决这一问题。



文章来源: When changing a file name, Recording Start is overdue for 3 seconds.