mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
alsa: removed snd_pcm_wait() call before writing to playback device.
This would cause playback problems in certain situations, such as on the Raspberry Pi. The device that the wait was added for seems to not benefit from it in modern times, and standard desktop Linux seems to do the right thing when a USB device is unplugged now, without this patch. Fixes Bugzilla #3599.
This commit is contained in:
parent
569c222ca8
commit
93583d461c
@ -330,20 +330,7 @@ ALSA_PlayDevice(_THIS)
|
|||||||
this->hidden->swizzle_func(this, this->hidden->mixbuf, frames_left);
|
this->hidden->swizzle_func(this, this->hidden->mixbuf, frames_left);
|
||||||
|
|
||||||
while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) {
|
while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) {
|
||||||
int status;
|
int status = ALSA_snd_pcm_writei(this->hidden->pcm_handle,
|
||||||
|
|
||||||
/* 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,
|
|
||||||
sample_buf, frames_left);
|
sample_buf, frames_left);
|
||||||
|
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user