From: Michael Walle <michael@walle.cc>
To: qemu-devel@nongnu.org
Cc: Michael Walle <michael@walle.cc>
Subject: [Qemu-devel] [PATCH] noaudio: correctly account acquired samples
Date: Tue, 4 Jan 2011 01:48:55 +0100 [thread overview]
Message-ID: <1294102135-14034-1-git-send-email-michael@walle.cc> (raw)
In-Reply-To: <201101032359.41230.michael@walle.cc>
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 <michael@walle.cc>
---
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
next prev parent reply other threads:[~2011-01-04 0:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-03 22:40 [Qemu-devel] [PATCH] noaudio: use audio_pcm_sw_read() in no_read() Michael Walle
2011-01-03 22:46 ` malc
2011-01-03 22:59 ` Michael Walle
2011-01-04 0:05 ` malc
2011-01-04 0:48 ` Michael Walle [this message]
2011-01-04 0:54 ` [Qemu-devel] [PATCH] noaudio: correctly account acquired samples malc
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=1294102135-14034-1-git-send-email-michael@walle.cc \
--to=michael@walle.cc \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).