[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/20] sdlaudio: do not allow multiple instances
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 13/20] sdlaudio: do not allow multiple instances |
Date: |
Mon, 15 Jun 2015 14:28:04 +0200 |
From: Kővágó, Zoltán <address@hidden>
Since SDL uses a lot of global data, we can't create independent
instances of sdl audio backend.
Signed-off-by: Kővágó, Zoltán <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
audio/sdlaudio.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c
index b95a7e0..1140f2e 100644
--- a/audio/sdlaudio.c
+++ b/audio/sdlaudio.c
@@ -55,6 +55,7 @@ static struct SDLAudioState {
SDL_mutex *mutex;
SDL_sem *sem;
int initialized;
+ bool driver_created;
} glob_sdl;
typedef struct SDLAudioState SDLAudioState;
@@ -393,6 +394,10 @@ static int sdl_ctl_out (HWVoiceOut *hw, int cmd, ...)
static void *sdl_audio_init (void)
{
SDLAudioState *s = &glob_sdl;
+ if (s->driver_created) {
+ sdl_logerr("Can't create multiple sdl backends\n");
+ return NULL;
+ }
if (SDL_InitSubSystem (SDL_INIT_AUDIO)) {
sdl_logerr ("SDL failed to initialize audio subsystem\n");
@@ -414,6 +419,7 @@ static void *sdl_audio_init (void)
return NULL;
}
+ s->driver_created = true;
return s;
}
@@ -424,6 +430,7 @@ static void sdl_audio_fini (void *opaque)
SDL_DestroySemaphore (s->sem);
SDL_DestroyMutex (s->mutex);
SDL_QuitSubSystem (SDL_INIT_AUDIO);
+ s->driver_created = false;
}
static struct audio_option sdl_options[] = {
--
1.8.3.1
- [Qemu-devel] [PULL 00/20] audio patch queue, Gerd Hoffmann, 2015/06/15
- [Qemu-devel] [PULL 04/20] only enable dsound in case the header file is present, Gerd Hoffmann, 2015/06/15
- [Qemu-devel] [PULL 10/20] paaudio: fix possible resource leak, Gerd Hoffmann, 2015/06/15
- [Qemu-devel] [PULL 13/20] sdlaudio: do not allow multiple instances,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 14/20] MAINTAINERS: remove malc from audio, Gerd Hoffmann, 2015/06/15
- [Qemu-devel] [PULL 09/20] wavaudio: do not use global variables, Gerd Hoffmann, 2015/06/15
- [Qemu-devel] [PULL 12/20] coreaudio: do not use global variables where possible, Gerd Hoffmann, 2015/06/15
- [Qemu-devel] [PULL 15/20] audio: remove LOG_TO_MONITOR along with default_mon, Gerd Hoffmann, 2015/06/15
- [Qemu-devel] [PULL 03/20] audio: remove winwave audio driver, Gerd Hoffmann, 2015/06/15
- [Qemu-devel] [PULL 08/20] ossaudio: do not use global variables, Gerd Hoffmann, 2015/06/15
- [Qemu-devel] [PULL 16/20] audio: remove plive, Gerd Hoffmann, 2015/06/15
- [Qemu-devel] [PULL 06/20] paaudio: do not use global variables, Gerd Hoffmann, 2015/06/15
- [Qemu-devel] [PULL 02/20] audio: remove fmod backend, Gerd Hoffmann, 2015/06/15
- [Qemu-devel] [PULL 01/20] audio: remove esd backend, Gerd Hoffmann, 2015/06/15