Skip to content

loopback-capture project: the test on flags returned from IAudioCaptureClient::GetBuffer seems incorrect #100

@smourier

Description

@smourier

You do this:

if (bFirstPacket && AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY == dwFlags) {
            LOG(L"%s", L"Probably spurious glitch reported on first packet");
        } else if (0 != dwFlags) {
            LOG(L"IAudioCaptureClient::GetBuffer set flags to 0x%08x on pass %u after %u frames", dwFlags, nPasses, *pnFrames);
            return E_UNEXPECTED;
        }

On my PC I systematically receive a combination of AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY and AUDCLNT_BUFFERFLAGS_SILENT on the 1st packet so the code will return E_UNEXPECTED and I don't see why it should.

I think you should just test for AUDCLNT_BUFFERFLAGS_TIMESTAMP_ERROR (maybe? can't we just continue even on this error?) and don't care about the other flags? At least it works for me with these changes.

PS: There's another glitch with the keyboard test: if I run the app from a console, it exits immediately. I had to change the stdin test events.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions