|
@@ -27,6 +27,7 @@
|
|
|
#include "SDL_audio_c.h"
|
|
|
#include "SDL_audiomem.h"
|
|
|
#include "SDL_sysaudio.h"
|
|
|
+#include "../thread/SDL_systhread.h"
|
|
|
|
|
|
#define _THIS SDL_AudioDevice *_this
|
|
|
|
|
@@ -1191,19 +1192,15 @@ open_audio_device(const char *devname, int iscapture,
|
|
|
/* Start the audio thread if necessary */
|
|
|
if (!current_audio.impl.ProvidesOwnCallbackThread) {
|
|
|
/* Start the audio thread */
|
|
|
+
|
|
|
+ /* !!! FIXME: we don't force the audio thread stack size here because it calls into user code, but maybe we should? */
|
|
|
+ /* buffer queueing callback only needs a few bytes, so make the stack tiny. */
|
|
|
char name[64];
|
|
|
+ const size_t stacksize = (device->spec.callback == SDL_BufferQueueDrainCallback) ? 64 * 1024 : 0;
|
|
|
+
|
|
|
SDL_snprintf(name, sizeof (name), "SDLAudioDev%d", (int) device->id);
|
|
|
-/* !!! FIXME: this is nasty. */
|
|
|
-#if defined(__WIN32__) && !defined(HAVE_LIBC)
|
|
|
-#undef SDL_CreateThread
|
|
|
-#if SDL_DYNAMIC_API
|
|
|
- device->thread = SDL_CreateThread_REAL(SDL_RunAudio, name, device, NULL, NULL);
|
|
|
-#else
|
|
|
- device->thread = SDL_CreateThread(SDL_RunAudio, name, device, NULL, NULL);
|
|
|
-#endif
|
|
|
-#else
|
|
|
- device->thread = SDL_CreateThread(SDL_RunAudio, name, device);
|
|
|
-#endif
|
|
|
+ device->thread = SDL_CreateThreadInternal(SDL_RunAudio, name, stacksize, device);
|
|
|
+
|
|
|
if (device->thread == NULL) {
|
|
|
SDL_CloseAudioDevice(device->id);
|
|
|
SDL_SetError("Couldn't create audio thread");
|