(on macOS, with both SDL2 and SDL2 compat)
When I do the following:
- open a “slow” capture device (
SDL_OpenAudioDevicetakes a long time to return) - immediately unpause that device
- immediately unpause a playback device
The following weird thing happens:
- the playback device callback gets called many times in rapid succession (more rapid than normal)
- the supplied audio is not played back
- this happens until the playback callback “catches up” with… something. Up to a few seconds.
- then, things continue on normally
- recording is OK throughout
Notably, adding a sleep() between the call to SDL_OpenAudioDevice and the two calls to SDL_PauseAudioDevice solves the problem; so it’s as though the audio system has not fully recovered from opening the capture device even after SDL_OpenAudioDevice as returned, and the sleep allows it that chance.
The problem is most obvious when using a separate iOS device as a capture device (a weird macos feature), presumably because that device is especially “slow”. It both takes several seconds for SDL_OpenAudioDevice to return (expected) and subsequently takes a few seconds for the playback to operate normally (unexpected). However, the issue still appears to be present – albeit with much shorter delays – when using other, more normal audio devices.
I don’t think this is an issue with coreaudio, but it’s hard to be certain of that.
Anyone have any ideas? If not, I could try to create a small reproducible example.