From 8df58db415e9cc8093556c3194a667fb486b85b4 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sun, 9 Nov 2025 02:26:36 +0200 Subject: [PATCH] bluez5: read errqueue also from media-source handler Flush errqueue for iso-io also from the media-source handler, to avoid dropping packet tx reports. This applies to bidirectional streams. The sink/source handlers poll on different fd, one being dup'd, and epoll does not trigger them in any specific interleaved order. --- spa/plugins/bluez5/iso-io.c | 11 +++++++++++ spa/plugins/bluez5/media-source.c | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/spa/plugins/bluez5/iso-io.c b/spa/plugins/bluez5/iso-io.c index a512314c4..aaae32600 100644 --- a/spa/plugins/bluez5/iso-io.c +++ b/spa/plugins/bluez5/iso-io.c @@ -626,6 +626,17 @@ int spa_bt_iso_io_recv_errqueue(struct spa_bt_iso_io *this) struct stream *stream = SPA_CONTAINER_OF(this, struct stream, this); struct group *group = stream->group; + if (!stream->sink) { + struct stream *s; + + spa_list_for_each(s, &group->streams, link) { + if (s->sink && s->fd == stream->fd) { + stream = s; + break; + } + } + } + return spa_bt_latency_recv_errqueue(&stream->tx_latency, stream->fd, group->log); } diff --git a/spa/plugins/bluez5/media-source.c b/spa/plugins/bluez5/media-source.c index dc52a09b4..b04a91260 100644 --- a/spa/plugins/bluez5/media-source.c +++ b/spa/plugins/bluez5/media-source.c @@ -613,6 +613,10 @@ static void handle_errqueue(struct impl *this) { int res; + if (this->transport && this->transport->iso_io) + if (spa_bt_iso_io_recv_errqueue(this->transport->iso_io) == 0) + return; + /* iso-io/media-sink use these for TX latency. * Someone else should be reading them, so drop * only after yielding.