| Summary: | WASAPI_FlushCapture may handle empty-buffer return codes incorrectly | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Simon Hug <chli.hug> |
| Component: | audio | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | Windows 8 | ||
| Attachments: | WASAPI_FlushCapture (and bug 3632) workaround example. Don't commit this directly to the repository. | ||
|
Description
Simon Hug
2017-04-18 14:37:55 UTC
> Attached is an example workaround I used (including one for the issue > mentioned in bug 3632). Don't commit this directly to the repository, > because I really don't have enough experience to be certain that this is the > proper way of doing it. My patch is similar: https://hg.libsdl.org/SDL/rev/cca512965b67 > Also, SDL_wasapi.c mixes spaces and tabs for indentation. Sometimes on the > same line. The Horror! The danger of popping into Visual Studio for finishing work that was started elsewhere. :) That is fixed now too: https://hg.libsdl.org/SDL/rev/96de7fe65e32 Thanks! --ryan. I tested tip but still get a closed device. I'm sorry I didn't mention this earlier, but WASAPI_CaptureFromDevice also suffers from this issue. The code checks for AUDCLNT_S_BUFFER_EMPTY after calling WasapiFailed [1]. [1] https://hg.libsdl.org/SDL/file/c2f18f1f7e97/src/audio/wasapi/SDL_wasapi.c#l565 Correction for my last comment: I meant "disabled" not "closed". As in the call to SDL_OpenedAudioDeviceDisconnected sets the enabled member of SDL_AudioDevice to 0. Oh, and a quick check shows that WasapiFailed is only called if the return code isn't AUDCLNT_S_BUFFER_EMPTY after that GetBuffer call in WASAPI_CaptureFromDevice will fix it. Yeah, whoops, just noticed this too. Fix incoming. Fixed (for real this time?) in https://hg.libsdl.org/SDL/rev/4210074a33c8 --ryan. Yes, it has been resolved. |