From nobody Tue Feb 10 01:32:31 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16414818481001002.0057009630692; Thu, 6 Jan 2022 07:10:48 -0800 (PST) Received: from localhost ([::1]:54166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5UPf-000361-35 for importer@patchew.org; Thu, 06 Jan 2022 10:10:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5P0B-0005p0-IC for qemu-devel@nongnu.org; Thu, 06 Jan 2022 04:24:07 -0500 Received: from mailout08.t-online.de ([194.25.134.20]:54212) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5P0A-0006Tp-3z for qemu-devel@nongnu.org; Thu, 06 Jan 2022 04:24:07 -0500 Received: from fwd84.dcpf.telekom.de (fwd84.aul.t-online.de [10.223.144.110]) by mailout08.t-online.de (Postfix) with SMTP id 5BD5319885; Thu, 6 Jan 2022 10:24:04 +0100 (CET) Received: from linpower.localnet ([46.86.48.20]) by fwd84.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1n5P08-4QSBRB0; Thu, 6 Jan 2022 10:24:04 +0100 Received: by linpower.localnet (Postfix, from userid 1000) id E97F720062F; Thu, 6 Jan 2022 10:23:32 +0100 (CET) From: =?UTF-8?q?Volker=20R=C3=BCmelin?= To: Gerd Hoffmann Subject: [PATCH 13/15] ossaudio: reduce effective playback buffer size Date: Thu, 6 Jan 2022 10:23:30 +0100 Message-Id: <20220106092332.7223-13-volker.ruemelin@t-online.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TOI-EXPURGATEID: 150726::1641461044-00009E39-833AC0D4/0/0 CLEAN NORMAL X-TOI-MSGID: 95f836ff-458f-440d-a398-812bc48bdbac Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=194.25.134.20; envelope-from=volker.ruemelin@t-online.de; helo=mailout08.t-online.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 06 Jan 2022 10:04:59 -0500 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: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1641481848759100004 From: Volker R=C3=BCmelin Add the buffer_get_free pcm_ops function for the mmapped case to reduce the effective playback buffer size. All intermediate audio playback buffers become temporary buffers. Signed-off-by: Volker R=C3=BCmelin --- audio/ossaudio.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/audio/ossaudio.c b/audio/ossaudio.c index 1bd6800840..da9c232222 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -394,7 +394,7 @@ static size_t oss_buffer_get_free(HWVoiceOut *hw) OSSVoiceOut *oss =3D (OSSVoiceOut *)hw; =20 if (oss->mmapped) { - return INT_MAX; + return oss_get_available_bytes(oss); } else { return audio_generic_buffer_get_free(hw); } @@ -402,9 +402,10 @@ static size_t oss_buffer_get_free(HWVoiceOut *hw) =20 static void *oss_get_buffer_out(HWVoiceOut *hw, size_t *size) { - OSSVoiceOut *oss =3D (OSSVoiceOut *) hw; + OSSVoiceOut *oss =3D (OSSVoiceOut *)hw; + if (oss->mmapped) { - *size =3D MIN(oss_get_available_bytes(oss), hw->size_emul - hw->po= s_emul); + *size =3D hw->size_emul - hw->pos_emul; return hw->buf_emul + hw->pos_emul; } else { return audio_generic_get_buffer_out(hw, size); --=20 2.31.1