From 7fd3e13a3e330fcfc287f80f2a07408f04815463 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 8 May 2026 11:38:28 +0200 Subject: [PATCH] netjack2: handle 0 in sync frames JACK2 only sends -1 as the frames, meaning we should take the value from the negotiated period as the frames to process. We however send the actual number of frames and use the sync value to decide how many frames to process. We need to be careful because a value of 0 will cause a division by 0 so treat <= 0 frames the negotiated period size as well. --- src/modules/module-netjack2/peer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/module-netjack2/peer.c b/src/modules/module-netjack2/peer.c index e9ce2196b..76f3a9ed1 100644 --- a/src/modules/module-netjack2/peer.c +++ b/src/modules/module-netjack2/peer.c @@ -752,7 +752,7 @@ static inline int32_t netjack2_driver_sync_wait(struct netjack2_peer *peer) } peer->sync.is_last = ntohl(sync.is_last); peer->sync.frames = ntohl(sync.frames); - if (peer->sync.frames == -1) + if (peer->sync.frames <= 0) peer->sync.frames = peer->params.period_size; peer->sync.frames = SPA_MIN(peer->sync.frames, (int32_t)peer->quantum_limit); @@ -793,7 +793,7 @@ static inline int32_t netjack2_manager_sync_wait(struct netjack2_peer *peer) peer->sync.cycle = ntohl(sync.cycle); peer->sync.is_last = ntohl(sync.is_last); peer->sync.frames = ntohl(sync.frames); - if (peer->sync.frames == -1) + if (peer->sync.frames <= 0) peer->sync.frames = peer->params.period_size; peer->sync.frames = SPA_MIN(peer->sync.frames, (int32_t)peer->quantum_limit);