From patchwork Thu Dec 19 20:02:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Volker_R=C3=BCmelin?= X-Patchwork-Id: 1213684 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=t-online.de 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 ozlabs.org (Postfix) with ESMTPS id 47f2qY1C0Gz9sPJ for ; Fri, 20 Dec 2019 07:03:04 +1100 (AEDT) Received: from localhost ([::1]:47302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii20k-0007Vm-Nw for incoming@patchwork.ozlabs.org; Thu, 19 Dec 2019 15:03:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42984) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii20R-0007T8-OW for qemu-devel@nongnu.org; Thu, 19 Dec 2019 15:02:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii20Q-0002uM-Gp for qemu-devel@nongnu.org; Thu, 19 Dec 2019 15:02:43 -0500 Received: from mailout07.t-online.de ([194.25.134.83]:43240) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii20Q-0002l0-9L for qemu-devel@nongnu.org; Thu, 19 Dec 2019 15:02:42 -0500 Received: from fwd17.aul.t-online.de (fwd17.aul.t-online.de [172.20.27.64]) by mailout07.t-online.de (Postfix) with SMTP id 0494D424FF80; Thu, 19 Dec 2019 21:02:40 +0100 (CET) Received: from [192.168.211.200] (ZZRWJ-ZBghl4kMXOpLip6IQ485LcTk0fXQ4pIegyr19fKWnM8Q74G5VZ5xn+AbhQIW@[46.86.55.2]) by fwd17.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1ii20N-1kl7J20; Thu, 19 Dec 2019 21:02:39 +0100 Subject: [PATCH 1/5] hda-codec: fix playback rate control From: =?utf-8?q?Volker_R=C3=BCmelin?= To: Gerd Hoffmann References: Message-ID: <494a02d8-c4de-958a-6fd6-c6df95943293@t-online.de> Date: Thu, 19 Dec 2019 21:02:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: Content-Language: de-DE X-ID: ZZRWJ-ZBghl4kMXOpLip6IQ485LcTk0fXQ4pIegyr19fKWnM8Q74G5VZ5xn+AbhQIW X-TOI-MSGID: 0662df15-6a1c-4f08-87c5-9098d0c10c74 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 194.25.134.83 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU , =?utf-8?b?Wm9sdMOhbiBLxZF2w6Fnw7M=?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since commit 1930616b98 "audio: make mixeng optional" the function hda_audio_output_cb can no longer assume the function parameter avail contains the free buffer size. With the playback mixing-engine turned off this leads to a broken playback rate control and playback buffer drops in regular intervals. This patch moves down the rate calculation, so the correct buffer fill level is used for the calculation. Signed-off-by: Volker RĂ¼melin --- hw/audio/hda-codec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index f17e8d8dce..768ba31e79 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -338,8 +338,6 @@ static void hda_audio_output_cb(void *opaque, int avail) return; } - hda_timer_sync_adjust(st, (wpos - rpos) - to_transfer - (B_SIZE >> 1)); - while (to_transfer) { uint32_t start = (uint32_t) (rpos & B_MASK); uint32_t chunk = (uint32_t) MIN(B_SIZE - start, to_transfer); @@ -351,6 +349,8 @@ static void hda_audio_output_cb(void *opaque, int avail) break; } } + + hda_timer_sync_adjust(st, (wpos - rpos) - (B_SIZE >> 1)); } static void hda_audio_compat_input_cb(void *opaque, int avail)