MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / pushFramesToRenderInternal

Method pushFramesToRenderInternal

Engine/OutputSchedulerThread.cpp:684–734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

682}
683
684void
685OutputSchedulerThread::pushFramesToRenderInternal(int startingFrame,
686 int nThreads)
687{
688 // QMutexLocker l(&_imp->framesToRenderMutex); already locked (check below)
689 assert( !_imp->framesToRenderMutex.tryLock() );
690
691 ///Make sure at least 1 frame is pushed
692 if (nThreads <= 0) {
693 nThreads = 1;
694 }
695
696 RenderDirectionEnum direction;
697 int firstFrame, lastFrame, frameStep;
698 OutputSchedulerThreadStartArgsPtr runArgs = _imp->runArgs.lock();
699 assert(runArgs);
700 direction = runArgs->pushTimelineDirection;
701 firstFrame = runArgs->firstFrame;
702 lastFrame = runArgs->lastFrame;
703 frameStep = runArgs->frameStep;
704
705 PlaybackModeEnum pMode = _imp->engine->getPlaybackMode();
706 RenderDirectionEnum newDirection = direction;
707 if (firstFrame == lastFrame) {
708 _imp->framesToRender.push_back(startingFrame);
709#ifdef TRACE_SCHEDULER
710 qDebug() << "Scheduler Thread: Pushing frame to render: " << startingFrame;
711#endif
712 _imp->lastFramePushedIndex = startingFrame;
713 } else {
714 ///Push 2x the count of threads to be sure no one will be waiting
715 while ( (int)_imp->framesToRender.size() < nThreads * 2 ) {
716 _imp->framesToRender.push_back(startingFrame);
717#ifdef TRACE_SCHEDULER
718 QString pushDirectionStr = newDirection == eRenderDirectionForward ? QLatin1String("Forward") : QLatin1String("Backward");
719 qDebug() << "Scheduler Thread: Pushing frame to render: " << startingFrame << ", new push direction is " << pushDirectionStr;
720#endif
721 _imp->lastFramePushedIndex = startingFrame;
722 runArgs->pushTimelineDirection = newDirection;
723
724 if ( !OutputSchedulerThreadPrivate::getNextFrameInSequence(pMode, newDirection, startingFrame,
725 firstFrame, lastFrame, frameStep, &startingFrame, &newDirection) ) {
726 break;
727 }
728 }
729 }
730
731
732 ///Wake up render threads to notify them there's work to do
733 _imp->framesToRenderNotEmptyCond.wakeAll();
734}
735
736void
737OutputSchedulerThread::pushAllFrameRange()

Callers

nothing calls this directly

Calls 5

tryLockMethod · 0.45
lockMethod · 0.45
getPlaybackModeMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected