From 93ebb381d262db8638f05991df4936a024affcb0 Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Wed, 25 Aug 2021 19:47:20 +0200 Subject: usbredirhost: drop isoc packages This is similar to the application side callback introduced by a88e197 "usbredirhost: new callback to drop isoc packets", only that packages are now dropped when usbredirparser owns and queues the outgoing data. Resolves: https://gitlab.freedesktop.org/spice/usbredir/-/issues/19 Signed-off-by: Victor Toso --- usbredirhost/usbredirhost.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c index 34f5b14..03c56e9 100644 --- a/usbredirhost/usbredirhost.c +++ b/usbredirhost/usbredirhost.c @@ -1044,10 +1044,17 @@ static int usbredirhost_can_write_iso_package(struct usbredirhost *host) { uint64_t size; - if (!host->buffered_output_size_func) - return true; + if (host->flags & usbredirhost_fl_write_cb_owns_buffer) { + if (!host->buffered_output_size_func) { + /* Application is not dropping isoc packages */ + return true; + } + size = host->buffered_output_size_func(host->func_priv); + } else { + /* queue is on usbredirparser */ + size = usbredirparser_get_bufferered_output_size(host->parser); + } - size = host->buffered_output_size_func(host->func_priv); if (size >= host->iso_threshold.higher) { if (!host->iso_threshold.dropping) DEBUG("START dropping isoc packets %" PRIu64 " buffer > %" PRIu64 " hi threshold", -- cgit v1.2.3