mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 08:15:29 +00:00
723d014336
Cameron Gutman I was trying to use SDL_GetQueuedAudioSize() to ensure my audio latency didn't get too high while streaming data in from the network. If I get more than N frames of audio queued, I know that the network is giving me more data than I can play and I need to drop some to keep latency low. This doesn't work well on WASAPI out of the box, due to the addition of GetPendingBytes() to the amount of queued data. As a terrible hack, I loop 100 times calling SDL_Delay(10) and SDL_GetQueuedAudioSize() before I ever call SDL_QueueAudio() to get a "baseline" amount that I then subtract from SDL_GetQueuedAudioSize() later. However, because this value isn't actually a constant, this hack can cause SDL_GetQueuedAudioSize() - baselineSize to be < 0. This means I have no accurate way of determining how much data is actually queued in SDL's audio buffer queue. The SDL_GetQueuedAudioSize() documentation says: "This is the number of bytes that have been queued for playback with SDL_QueueAudio(), but have not yet been sent to the hardware." Yet, SDL_GetQueuedAudioSize() returns > 0 value when SDL_QueueAudio() has never been called. Based on that documentation, I believe the current behavior contradicts the documented behavior of this function and should be changed in line with Boris's patch. I understand that exposing the IAudioClient::GetCurrentPadding() value is useful, but a solution there needs to take into account what of that data is silence inserted by SDL and what is actual data queued by the user with SDL_QueueAudio(). Until that happens, I think the best approach is to remove the GetPendingBytes() call until SDL is able to keep track of queued data to make sense of it. This would make SDL_GetQueuedAudioSize() possible to use accurately with WASAPI. |
||
---|---|---|
.. | ||
alsa | ||
android | ||
arts | ||
coreaudio | ||
directsound | ||
disk | ||
dsp | ||
dummy | ||
emscripten | ||
esd | ||
fusionsound | ||
haiku | ||
jack | ||
nacl | ||
nas | ||
netbsd | ||
openslES | ||
paudio | ||
psp | ||
pulseaudio | ||
qsa | ||
sndio | ||
sun | ||
wasapi | ||
winmm | ||
SDL_audio.c | ||
SDL_audio_c.h | ||
SDL_audiocvt.c | ||
SDL_audiodev.c | ||
SDL_audiodev_c.h | ||
SDL_audiotypecvt.c | ||
SDL_mixer.c | ||
SDL_sysaudio.h | ||
SDL_wave.c | ||
SDL_wave.h |