RenderHeads / UnityPlugin-AVProDeckLink

AVPro DeckLink is a Unity plugin for broadcast CG using Blackmagic capture hardware
https://renderheads.com/products/avpro-decklink/
9 stars 1 forks source link

Output fails with: Unable to start device Intensity Pro 4K, it might be currently busy #46

Closed genereddick closed 3 years ago

genereddick commented 3 years ago

Describe the bug A clear and concise description of what the bug is.

In the latest version 1.9.0 I am unable to get an Output feed from a card when Input is running. The previous version of the software with all other settings the same handles this fine.

The issue appears in this code from the current version:

From Decklink.cs

public void Begin(bool search = false) 
{
    ...
    if (_device != null)
    {
    bool valid = IsInput() ? _device.CanInput() : _device.CanOutput();
       if (valid) { .. .}
       else {
         Debug.LogWarning("[AVProDeckLink] Unable to start device " + _device.Name + ", it might be currently busy");
       _device = null;
        }
...
}

Here _device.CanOutput() calls into Device.cs

public bool CanOutput()
{
    bool result = SupportsOutput && !IsOutputBusy && !IsInputBusy;
    /*if (result)
    {
        if (_fullDuplexSupported)
        {
            result = !IsStreamingOutput;
        }
        else
        {
            result = !IsStreaming;
        }
    }*/
    return result;
}

Here IsInputBusy() is returning true (thus !true) causing the Output to fail. If I hack the method to return true no matter what it works and I have both Input and Ouput working on the same device/card as in the previous version.

For reference here is the previous version of this code (pre 1.9.0) which works.

public bool CanInput()
{
    if (_fullDuplexSupported)
    {
        return !IsStreamingInput;
    }
    else
    {
        return !IsStreaming;
    }
}

Your Setup (please complete the following information):

To Reproduce Steps to reproduce the behavior: Download latest version, attempt to run InputOutputDemo scene, using Decklink Intensity Pro 4K or Ultrastudio. Check that Input and Output both work.

Logs [AVProDeckLink] Unable to start device Intensity Pro 4K, it might be currently busy UnityEngine.Debug:LogWarning (object) RenderHeads.Media.AVProDeckLink.DeckLink:Begin (bool) (at Assets/AVProDeckLink/Scripts/Internal/DeckLink.cs:565) RenderHeads.Media.AVProDeckLink.Demos.InputModifyOutputDemo:StartOutput (RenderHeads.Media.AVProDeckLink.DeviceMode) (at Assets/AVProDeckLink/Demos/Scripts/InputModifyOutputDemo.cs:151) RenderHeads.Media.AVProDeckLink.Demos.InputModifyOutputDemo:OnGUI () (at Assets/AVProDeckLink/Demos/Scripts/InputModifyOutputDemo.cs:364)

Screenshots If applicable, add screenshots to help explain your problem.

Videos If applicable, add a copy of your video or the URL

RichRH commented 3 years ago

Hi @genereddick,

Thanks for your bug report - you're correct, somehow this slipped through the net! We've implemented a fix which will be released in the next version but for now you can change the 'CanInput()' and 'CanOutput()' functions as follows which should resolve this:

public bool CanInput()
{
    return SupportsInput && !IsInputBusy && (_fullDuplexSupported || !IsOutputBusy);
}

public bool CanOutput()
{
    return SupportsOutput && !IsOutputBusy && (_fullDuplexSupported || !IsInputBusy);
}

Please let us know if this works for you!

Cheers, Richard

RichRH commented 3 years ago

Hi @genereddick - just wanted to check if the above fix worked for you?

Cheers, Richard

genereddick commented 3 years ago

Yes, the fix worked. Thanks!

From: Richard Turnbull @.> Sent: Wednesday, September 22, 2021 3:31 AM To: RenderHeads/UnityPlugin-AVProDeckLink @.> Cc: Gene Reddick @.>; Mention @.> Subject: Re: [RenderHeads/UnityPlugin-AVProDeckLink] Output fails with: Unable to start device Intensity Pro 4K, it might be currently busy (#46)

Hi @genereddick https://github.com/genereddick - just wanted to check if the above fix worked for you?

Cheers, Richard

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/RenderHeads/UnityPlugin-AVProDeckLink/issues/46#issuecomment-924800094 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH4MQJDOXZFVQSM7AD6W63UDGV55ANCNFSM5BFCGUWA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AAH4MQIAY4W4FIX4ID2D5QTUDGV55A5CNFSM5BFCGUWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOG4PVIXQ.gif