aboutsummaryrefslogtreecommitdiffstats
path: root/meta-pipewire/recipes-multimedia/pipewire/pipewire/0016-a2dpsink-fix-infinite-loop-when-buffer-could-not-be-.patch
blob: d747a7a96c74a783c734bd37b62fb2d162349fe6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From c186e40905f78f41cbc015da0e204735a0398450 Mon Sep 17 00:00:00 2001
From: Julian Bouzas <julian.bouzas@collabora.com>
Date: Fri, 19 Jul 2019 08:38:21 -0400
Subject: [PATCH] a2dpsink: fix infinite loop when buffer could not be encoded

Upstream-Status: Backport [4b202b965665bbcb55194b4ab827984e5804e3e0]
---
 spa/plugins/bluez5/a2dp-sink.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c
index 731577e5..d6d9e7d6 100644
--- a/spa/plugins/bluez5/a2dp-sink.c
+++ b/spa/plugins/bluez5/a2dp-sink.c
@@ -558,8 +558,13 @@ static int flush_data(struct impl *this, uint64_t now_time)
 		n_bytes = add_data(this, src + offs, l0);
 		if (n_bytes > 0 && l1 > 0)
 			n_bytes += add_data(this, src, l1);
-		if (n_bytes <= 0)
+		if (n_bytes <= 0) {
+			spa_list_remove(&b->link);
+			b->outstanding = true;
+			spa_node_call_reuse_buffer(&this->callbacks, 0, b->id);
+			port->ready_offset = 0;
 			break;
+		}
 
 		n_frames = n_bytes / port->frame_size;
 
-- 
2.23.0.rc1