From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mt8ar-0006Gs-9I for qemu-devel@nongnu.org; Wed, 30 Sep 2009 19:28:21 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mt8aq-0006GL-En for qemu-devel@nongnu.org; Wed, 30 Sep 2009 19:28:20 -0400 Received: from [199.232.76.173] (port=55561 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mt8aq-0006GC-7L for qemu-devel@nongnu.org; Wed, 30 Sep 2009 19:28:20 -0400 Received: from fe01x03-cgp.akado.ru ([77.232.31.164]:55090 helo=akado.ru) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mt8ap-0000o9-QY for qemu-devel@nongnu.org; Wed, 30 Sep 2009 19:28:20 -0400 Date: Thu, 1 Oct 2009 03:28:23 +0400 (MSD) From: malc Subject: Re: [Qemu-devel] Questions on audio_atexit(), possibly bugs In-Reply-To: <871vlo9gz5.fsf@pike.pond.sub.org> Message-ID: References: <87y6nw9koq.fsf@pike.pond.sub.org> <871vlo9gz5.fsf@pike.pond.sub.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org On Thu, 1 Oct 2009, Markus Armbruster wrote: > malc writes: > > > On Wed, 30 Sep 2009, Markus Armbruster wrote: > > [..snip..] > >> > >> Unrelated, but nearby: audio_vm_change_state_handler() calls the > >> ctl_out() callback with three arguments: > >> > >> hwo->pcm_ops->ctl_out (hwo, op, conf.try_poll_out); > >> > >> (op is either VOICE_ENABLE or VOICE_DISABLE here), while audio_atexit() > >> calls it with two: > >> > >> hwo->pcm_ops->ctl_out (hwo, VOICE_DISABLE); > >> > >> Same for ctl_in(). Doesn't look kosher. A quick check of oss_ctl_out() > >> and oss_ctl_in() shows use of three parameters. > > > > Yes, not kosher, but harmless, conf.try_poll_out is only applicable to > > VOICE_ENABLE and is simply ignored by the handler of VOICE_DISABLE, this > > is a vararg function, so it's okay, though i'd probably change this to > > avoid further confusion. > > Appreciated. > Just coded it and not sure whether it's worth it, what say you? audio.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 80a717b..977261c 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1739,15 +1739,24 @@ static void audio_vm_change_state_handler (void *opaque, int running, AudioState *s = opaque; HWVoiceOut *hwo = NULL; HWVoiceIn *hwi = NULL; - int op = running ? VOICE_ENABLE : VOICE_DISABLE; s->vm_running = running; while ((hwo = audio_pcm_hw_find_any_enabled_out (hwo))) { - hwo->pcm_ops->ctl_out (hwo, op, conf.try_poll_out); + if (running) { + hwo->pcm_ops->ctl_out (hwo, VOICE_ENABLE, conf.try_poll_out); + } + else { + hwo->pcm_ops->ctl_out (hwo, VOICE_DISABLE); + } } while ((hwi = audio_pcm_hw_find_any_enabled_in (hwi))) { - hwi->pcm_ops->ctl_in (hwi, op, conf.try_poll_in); + if (running) { + hwi->pcm_ops->ctl_in (hwi, VOICE_ENABLE, conf.try_poll_in); + } + else { + hwi->pcm_ops->ctl_in (hwi, VOICE_DISABLE); + } } audio_reset_timer (); } -- mailto:av1474@comtv.ru