Weird but predictable problem stuttering and missing frames with BlackMagic (4k) (decklink plugin) capture source

dcmouser

Member
I've got a strange problem with a Black Magic capture source (4k Quad Hdmi capture board) causing missed frames.

Here's the problem:
If I switch away from the source (or simply toggle it invisible) for more than 15 seconds or so, and then come back to it (or mark it visible), I will get a very repeatable stuttering and dropping of 10-20 Missed Frames.
If I just switch away for a few seconds, the problem does not occur.

This happens even when not recording or streaming, is very repeatable, and is happening on a very fast machine with render times of 1.4ms and 1% cpu use.

The REAL confirmation about the oddity of this being unrelated to performance is that if i use Exeldro's source dock plugin to show an additional dock displaying the 4k blackmagic capture source at all times, then the problem goes away completely.

SO: The problem is being caused by the blackmagic source NOT being displayed for some amount of time (15 seconds or so), as if the long delay is causing OBS to free the capture object from some cache, or close the connection to the capture device, and then have to reconnect.

I've gone into the decklink plugin code and added some debug statements to see if I could catch the decklink plugin disconnecting and reconnecting but I didn't see anything triggered.

What I don't know is if the root of the problem is with OBS doing something like releasing and then reacquiring the capture device, or with the decklink/blackmagic api dll somehow deciding OBS hasn't asked for video data for a while so it's safe to release the device, etc., it's almost like the device is going to sleep. I'd be happy to add an option to prevent the device from sleeping if i knew what was happening.

Any ideas?

[ps. Before you ask -- the logs show nothing happening when this stuttering missed frames triggers.]
 

AaronD

Member
Regardless of what's really happening, it looks like the workaround is to always render that source. Perhaps you'll find the Multiview to be useful enough to keep open?
 

dcmouser

Member
Exeldro's source dock plugin is the only way I can think of to have a source always active even when not showing in the current scene.. But it's a much less than ideal situation since I'm basically paying the cpu/gpu cost of rendering a 4k source every frame that I don't need to be rendering 99.9% of the time.

I'd love to figure out the nature of the problem.
 
Top