From ebfc9cfa450d20f93b476c8e4ae8f352cfea5f97 Mon Sep 17 00:00:00 2001 From: Jools Wills Date: Thu, 2 Mar 2017 18:03:00 +0000 Subject: [PATCH] Revert "Work-around for a hang when USB devices are unplugged, contributed by James Zipperer" Fixes stuttering on coolcv This reverts commit f0a9a821497b8e9d3e2496a5c5ab844cdddc5e4c. --- src/audio/alsa/SDL_alsa_audio.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c index 574d51bd5..3fdbd820a 100644 --- a/src/audio/alsa/SDL_alsa_audio.c +++ b/src/audio/alsa/SDL_alsa_audio.c @@ -314,20 +314,9 @@ ALSA_PlayDevice(_THIS) swizzle_alsa_channels(this, this->hidden->mixbuf, frames_left); while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) { - int status; - - /* This wait is a work-around for a hang when USB devices are - unplugged. Normally it should not result in any waiting, - but in the case of a USB unplug, it serves as a way to - join the playback thread after the timeout occurs */ - status = ALSA_snd_pcm_wait(this->hidden->pcm_handle, 1000); - if (status == 0) { - /*fprintf(stderr, "ALSA timeout waiting for available buffer space\n");*/ - SDL_OpenedAudioDeviceDisconnected(this); - return; - } - - status = ALSA_snd_pcm_writei(this->hidden->pcm_handle, + /* !!! FIXME: This works, but needs more testing before going live */ + /* ALSA_snd_pcm_wait(this->hidden->pcm_handle, -1); */ + int status = ALSA_snd_pcm_writei(this->hidden->pcm_handle, sample_buf, frames_left); if (status < 0) {