From patchwork Mon Jan 3 22:40:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 77351 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8285BB70DA for ; Tue, 4 Jan 2011 09:41:32 +1100 (EST) Received: from localhost ([127.0.0.1]:52434 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZt5k-0003HH-QE for incoming@patchwork.ozlabs.org; Mon, 03 Jan 2011 17:41:28 -0500 Received: from [140.186.70.92] (port=49931 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZt4f-0003CE-K3 for qemu-devel@nongnu.org; Mon, 03 Jan 2011 17:40:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PZt4d-0004ga-RR for qemu-devel@nongnu.org; Mon, 03 Jan 2011 17:40:21 -0500 Received: from mail.serverraum.org ([78.47.150.89]:44144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PZt4d-0004fS-Ko for qemu-devel@nongnu.org; Mon, 03 Jan 2011 17:40:19 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.serverraum.org (Postfix) with ESMTP id 4772A3EEF9; Mon, 3 Jan 2011 23:40:17 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.serverraum.org Received: from mail.serverraum.org ([127.0.0.1]) by localhost (web.serverraum.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KF+JZz6Og-Bv; Mon, 3 Jan 2011 23:40:17 +0100 (CET) Received: from thanatos.fritz.box (77-22-60-162-dynip.superkabel.de [77.22.60.162]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.serverraum.org (Postfix) with ESMTPSA id 234CF3EEF8; Mon, 3 Jan 2011 23:40:15 +0100 (CET) From: Michael Walle To: qemu-devel@nongnu.org Date: Mon, 3 Jan 2011 23:40:04 +0100 Message-Id: <1294094404-20397-1-git-send-email-michael@walle.cc> X-Mailer: git-send-email 1.7.2.3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Michael Walle Subject: [Qemu-devel] [PATCH] noaudio: use audio_pcm_sw_read() in no_read() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Instead of returning a self-calculated empty buffer use the proper method supplied by the audio subsystem. This will fix the return value of the no_read() function which otherwise returns too many samples because total_hw_samples_acquired isn't correctly accounted. Signed-off-by: Michael Walle --- audio/noaudio.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/audio/noaudio.c b/audio/noaudio.c index 8015858..e720327 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -117,11 +117,7 @@ static int no_run_in (HWVoiceIn *hw) static int no_read (SWVoiceIn *sw, void *buf, int size) { - int samples = size >> sw->info.shift; - int total = sw->hw->total_samples_captured - sw->total_hw_samples_acquired; - int to_clear = audio_MIN (samples, total); - audio_pcm_info_clear_buf (&sw->info, buf, to_clear); - return to_clear << sw->info.shift; + return audio_pcm_sw_read (sw, buf, size); } static int no_ctl_in (HWVoiceIn *hw, int cmd, ...)