Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K59Nw-00082S-E2 for qemu-devel@nongnu.org; Sat, 07 Jun 2008 21:07:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K59Nu-000817-Q1 for qemu-devel@nongnu.org; Sat, 07 Jun 2008 21:07:51 -0400 Received: from [199.232.76.173] (port=41713 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K59Nu-000814-LQ for qemu-devel@nongnu.org; Sat, 07 Jun 2008 21:07:50 -0400 Received: from savannah.gnu.org ([199.232.41.3]:34991 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K59Nu-0002b6-TD for qemu-devel@nongnu.org; Sat, 07 Jun 2008 21:07:51 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1K59Ns-0005QU-Pv for qemu-devel@nongnu.org; Sun, 08 Jun 2008 01:07:48 +0000 Received: from malc by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1K59Ns-0005QQ-Ez for qemu-devel@nongnu.org; Sun, 08 Jun 2008 01:07:48 +0000 MIME-Version: 1.0 Errors-To: malc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: malc Message-Id: Date: Sun, 08 Jun 2008 01:07:48 +0000 Subject: [Qemu-devel] [4694] Do not scare users with ominous error messages from AUD_open* Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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) {