From df76501d39e1ac019e7b5efb08bc9a11d7e438d7 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 30 Jul 2020 18:22:33 +0200 Subject: [PATCH] impl-node: update driver stats as well If we have an underrun but are managed by another driver, also update the driver stats. --- src/pipewire/impl-node.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index 61a85e44d..163721025 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -1503,15 +1503,23 @@ static int node_reuse_buffer(void *data, uint32_t port_id, uint32_t buffer_id) return 0; } -static int node_xrun(void *data, uint64_t trigger, uint64_t delay, struct spa_pod *info) +static void update_xrun_stats(struct pw_node_activation *a, uint64_t trigger, uint64_t delay) { - struct pw_impl_node *this = data; - struct pw_node_activation *a = this->rt.activation; - a->xrun_count++; a->xrun_time = trigger; a->xrun_delay = delay; a->max_delay = SPA_MAX(a->max_delay, delay); +} + +static int node_xrun(void *data, uint64_t trigger, uint64_t delay, struct spa_pod *info) +{ + struct pw_impl_node *this = data; + struct pw_node_activation *a = this->rt.activation; + struct pw_node_activation *da = this->rt.driver_target.activation; + + update_xrun_stats(a, trigger, delay); + if (da && da != a) + update_xrun_stats(da, trigger, delay); if (ratelimit_test(&this->rt.rate_limit, a->signal_time)) { pw_log_error("(%s-%d) XRun! count:%u time:%"PRIu64" delay:%"PRIu64" max:%"PRIu64,