All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Volker Rümelin" <vr_qemu@t-online.de>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [PATCH v2 14/15] paaudio: fix samples vs. frames mix-up
Date: Sat, 22 Jan 2022 13:57:44 +0100	[thread overview]
Message-ID: <20220122125745.5037-14-vr_qemu@t-online.de> (raw)
In-Reply-To: <addf2564-d61c-707e-ce5f-fb06264e7a39@t-online.de>

Now that the mixing buffer size no longer adds to playback
latency, fix the samples vs. frames mix-up in the mixing buffer
size calculation. This change will go largely unnoticed as long
as the user doesn't use a buffer-size smaller than timer-period.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
---
 audio/paaudio.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/audio/paaudio.c b/audio/paaudio.c
index d94f858ec7..a53ed85e0b 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -549,11 +549,8 @@ static int qpa_init_out(HWVoiceOut *hw, struct audsettings *as,
     }
 
     audio_pcm_init_info (&hw->info, &obt_as);
-    /*
-     * This is wrong. hw->samples counts in frames. hw->samples will be
-     * number of channels times larger than expected.
-     */
-    hw->samples = audio_buffer_samples(
+    /* hw->samples counts in frames */
+    hw->samples = audio_buffer_frames(
         qapi_AudiodevPaPerDirectionOptions_base(ppdo), &obt_as, 46440);
 
     return 0;
@@ -601,11 +598,8 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
     }
 
     audio_pcm_init_info (&hw->info, &obt_as);
-    /*
-     * This is wrong. hw->samples counts in frames. hw->samples will be
-     * number of channels times larger than expected.
-     */
-    hw->samples = audio_buffer_samples(
+    /* hw->samples counts in frames */
+    hw->samples = audio_buffer_frames(
         qapi_AudiodevPaPerDirectionOptions_base(ppdo), &obt_as, 46440);
 
     return 0;
-- 
2.31.1



  parent reply	other threads:[~2022-01-22 13:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-22 12:52 [PATCH v2 00/15] reduce audio playback latency Volker Rümelin
2022-01-22 12:57 ` [PATCH v2 01/15] audio: replace open-coded buffer arithmetic Volker Rümelin
2022-01-23 17:40   ` Christian Schoenebeck
2022-01-25 18:57     ` Volker Rümelin
2022-01-26  8:48       ` Gerd Hoffmann
2022-03-01 18:59         ` Volker Rümelin
2022-01-26 12:01       ` Christian Schoenebeck
2022-01-22 12:57 ` [PATCH v2 02/15] audio: move function audio_pcm_hw_clip_out() Volker Rümelin
2022-01-22 12:57 ` [PATCH v2 03/15] audio: add function audio_pcm_hw_conv_in() Volker Rümelin
2022-01-22 12:57 ` [PATCH v2 04/15] audio: inline function audio_pcm_sw_get_rpos_in() Volker Rümelin
2022-01-22 12:57 ` [PATCH v2 05/15] paaudio: increase default latency to 46ms Volker Rümelin
2022-01-22 12:57 ` [PATCH v2 06/15] jackaudio: use more jack audio buffers Volker Rümelin
2022-01-23 17:51   ` Christian Schoenebeck
2022-01-22 12:57 ` [PATCH v2 07/15] audio: copy playback stream in sequential order Volker Rümelin
2022-01-22 12:57 ` [PATCH v2 08/15] audio: add pcm_ops function table for capture backend Volker Rümelin
2022-01-22 12:57 ` [PATCH v2 09/15] Revert "audio: fix wavcapture segfault" Volker Rümelin
2022-01-22 12:57 ` [PATCH v2 10/15] audio: restore mixing-engine playback buffer size Volker Rümelin
2022-01-22 12:57 ` [PATCH v2 11/15] paaudio: reduce effective " Volker Rümelin
2022-01-22 12:57 ` [PATCH v2 12/15] dsoundaudio: " Volker Rümelin
2022-01-22 12:57 ` [PATCH v2 13/15] ossaudio: " Volker Rümelin
2022-01-22 12:57 ` Volker Rümelin [this message]
2022-01-22 12:57 ` [PATCH v2 15/15] sdlaudio: fix samples vs. frames mix-up Volker Rümelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220122125745.5037-14-vr_qemu@t-online.de \
    --to=vr_qemu@t-online.de \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.