diff options
author | malc <malc@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-06-08 01:07:48 +0000 |
---|---|---|
committer | malc <malc@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-06-08 01:07:48 +0000 |
commit | 2c44375d649910677dd9cdcf170f4dbaafa3f193 (patch) | |
tree | d2db679af92b263e9c6d81b071a8ad2b7f2687df /hw/ac97.c | |
parent | d865bab55244797cce4f67a2a8196cbb0ceabc47 (diff) |
Do not scare users with ominous error messages from AUD_open*
Apparently Windows Server 2003 sets the frequency for either mc or pi
voice to zero, which in turn triggers a call to audio_bug from this
chain:
open_voice -> AUD_open_in -> audio_bug (audio_validate_settings):
A bug was just triggered in AUD_open_in
...
Context:
audio: frequency=0 nchannels=2 fmt=S16 endianness=little
But since no attempt by the said OS is made to actually use the voice
with zero frequency this can be considered normal behavior.
Hence if zero freqency situation is encountered - close current voice,
and make noises if the guest tries to use it.
Reported by simon@...ve
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4694 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/ac97.c')
-rw-r--r-- | hw/ac97.c | 91 |
1 files changed, 60 insertions, 31 deletions
@@ -158,6 +158,7 @@ typedef struct AC97LinkState { SWVoiceIn *voice_pi; SWVoiceOut *voice_po; SWVoiceIn *voice_mc; + int invalid_freq[3]; uint8_t silence[128]; uint32_t base[2]; int bup_flag; @@ -360,39 +361,61 @@ static void open_voice (AC97LinkState *s, int index, int freq) as.fmt = AUD_FMT_S16; as.endianness = 0; - switch (index) { - case PI_INDEX: - s->voice_pi = AUD_open_in ( - &s->card, - s->voice_pi, - "ac97.pi", - s, - pi_callback, - &as - ); - break; + if (freq > 0) { + s->invalid_freq[index] = 0; + switch (index) { + case PI_INDEX: + s->voice_pi = AUD_open_in ( + &s->card, + s->voice_pi, + "ac97.pi", + s, + pi_callback, + &as + ); + break; - case PO_INDEX: - s->voice_po = AUD_open_out ( - &s->card, - s->voice_po, - "ac97.po", - s, - po_callback, - &as - ); - break; + case PO_INDEX: + s->voice_po = AUD_open_out ( + &s->card, + s->voice_po, + "ac97.po", + s, + po_callback, + &as + ); + break; - case MC_INDEX: - s->voice_mc = AUD_open_in ( - &s->card, - s->voice_mc, - "ac97.mc", - s, - mc_callback, - &as - ); - break; + case MC_INDEX: + s->voice_mc = AUD_open_in ( + &s->card, + s->voice_mc, + "ac97.mc", + s, + mc_callback, + &as + ); + break; + } + } + else { + s->invalid_freq[index] = freq; + switch (index) { + case PI_INDEX: + AUD_close_in (&s->card, s->voice_pi); + s->voice_pi = NULL; + break; + + case PO_INDEX: + AUD_close_out (&s->card, s->voice_po); + s->voice_po = NULL; + break; + + case MC_INDEX: + AUD_close_in (&s->card, s->voice_mc); + s->voice_mc = NULL; + break; + } } } @@ -1065,6 +1088,12 @@ static void transfer_audio (AC97LinkState *s, int index, int elapsed) AC97BusMasterRegs *r = &s->bm_regs[index]; int written = 0, stop = 0; + if (s->invalid_freq[index]) { + AUD_log ("ac97", "attempt to use voice %d with invalid frequency %d\n", + index, s->invalid_freq[index]); + return; + } + if (r->sr & SR_DCH) { if (r->cr & CR_RPBM) { switch (index) { |