* [Qemu-devel] [4694] Do not scare users with ominous error messages from AUD_open*
@ 2008-06-08 1:07 malc
0 siblings, 0 replies; only message in thread
From: malc @ 2008-06-08 1:07 UTC (permalink / raw)
To: qemu-devel
Revision: 4694
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4694
Author: malc
Date: 2008-06-08 01:07:48 +0000 (Sun, 08 Jun 2008)
Log Message:
-----------
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
Modified Paths:
--------------
trunk/hw/ac97.c
Modified: trunk/hw/ac97.c
===================================================================
--- trunk/hw/ac97.c 2008-06-07 22:12:17 UTC (rev 4693)
+++ trunk/hw/ac97.c 2008-06-08 01:07:48 UTC (rev 4694)
@@ -158,6 +158,7 @@
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,40 +361,62 @@
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;
+ }
+ }
}
static void reset_voices (AC97LinkState *s, uint8_t active[LAST_INDEX])
@@ -1065,6 +1088,12 @@
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) {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-06-08 1:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-08 1:07 [Qemu-devel] [4694] Do not scare users with ominous error messages from AUD_open* malc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).