From 4cab0a7242eec2907810b33eca409069d247842a Mon Sep 17 00:00:00 2001 From: liaohanqin Date: Fri, 9 Sep 2022 10:25:58 +0800 Subject: [PATCH] fix(audio): Only drop the stream when there is a hole (length > 0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NULL data means either a hole or empty buffer. Only drop the stream when there is a hole (length > 0) Log: Task: https://pms.uniontech.com/task-view-98970.html Influence: 声音 Change-Id: I3183c816e4431163b959c5353c930464eb470b2a --- pulse/meter.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pulse/meter.c b/pulse/meter.c index d2d10e1b..91cc8537 100644 --- a/pulse/meter.c +++ b/pulse/meter.c @@ -40,7 +40,10 @@ static void read_callback(pa_stream *s, size_t length, void *userdata) { } if (!data) { - pa_stream_drop(s); + /* NULL data means either a hole or empty buffer. + * Only drop the stream when there is a hole (length > 0) */ + if (length) + pa_stream_drop(s); return; }