- Posts: 5
- Joined: Thu Oct 04, 2018 10:53 pm
- Real Name: Daniel Shields
Hi,
I'm currently trying to output a frame buffer to a decklink in C# using the 12.0 SDK. I have the following code running on each "ScheduledFrameCompleted" callback:
This process runs fine for between 4 and 6 frames, before the "CreateVideoFrame" call returns E_FAIL (and throws an exception). This makes me think there's some kind of memory management step I'm missing?
My program is based of the SignalGenCSharp sample, which I had working fine on the 12.0 SDK, but I guess the key difference is I'm running CreateVideoFrame for each new frame?
For more info, the FillRenderFrame function does a simple Marshal.Copy of the pixel data into the Decklink frame.
Would be grateful for any advice/input on this! Let me know if there's any other code snippets you need that could help work out what the issue is. Thanks!
I'm currently trying to output a frame buffer to a decklink in C# using the 12.0 SDK. I have the following code running on each "ScheduledFrameCompleted" callback:
- Code: Select all
byte[] framePixelData;
if (Program.frameBuffer.TryDequeue(out framePixelData))
{
IDeckLinkMutableVideoFrame scheduleFrame;
selectedDevice.DeckLinkOutput.CreateVideoFrame(frameWidth, frameHeight, BytesPerRow, selectedPixelFormat, _BMDFrameFlags.bmdFrameFlagDefault, out scheduleFrame);
FillRenderFrame(scheduleFrame, framePixelData);
selectedDevice.DeckLinkOutput.ScheduleVideoFrame(scheduleFrame, (totalFramesScheduled * frameDuration), frameDuration, frameTimescale);
} else
{
// frame buffer was empty or locked elsewhere
ScheduleEmptyFrame();
}
totalFramesScheduled++;
This process runs fine for between 4 and 6 frames, before the "CreateVideoFrame" call returns E_FAIL (and throws an exception). This makes me think there's some kind of memory management step I'm missing?
My program is based of the SignalGenCSharp sample, which I had working fine on the 12.0 SDK, but I guess the key difference is I'm running CreateVideoFrame for each new frame?
For more info, the FillRenderFrame function does a simple Marshal.Copy of the pixel data into the Decklink frame.
Would be grateful for any advice/input on this! Let me know if there's any other code snippets you need that could help work out what the issue is. Thanks!