File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1254,7 +1254,11 @@ void SDL_PlaybackAudioThreadShutdown(SDL_AudioDevice *device)
12541254 const int frames = device -> buffer_size / SDL_AUDIO_FRAMESIZE (device -> spec );
12551255 // Wait for the audio to drain if device didn't die.
12561256 if (!SDL_GetAtomicInt (& device -> zombie )) {
1257- SDL_Delay (((frames * 1000 ) / device -> spec .freq ) * 2 );
1257+ int delay = ((frames * 1000 ) / device -> spec .freq ) * 2 ;
1258+ if (delay > 100 ) {
1259+ delay = 100 ;
1260+ }
1261+ SDL_Delay (delay );
12581262 }
12591263 current_audio .impl .ThreadDeinit (device );
12601264 SDL_AudioThreadFinalize (device );
Original file line number Diff line number Diff line change @@ -462,7 +462,11 @@ static void ALSA_CloseDevice(SDL_AudioDevice *device)
462462 if (device -> hidden ) {
463463 if (device -> hidden -> pcm ) {
464464 // Wait for the submitted audio to drain. ALSA_snd_pcm_drop() can hang, so don't use that.
465- SDL_Delay (((device -> sample_frames * 1000 ) / device -> spec .freq ) * 2 );
465+ int delay = ((device -> sample_frames * 1000 ) / device -> spec .freq ) * 2 ;
466+ if (delay > 100 ) {
467+ delay = 100 ;
468+ }
469+ SDL_Delay (delay );
466470 ALSA_snd_pcm_close (device -> hidden -> pcm );
467471 }
468472 SDL_free (device -> hidden -> mixbuf );
You can’t perform that action at this time.
0 commit comments