Closed pilzinho closed 8 months ago
So when writing this up I had another idea to try out. I figured that the work done in the Update() methods of the various involved components in the plugin maybe cause problems when calling StopInput(). Since OnGUI() is called after Update() (UnityExecutionOrder) this may be the reason that it works. So calling StopInput() after an WaitForEndOfFrame() also seems to work. So this may be a workaround for us. But it would be good if you could confirm this and of course it would be nice if the plugin would handle this on its own.
Unfortunately, we encountered new problems when using multiple (3-4) inputs. In this case our previous workaround doesn't work anymore and the application freezes again at the same spot: DeckLinkPlugin.StopInputStream(_deviceIndex) in Device.StopInput(). We suspect that rendering the inputs in DeckLinkManager takes longer and the devices may not be ready/released to be stopped yet. So for now we stop the devices in FixedUpdate() which happens before Update() what seems to work. But stopping multiple devices at once halts the application for up to 3-4 seconds which is also quite bad.
Hi @pilzinho,
Apologies for taking some time to get back to you and thanks for the reproduction steps - I've managed to replicate here.
As you suggest, calling 'StopInput()' after 'WaitForEndOfFrame()' can help alleviate in some situations, but will only go so far - it's fundamentally down to Unity/native GPU resource synchronisation and compounded by multiple inputs. I'm currently looking into a fix.
Cheers,
FYI.. I have a fix for the above currently in testing.
Cheers,
This issue has been fixed in the latest release (AVPro Decklink version 1.9.7). Please let us know if this issue has not been fixed for you.
We encountered an issue when stopping an input via script calling Device.StopInput() using version 1.9.6. In this case the application freezes. Debugging revealed that DeckLinkPlugin.StopInputStream(_deviceIndex) never returns. It happens almost every time and makes the plugin unusable for us. With version 1.9.3 it seems to work fine. So maybe there's some threading/locking issue going on. The InputExplorerDemo also seems to work fine with version 1.9.6. Maybe because of the way/the time the device is stopped using the button in OnGUI(). But we need to be able to stop the device any time via script.
When adding this Coroutine to Start() of the InputExplorerDemo the same freeze happens:
Running this Coroutine with version 1.9.3. stops and starts the devices correctly for a while but crashes at some point with this crash log:
I hope you can reproduce the issue and provide a fix for this since we have time pressure supporting DeckLink cards for a client and bought the asset for this reason because the AVPro Live Camera plugin which we are using for a while already was no adequate solution either.