MCPcopy Create free account
hub / github.com/Nevcairiel/LAVFilters / DoBufferProcessingLoop

Method DoBufferProcessingLoop

common/baseclasses/source.cpp:480–553  ·  view source on GitHub ↗

DoBufferProcessingLoop Grabs a buffer and calls the users processing function. Overridable, so that different delivery styles can be catered for.

Source from the content-addressed store, hash-verified

478// Grabs a buffer and calls the users processing function.
479// Overridable, so that different delivery styles can be catered for.
480HRESULT CSourceStream::DoBufferProcessingLoop(void)
481{
482
483 Command com;
484
485 OnThreadStartPlay();
486
487 do
488 {
489 while (!CheckRequest(&com))
490 {
491
492 IMediaSample *pSample;
493
494 HRESULT hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0);
495 if (FAILED(hr))
496 {
497 Sleep(1);
498 continue; // go round again. Perhaps the error will go away
499 // or the allocator is decommited & we will be asked to
500 // exit soon.
501 }
502
503 // Virtual function user will override.
504 hr = FillBuffer(pSample);
505
506 if (hr == S_OK)
507 {
508 hr = Deliver(pSample);
509 pSample->Release();
510
511 // downstream filter returns S_FALSE if it wants us to
512 // stop or an error if it's reporting an error.
513 if (hr != S_OK)
514 {
515 DbgLog((LOG_TRACE, 2, TEXT("Deliver() returned %08x; stopping"), hr));
516 return S_OK;
517 }
518 }
519 else if (hr == S_FALSE)
520 {
521 // derived class wants us to stop pushing data
522 pSample->Release();
523 DeliverEndOfStream();
524 return S_OK;
525 }
526 else
527 {
528 // derived class encountered an error
529 pSample->Release();
530 DbgLog((LOG_ERROR, 1, TEXT("Error %08lX from FillBuffer!!!"), hr));
531 DeliverEndOfStream();
532 m_pFilter->NotifyEvent(EC_ERRORABORT, hr, 0);
533 return hr;
534 }
535
536 // all paths release the sample
537 }

Callers

nothing calls this directly

Calls 2

NotifyEventMethod · 0.80
ReleaseMethod · 0.45

Tested by

no test coverage detected