SDK capture frame-drop questions

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

marton.balint

  • Posts: 2
  • Joined: Thu May 24, 2018 10:48 am
  • Real Name: Marton Balint

SDK capture frame-drop questions

PostFri May 25, 2018 11:26 am

When I am capturing frames I receive them using the VideoInputFrameArrived callback. In that callback I typically use videoFrame->AddRef() and store videoFrame in a queue to keep the frame around even after the callback returns.

If I don’t Release() the stored frames fast enough, I get VideoInputFrameArrived callbacks with NULL videoFrames, so the DeckLink drivers start dropping frames. Is there a way to
  • Query how many frame references can be simultaneously kept before the driver starts dropping frames? Or query how many "free" frames are still available?
  • Increase the number of available frames? (Set how many frame references can be used before the driver starts dropping frames?)
  • Disable the frame dropping logic entirely (even at the cost of consuming more and more memory)?
Thanks,
Marton
Offline

marton.balint

  • Posts: 2
  • Joined: Thu May 24, 2018 10:48 am
  • Real Name: Marton Balint

Re: SDK capture frame-drop questions

PostMon Jun 11, 2018 5:00 pm

For future reference, let me paste the response from the BlackMagic developer support, which pretty much answers my questions:

Unfortunately there is no way of testing the memory allocator how many IDeckLinkVideoFrames have been consumed. The default memory allocator has a capacity of approx 35 video frames, at the maximum resolution/pixel format supported by the device.

You can however generate your own custom memory allocator that sub-classes the
IDeckLinkMemoryAllocator object interface. You need to implement all methods as defined by IDeckLinkMemoryAllocator and IUnknown. This strategy allows you to manage the depth of memory and allocate many more frames than the default memory allocator. You register your custom memory allocator by calling IDeckLinkInput::SetVideoInputFrameMemoryAllocator().

Please have a look at the LoopThroughWithDX11Compositing sample for an example of the IDeckLinkMemoryAllocator usage. DX11Composite.h defines a class PinnedMemoryAllocator which subclasses IDeckLinkMemoryAllocator. Your implementation will be simpler than this class - we have designed to have shared memory with GPU.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 11 guests