summaryrefslogtreecommitdiff
path: root/audio/audio.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2009-05-12 12:02:38 +0100
committerPaul Brook <paul@codesourcery.com>2009-05-12 12:02:38 +0100
commit2fbb00c8115f709933ddecd16dda3a04a607bf78 (patch)
treed4b709ce317ced6e21ea29378d00a0b5dd6c6bf6 /audio/audio.c
parent35c605130ec52918d4e7b90d3c963313b7a8e8c6 (diff)
downloadqemu-2fbb00c8115f709933ddecd16dda3a04a607bf78.tar.gz
qemu-2fbb00c8115f709933ddecd16dda3a04a607bf78.tar.bz2
qemu-2fbb00c8115f709933ddecd16dda3a04a607bf78.zip
Make AUD_init failure fatal
Failure to initialize the audio subsystem is not handled consistently. Where it is handled it has guest visible effects, which is wrong. We already have a "nosound" audio driver as a last resort, so trying to proceed without an audio backend seems pointless. Also protect against multiple calls to AUD_init so that this can be pushed down into individual devices. Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'audio/audio.c')
-rw-r--r--audio/audio.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/audio/audio.c b/audio/audio.c
index 3c311d774a..84d9ae63cf 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1711,6 +1711,10 @@ AudioState *AUD_init (void)
const char *drvname;
AudioState *s = &glob_audio_state;
+ if (s->drv) {
+ return s;
+ }
+
LIST_INIT (&s->hw_head_out);
LIST_INIT (&s->hw_head_in);
LIST_INIT (&s->cap_head);
@@ -1718,8 +1722,7 @@ AudioState *AUD_init (void)
s->ts = qemu_new_timer (vm_clock, audio_timer, s);
if (!s->ts) {
- dolog ("Could not create audio timer\n");
- return NULL;
+ hw_error("Could not create audio timer\n");
}
audio_process_options ("AUDIO", audio_options);
@@ -1772,37 +1775,30 @@ AudioState *AUD_init (void)
if (!done) {
done = !audio_driver_init (s, &no_audio_driver);
if (!done) {
- dolog ("Could not initialize audio subsystem\n");
+ hw_error("Could not initialize audio subsystem\n");
}
else {
dolog ("warning: Using timer based audio emulation\n");
}
}
- if (done) {
- VMChangeStateEntry *e;
-
- if (conf.period.hertz <= 0) {
- if (conf.period.hertz < 0) {
- dolog ("warning: Timer period is negative - %d "
- "treating as zero\n",
- conf.period.hertz);
- }
- conf.period.ticks = 1;
- }
- else {
- conf.period.ticks = ticks_per_sec / conf.period.hertz;
- }
+ VMChangeStateEntry *e;
- e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s);
- if (!e) {
- dolog ("warning: Could not register change state handler\n"
- "(Audio can continue looping even after stopping the VM)\n");
+ if (conf.period.hertz <= 0) {
+ if (conf.period.hertz < 0) {
+ dolog ("warning: Timer period is negative - %d "
+ "treating as zero\n",
+ conf.period.hertz);
}
+ conf.period.ticks = 1;
+ } else {
+ conf.period.ticks = ticks_per_sec / conf.period.hertz;
}
- else {
- qemu_del_timer (s->ts);
- return NULL;
+
+ e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s);
+ if (!e) {
+ dolog ("warning: Could not register change state handler\n"
+ "(Audio can continue looping even after stopping the VM)\n");
}
LIST_INIT (&s->card_head);