Fixed blocking open bug when using blocking audio writes
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%4097
This commit is contained in:
parent
503838661e
commit
c8f2e030dc
1 changed files with 12 additions and 4 deletions
|
@ -58,11 +58,7 @@ static char rcsid =
|
||||||
|
|
||||||
/* Open the audio device for playback, and don't block if busy */
|
/* Open the audio device for playback, and don't block if busy */
|
||||||
#define USE_BLOCKING_WRITES
|
#define USE_BLOCKING_WRITES
|
||||||
#ifdef USE_BLOCKING_WRITES
|
|
||||||
#define OPEN_FLAGS O_WRONLY
|
|
||||||
#else
|
|
||||||
#define OPEN_FLAGS (O_WRONLY|O_NONBLOCK)
|
#define OPEN_FLAGS (O_WRONLY|O_NONBLOCK)
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Audio driver functions */
|
/* Audio driver functions */
|
||||||
static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec);
|
static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec);
|
||||||
|
@ -339,6 +335,18 @@ static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
||||||
}
|
}
|
||||||
mixbuf = NULL;
|
mixbuf = NULL;
|
||||||
|
|
||||||
|
#ifdef USE_BLOCKING_WRITES
|
||||||
|
/* Make the file descriptor use blocking writes with fcntl() */
|
||||||
|
{ long flags;
|
||||||
|
flags = fcntl(audio_fd, F_GETFL);
|
||||||
|
flags &= ~O_NONBLOCK;
|
||||||
|
if ( fcntl(audio_fd, F_SETFL, flags) < 0 ) {
|
||||||
|
SDL_SetError("Couldn't set audio blocking mode");
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Get a list of supported hardware formats */
|
/* Get a list of supported hardware formats */
|
||||||
if ( ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0 ) {
|
if ( ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0 ) {
|
||||||
SDL_SetError("Couldn't get audio format list");
|
SDL_SetError("Couldn't get audio format list");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue