ASIO and Video on Windows

Using JUCE 3.0.8

When I choose the ASIO driver (ASIO4All) and playback a video in Windows, a EC_ERRORABORT error is produced in the graphEventProc() routine. This error closes the vide and sets mediaEvent to null which causes a crash on the next instructions.

    void graphEventProc()
    {
        LONG ec;
        LONG_PTR p1, p2;
        jassert (mediaEvent != nullptr);
        while (SUCCEEDED (mediaEvent->GetEvent (&ec, &p1, &p2, 0)))
        {
            switch (ec)
            {
            case EC_REPAINT:
                component.repaint();
                break;
            case EC_COMPLETE:
                if (component.isLooping())
                    component.goToStart();
                else
                    component.stop();
                break;
            case EC_USERABORT:
            case EC_ERRORABORT:
            case EC_ERRORABORTEX:
               component.closeMovie(); //This causes mediaEvent to be set to null
                break;
            default:
                break;
            }
            mediaEvent->FreeEventParams (ec, p1, p2);
        }
    }


This also occurs in the JUCE demo.

All is fine using Windows Audio.

HELP!

OK.. well, we can't stop the DirectShow class from failing, but we can at least avoid the crash!

I think the best non-leaky fix would be to just move the FreeEventParams call up to the top, e.g.

        while (SUCCEEDED (mediaEvent->GetEvent (&ec, &p1, &p2, 0)))
        {
            mediaEvent->FreeEventParams (ec, p1, p2);

            switch (ec)
            {

..as the parameters don't actually seem to be needed at all. Does that work for you?

Thanks, that is what I had to do. Are you saying one can not have video and ASIO at the same time?

If I comment out the closing of the video, it runs but has no sound.

Is it possible to fix this or what do you recommend I do to show video while using ASIO?

That doesn't have anything to do with JUCE - it sounds like Windows components or drivers fighting with each other. Can't really help with that..

I wonder how other DAWS do it!

You also need to place a return; after the component.closeMovie() to avoid the crash.

You also need to place a return; after the component.closeMovie() to avoid the crash.

No, I suggested moving the line up to there. Not copying it, otherwise the memory would be freed twice. I've already pushed this fix to master BTW.