qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] noaudio: use audio_pcm_sw_read() in no_read()


From: Michael Walle
Subject: [Qemu-devel] [PATCH] noaudio: use audio_pcm_sw_read() in no_read()
Date: Mon, 3 Jan 2011 23:40:04 +0100

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 <address@hidden>
---
 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, ...)
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]