Simplify ownership/lifetime
Some checks failed
CI / Native Windows Build And Tests (push) Has been cancelled
CI / React UI Build (push) Has been cancelled
CI / Windows Release Package (push) Has been cancelled

This commit is contained in:
2026-05-06 10:57:59 +10:00
parent 1b67777c4a
commit bbbc678c83
4 changed files with 109 additions and 52 deletions

View File

@@ -344,7 +344,48 @@ bool DeckLinkSession::ConfigureOutput(OpenGLComposite* owner, HDC hdc, HGLRC hgl
return true;
}
bool DeckLinkSession::Start(unsigned outputHeight)
double DeckLinkSession::FrameBudgetMilliseconds() const
{
return frameTimescale != 0
? (static_cast<double>(frameDuration) * 1000.0) / static_cast<double>(frameTimescale)
: 0.0;
}
IDeckLinkMutableVideoFrame* DeckLinkSession::RotateOutputFrame()
{
IDeckLinkMutableVideoFrame* outputVideoFrame = outputVideoFrameQueue.front();
outputVideoFrameQueue.push_back(outputVideoFrame);
outputVideoFrameQueue.pop_front();
return outputVideoFrame;
}
bool DeckLinkSession::TransferPlayoutFrame(void* address, GLuint outputTexture)
{
return playoutAllocator != nullptr && playoutAllocator->transferFrame(address, outputTexture);
}
void DeckLinkSession::WaitForPlayoutTransferComplete(void* address)
{
if (playoutAllocator != nullptr)
playoutAllocator->waitForTransferComplete(address);
}
void DeckLinkSession::AccountForCompletionResult(BMDOutputFrameCompletionResult completionResult)
{
if (completionResult == bmdOutputFrameDisplayedLate || completionResult == bmdOutputFrameDropped)
totalPlayoutFrames += 2;
}
bool DeckLinkSession::ScheduleOutputFrame(IDeckLinkMutableVideoFrame* outputVideoFrame)
{
if (output->ScheduleVideoFrame(outputVideoFrame, (totalPlayoutFrames * frameDuration), frameDuration, frameTimescale) != S_OK)
return false;
totalPlayoutFrames++;
return true;
}
bool DeckLinkSession::Start()
{
totalPlayoutFrames = 0;
if (!output)
@@ -380,7 +421,7 @@ bool DeckLinkSession::Start(unsigned outputHeight)
void* pFrame;
outputVideoFrameBuffer->GetBytes((void**)&pFrame);
memset(pFrame, 0, outputVideoFrame->GetRowBytes() * outputHeight);
memset(pFrame, 0, outputVideoFrame->GetRowBytes() * outputFrameHeight);
outputVideoFrameBuffer->EndAccess(bmdBufferAccessWrite);
outputVideoFrameBuffer->Release();