MCPcopy Create free account
hub / github.com/Aleksoid1978/VideoRenderer / Receive

Method Receive

Source/VideoRenderer.cpp:517–598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

515}
516
517HRESULT CMpcVideoRenderer::Receive(IMediaSample* pSample)
518{
519 // override CBaseRenderer::Receive() for the implementation of the search during the pause
520
521 if (m_bFlushing) {
522 DLog(L"CMpcVideoRenderer::Receive() - flushing, skip sample");
523 return S_OK;
524 }
525
526 ASSERT(pSample);
527
528 // It may return VFW_E_SAMPLE_REJECTED code to say don't bother
529
530 HRESULT hr = PrepareReceive(pSample);
531 ASSERT(m_bInReceive == SUCCEEDED(hr));
532 if (FAILED(hr)) {
533 if (hr == VFW_E_SAMPLE_REJECTED) {
534 return NOERROR;
535 }
536 return hr;
537 }
538
539 // We realize the palette in "PrepareRender()" so we have to give away the
540 // filter lock here.
541 if (m_State == State_Paused) {
542 // no need to use InterlockedExchange
543 m_bInReceive = FALSE;
544 {
545 // We must hold both these locks
546 CAutoLock cVideoLock(&m_InterfaceLock);
547 if (m_State == State_Stopped)
548 return NOERROR;
549
550 m_bInReceive = TRUE;
551 }
552 Ready();
553 }
554
555 if (m_State == State_Paused) {
556 m_bInReceive = FALSE;
557
558 CAutoLock cRendererLock(&m_RendererLock);
559 DoRenderSample(m_pMediaSample);
560 }
561
562 // Having set an advise link with the clock we sit and wait. We may be
563 // awoken by the clock firing or by a state change. The rendering call
564 // will lock the critical section and check we can still render the data
565
566 hr = WaitForRenderTime();
567 if (FAILED(hr)) {
568 m_bInReceive = FALSE;
569 return NOERROR;
570 }
571
572 // Set this here and poll it until we work out the locking correctly
573 // It can't be right that the streaming stuff grabs the interface
574 // lock - after all we want to be able to wait for this stuff

Callers

nothing calls this directly

Calls 1

DLogFunction · 0.85

Tested by

no test coverage detected