From c132a67c7dbd81f82fcc422e13a9c9e1f658f3f5 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 7 Oct 2024 09:28:39 +0200 Subject: [PATCH] adapter: increase max-retry to 64 When the follower doesn't produce enough data for this many attempts, bail and cause an xrun to avoid an infinite loop. The limit of 8 cause real-life problems and should be larger. It should probably depend on the expected size per cycle (node.latency) and the current quantum but we don't always have this information. See #4334 --- spa/plugins/audioconvert/audioadapter.c | 5 +++-- spa/plugins/videoconvert/videoadapter.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index 0773ef2f7..5e91f36fc 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -33,6 +33,7 @@ SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.audioadapter"); #define DEFAULT_ALIGN 16 #define MAX_PORTS (SPA_AUDIO_MAX_CHANNELS+1) +#define MAX_RETRY 64 /** \cond */ @@ -1393,7 +1394,7 @@ static int follower_ready(void *data, int status) this->driver = true; if (this->direction == SPA_DIRECTION_OUTPUT) { - int retry = 8; + int retry = MAX_RETRY; while (retry--) { status = spa_node_process_fast(this->convert); if (status & SPA_STATUS_HAVE_DATA) @@ -1621,7 +1622,7 @@ impl_node_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id) static int impl_node_process(void *object) { struct impl *this = object; - int status = 0, fstatus, retry = 8; + int status = 0, fstatus, retry = MAX_RETRY; if (!this->ready) { if (!this->warned) diff --git a/spa/plugins/videoconvert/videoadapter.c b/spa/plugins/videoconvert/videoadapter.c index b8fca8243..22cf8c4c8 100644 --- a/spa/plugins/videoconvert/videoadapter.c +++ b/spa/plugins/videoconvert/videoadapter.c @@ -34,6 +34,7 @@ SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.videoadapter"); #define DEFAULT_ALIGN 16 #define MAX_PORTS (1+1) +#define MAX_RETRY 64 /** \cond */ @@ -1366,7 +1367,7 @@ static int follower_ready(void *data, int status) this->driver = true; if (this->direction == SPA_DIRECTION_OUTPUT) { - int retry = 8; + int retry = MAX_RETRY; while (retry--) { status = spa_node_process(this->convert); if (status & SPA_STATUS_HAVE_DATA) @@ -1596,7 +1597,7 @@ impl_node_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id) static int impl_node_process(void *object) { struct impl *this = object; - int status = 0, fstatus, retry = 8; + int status = 0, fstatus, retry = MAX_RETRY; if (!this->ready) { if (!this->warned)