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

Method EnqueueSubPic

Source/SubPic/SubPicQueueImpl.cpp:450–479  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448// private
449
450bool CSubPicQueue::EnqueueSubPic(CComPtr<ISubPic>& pSubPic, bool bBlocking)
451{
452 auto canAddToQueue = [this]() {
453 return (int)m_queue.size() < m_nMaxSubPic;
454 };
455
456 bool bAdded = false;
457
458 std::unique_lock<std::mutex> lock(m_mutexQueue);
459 if (bBlocking) {
460 // Wait for enough room in the queue
461 m_condQueueFull.wait(lock, canAddToQueue);
462 }
463
464 if (canAddToQueue()) {
465 if (m_bInvalidate && pSubPic->GetStop() > m_rtInvalidate) {
466#if SUBPIC_TRACE_LEVEL > 1
467 DLog(L"Subtitle Renderer Thread: Dropping rendered subpic because of invalidation");
468#endif
469 } else {
470 m_queue.emplace_back(pSubPic);
471 lock.unlock();
472 m_condQueueReady.notify_one();
473 bAdded = true;
474 }
475 pSubPic.Release();
476 }
477
478 return bAdded;
479}
480
481REFERENCE_TIME CSubPicQueue::GetCurrentRenderingTime()
482{

Callers

nothing calls this directly

Calls 3

DLogFunction · 0.85
GetStopMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected