Hi all,

When meet Overrun or Underrun, PA will increase watermark. Due to some
hardware limitation, the hw_ptr will not be updated in PA's request latency.
So there maybe some cases "faked overrun/underrun". Take capture for
example, when Pulseaudio was waken up to read new capture data from driver,
and find the "available" area is much more than the record space. Although
it's fast enough to read out all data in short time, PA regard that as
"overrun" and increase watermark/latency step by step, that's really
useless.

So attached patch used to avoid such case and only increase
watermark/latency in real "overrun" case.

--xingchao
From cc01b8a7f5bbb966faf1bfe0bae0368236850f97 Mon Sep 17 00:00:00 2001
From: xingchao <[email protected]>
Date: Thu, 21 Jul 2011 18:14:48 -0400
Subject: [PATCH] faked overrun case

For Firmware low rate hw_ptr update, and DMA buffer size limitation, when use
small buffer/latency size in PA, there're cases meeting faked "Underrun" and
"Overrun". In capture case, it's not necessary to increase watermark and
latency because PA's capable of reading more than fixed-buffer-size data in
short watermark period. For playback case, PA will ask for new data from APP,
so it's necessary to increase the watermark/latency even in such faked case.
---
 src/modules/alsa/alsa-source.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index b0b93e1..ca3a913 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -418,7 +418,10 @@ static size_t check_left_to_record(struct userdata *u, size_t n_bytes, pa_bool_t
 
     if (n_bytes <= rec_space)
         left_to_record = rec_space - n_bytes;
-    else {
+    else if (n_bytes < u->hwbuf_size) {
+		pa_log_debug("Need read more than %lu capture data", (n_bytes-rec_space));
+		return 0; 
+	} else {
 
         /* We got a dropout. What a mess! */
         left_to_record = 0;
-- 
1.7.1

_______________________________________________
pulseaudio-discuss mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to