mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-11 09:01:40 +00:00
wasapi: Deal with device buffer sizes changing.
Otherwise, it would fill the previous size's worth of data into the current
size's buffer.
Fixes #11122.
(cherry picked from commit 5b0e838a74)
This commit is contained in:
parent
f170ced2a7
commit
cc2352f842
1 changed files with 6 additions and 0 deletions
|
|
@ -111,6 +111,12 @@ static int UpdateAudioStream(_THIS, const SDL_AudioSpec *oldspec)
|
|||
}
|
||||
}
|
||||
|
||||
/* if the device sample size changed, make sure we're asking for enough data. */
|
||||
if (this->callbackspec.samples != this->spec.samples) {
|
||||
this->callbackspec.samples = this->spec.samples;
|
||||
SDL_CalculateAudioSpec(&this->callbackspec);
|
||||
}
|
||||
|
||||
/* make sure our scratch buffer can cover the new device spec. */
|
||||
if (this->spec.size > this->work_buffer_len) {
|
||||
Uint8 *ptr = (Uint8 *)SDL_realloc(this->work_buffer, this->spec.size);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue