From 67766785a587ead4bf604ae789bc1112783ad97c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 24 Jun 2007 16:17:30 +0000 Subject: [PATCH] Limit silence buffer size for pa_sink_render() git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1498 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/sink.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index 11effe2..d5ca061 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -46,6 +46,7 @@ #include "sink.h" #define MAX_MIX_CHANNELS 32 +#define SILENCE_BUFFER_LENGTH (64*1024) static PA_DEFINE_CHECK_TYPE(pa_sink, sink_check_type, pa_msgobject_check_type); @@ -364,6 +365,9 @@ void pa_sink_render(pa_sink*s, size_t length, pa_memchunk *result) { if (n == 0) { + if (length > SILENCE_BUFFER_LENGTH) + length = SILENCE_BUFFER_LENGTH; + if (!s->silence || pa_memblock_get_length(s->silence) < length) { if (s->silence) pa_memblock_unref(s->silence); -- 2.7.4