From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=55527 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZv5V-0006Rh-Rn for qemu-devel@nongnu.org; Mon, 03 Jan 2011 19:49:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PZv5U-00085j-KQ for qemu-devel@nongnu.org; Mon, 03 Jan 2011 19:49:21 -0500 Received: from mail.serverraum.org ([78.47.150.89]:36954) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PZv5U-00085f-Cl for qemu-devel@nongnu.org; Mon, 03 Jan 2011 19:49:20 -0500 From: Michael Walle Date: Tue, 4 Jan 2011 01:48:55 +0100 Message-Id: <1294102135-14034-1-git-send-email-michael@walle.cc> In-Reply-To: <201101032359.41230.michael@walle.cc> References: <201101032359.41230.michael@walle.cc> Subject: [Qemu-devel] [PATCH] noaudio: correctly account acquired samples List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Michael Walle This will fix the return value of the function which otherwise returns too many samples because sw->total_hw_samples_acquired isn't correctly accounted. Signed-off-by: Michael Walle --- audio/noaudio.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/audio/noaudio.c b/audio/noaudio.c index 8015858..0304094 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -117,9 +117,12 @@ static int no_run_in (HWVoiceIn *hw) static int no_read (SWVoiceIn *sw, void *buf, int size) { + /* use custom code here instead of audio_pcm_sw_read() to avoid + * useless resampling/mixing */ 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); + sw->total_hw_samples_acquired += total; audio_pcm_info_clear_buf (&sw->info, buf, to_clear); return to_clear << sw->info.shift; } -- 1.7.2.3