[pulseaudio-discuss] [PATCH v2 3/4] padsp: Handle holes in recording streams.

Tanu Kaskinen tanuk at iki.fi
Wed Nov 7 06:52:39 PST 2012


---
 src/utils/padsp.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/utils/padsp.c b/src/utils/padsp.c
index f6a3520..858cec8 100644
--- a/src/utils/padsp.c
+++ b/src/utils/padsp.c
@@ -922,9 +922,22 @@ static int fd_info_copy_data(fd_info *i, int force) {
                 return -1;
             }
 
-            if (!data)
+            if (len <= 0)
                 break;
 
+            if (!data) {
+                /* Maybe we should generate silence here, but I'm lazy and
+                 * I'll just skip any holes in the stream. */
+                if (pa_stream_drop(i->rec_stream) < 0) {
+                    debug(DEBUG_LEVEL_NORMAL, __FILE__": pa_stream_drop(): %s\n", pa_strerror(pa_context_errno(i->context)));
+                    return -1;
+                }
+
+                assert(n >= len);
+                n -= len;
+                continue;
+            }
+
             buf = (const char*)data + i->rec_offset;
 
             if ((r = write(i->thread_fd, buf, len - i->rec_offset)) <= 0) {
-- 
1.7.10.4



More information about the pulseaudio-discuss mailing list