From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 388C6C54EE9 for ; Tue, 27 Sep 2022 13:40:00 +0000 (UTC) Received: from localhost ([::1]:35670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odAoZ-0001sh-C1 for qemu-devel@archiver.kernel.org; Tue, 27 Sep 2022 09:39:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1od9Al-0002hF-UE for qemu-devel@nongnu.org; Tue, 27 Sep 2022 07:54:55 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]:41599) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1od9Ak-0006ZQ-6s for qemu-devel@nongnu.org; Tue, 27 Sep 2022 07:54:47 -0400 Received: by mail-lf1-x133.google.com with SMTP id u18so15296127lfo.8 for ; Tue, 27 Sep 2022 04:54:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=8ERAEHtpnEgI1uLahCRWvXr8msK7O+zoEEquDGYtYiI=; b=MeGF0mVwpMcWHUvWOJUh+ESqOqzrgD/mfDtWq8MJ4HsrCFg70DbLELrBicsk26K7aJ 0vPIny0kacB4YdvcXcgaEXLX3FX7cbcIlOWIk3T3v+dKwhZcx+nHVDjjy9840RHo9TyO tdlZwHmulg+rF3DukG2XL8Es6udqqbkkkouYR+vXEqDMZ5alNKvJ7LSz8mKUVUjig9P8 KEdFxiFawGVqS/KzruzwPwR4wOWvIHk7i/JsoWoHz9OMbolipATRsKHzwA5vNSKjQVUF MovT8SZvzFCLPjIpJX/tr1j1/hFNdnR59IqsJ6fu5G0vKwFZSNIbfh833jxCBX/2YQDI /pAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=8ERAEHtpnEgI1uLahCRWvXr8msK7O+zoEEquDGYtYiI=; b=dYmGKlNThHqzMxbMsSyo1GCfhm1cIj68q/6l2LnUfEDaGJjb6NMxpS2lUSIOyENrSc 3oEJ4FeDWK7ynEE4eTIJ0bOHOB81BjAUTbDfL/RoEXhyD6HfZFqtC25lJmmI7B0Wk/6S 9eVyp+/BYzBms02r4LbuH9/IOfoNOZ/VEjrF3tplVL7pATEW2Eib+goFGM0tGf1DaIog b0VHW7+JR3Ic79Su95Z5D5FXMCLTR1ri7yDfWPXvtqhBayafgFnxZ8ZyasZPzGWM9PXQ DKDEpZu+O/rk5JlH49v90wnwZaUTQxxKVR5lQQeentmmo2we7zSIR1vXeuRrbw1YE0MR jdJg== X-Gm-Message-State: ACrzQf2Y1gSJnBZu9wXHwQYfMu/LYw3iPjuijAXWerU9bkC1zjtgUUcl FWNHI7eo0df6R25xxfAEDosfvYOiTInpozSGTjM= X-Google-Smtp-Source: AMsMyM5nterRgGBW68nbY6DBucmzJjMuCeCTOwbtD+NuFV1sEGk05h48IFzaTslRtLuNEY5YNJ/dc87d6qQUcnSFwAQ= X-Received: by 2002:a05:6512:201b:b0:497:a29d:25c1 with SMTP id a27-20020a056512201b00b00497a29d25c1mr11538637lfb.276.1664279685498; Tue, 27 Sep 2022 04:54:45 -0700 (PDT) MIME-Version: 1.0 References: <38d7417a-fc26-be39-6a63-99c79ee15fc9@t-online.de> <20220923183640.8314-1-vr_qemu@t-online.de> In-Reply-To: <20220923183640.8314-1-vr_qemu@t-online.de> From: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Date: Tue, 27 Sep 2022 15:54:33 +0400 Message-ID: Subject: Re: [PATCH 01/12] audio: refactor code in audio_run_out() To: =?UTF-8?Q?Volker_R=C3=BCmelin?= Cc: Gerd Hoffmann , qemu-devel@nongnu.org Content-Type: multipart/alternative; boundary="000000000000760ca305e9a74f6f" Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=marcandre.lureau@gmail.com; helo=mail-lf1-x133.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --000000000000760ca305e9a74f6f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Sep 23, 2022 at 10:43 PM Volker R=C3=BCmelin = wrote: > Refactoring the code in audio_run_out() avoids code duplication > in the next patch. There's no functional change. > > Signed-off-by: Volker R=C3=BCmelin > Reviewed-by: Marc-Andr=C3=A9 Lureau > --- > audio/audio.c | 17 ++++++++--------- > 1 file changed, 8 insertions(+), 9 deletions(-) > > diff --git a/audio/audio.c b/audio/audio.c > index cfa4119c05..04f685fe24 100644 > --- a/audio/audio.c > +++ b/audio/audio.c > @@ -1121,8 +1121,12 @@ static void audio_run_out (AudioState *s) > HWVoiceOut *hw =3D NULL; > SWVoiceOut *sw; > > - if (!audio_get_pdo_out(s->dev)->mixing_engine) { > - while ((hw =3D audio_pcm_hw_find_any_enabled_out(s, hw))) { > + while ((hw =3D audio_pcm_hw_find_any_enabled_out(s, hw))) { > + size_t played, live, prev_rpos; > + size_t hw_free =3D audio_pcm_hw_get_free(hw); > + int nb_live; > + > + if (!audio_get_pdo_out(s->dev)->mixing_engine) { > /* there is exactly 1 sw for each hw with no mixeng */ > sw =3D hw->sw_head.lh_first; > > @@ -1137,14 +1141,9 @@ static void audio_run_out (AudioState *s) > if (sw->active) { > sw->callback.fn(sw->callback.opaque, INT_MAX); > } > - } > - return; > - } > > - while ((hw =3D audio_pcm_hw_find_any_enabled_out(s, hw))) { > - size_t played, live, prev_rpos; > - size_t hw_free =3D audio_pcm_hw_get_free(hw); > - int nb_live; > + continue; > + } > > for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next= ) { > if (sw->active) { > -- > 2.35.3 > > > --=20 Marc-Andr=C3=A9 Lureau --000000000000760ca305e9a74f6f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Fri, Sep 23, 2022 at 10:43 PM Volk= er R=C3=BCmelin <vr_qemu@t-online.de> wrote:
Refactoring the code in audio_run_out() avoids code du= plication
in the next patch. There's no functional change.

Signed-off-by: Volker R=C3=BCmelin <vr_qemu@t-online.de>

<= /div>
Reviewed-by: Marc-Andr=C3=A9 Lureau <marcandre.lureau@redhat.com>=

=C2=A0
---
=C2=A0audio/audio.c | 17 ++++++++---------
=C2=A01 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/audio/audio.c b/audio/audio.c
index cfa4119c05..04f685fe24 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1121,8 +1121,12 @@ static void audio_run_out (AudioState *s)
=C2=A0 =C2=A0 =C2=A0HWVoiceOut *hw =3D NULL;
=C2=A0 =C2=A0 =C2=A0SWVoiceOut *sw;

-=C2=A0 =C2=A0 if (!audio_get_pdo_out(s->dev)->mixing_engine) {
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 while ((hw =3D audio_pcm_hw_find_any_enabled_o= ut(s, hw))) {
+=C2=A0 =C2=A0 while ((hw =3D audio_pcm_hw_find_any_enabled_out(s, hw))) {<= br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 size_t played, live, prev_rpos;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 size_t hw_free =3D audio_pcm_hw_get_free(hw);<= br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 int nb_live;
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!audio_get_pdo_out(s->dev)->mixing_e= ngine) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* there is exactly 1 sw fo= r each hw with no mixeng */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sw =3D hw->sw_head.lh_fi= rst;

@@ -1137,14 +1141,9 @@ static void audio_run_out (AudioState *s)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (sw->active) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sw->callba= ck.fn(sw->callback.opaque, INT_MAX);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;
-=C2=A0 =C2=A0 }

-=C2=A0 =C2=A0 while ((hw =3D audio_pcm_hw_find_any_enabled_out(s, hw))) {<= br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 size_t played, live, prev_rpos;
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 size_t hw_free =3D audio_pcm_hw_get_free(hw);<= br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 int nb_live;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 continue;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 }

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for (sw =3D hw->sw_head.lh_first; sw; = sw =3D sw->entries.le_next) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (sw->active) {
--
2.35.3




--
Marc-Andr= =C3=A9 Lureau
--000000000000760ca305e9a74f6f--