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 @@ -1298,7 +1298,11 @@ void SDL_PlaybackAudioThreadShutdown(SDL_AudioDevice *device)
12981298 const int frames = device -> buffer_size / SDL_AUDIO_FRAMESIZE (device -> spec );
12991299 // Wait for the audio to drain if device didn't die.
13001300 if (!SDL_GetAtomicInt (& device -> zombie )) {
1301- SDL_Delay (((frames * 1000 ) / device -> spec .freq ) * 2 );
1301+ int delay = ((frames * 1000 ) / device -> spec .freq ) * 2 ;
1302+ if (delay > 100 ) {
1303+ delay = 100 ;
1304+ }
1305+ SDL_Delay (delay );
13021306 }
13031307 current_audio .impl .ThreadDeinit (device );
13041308 SDL_AudioThreadFinalize (device );
Original file line number Diff line number Diff line change @@ -485,7 +485,11 @@ static void ALSA_CloseDevice(SDL_AudioDevice *device)
485485 if (device -> hidden ) {
486486 if (device -> hidden -> pcm ) {
487487 // Wait for the submitted audio to drain. ALSA_snd_pcm_drop() can hang, so don't use that.
488- SDL_Delay (((device -> sample_frames * 1000 ) / device -> spec .freq ) * 2 );
488+ int delay = ((device -> sample_frames * 1000 ) / device -> spec .freq ) * 2 ;
489+ if (delay > 100 ) {
490+ delay = 100 ;
491+ }
492+ SDL_Delay (delay );
489493 ALSA_snd_pcm_close (device -> hidden -> pcm );
490494 }
491495 SDL_free (device -> hidden -> mixbuf );
You can’t perform that action at this time.
0 commit comments