pipewire/pipewire-jack/src/statistics.c

47 lines
1 KiB
C
Raw Normal View History

/* PipeWire */
/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
/* SPDX-License-Identifier: MIT */
2018-10-10 18:50:11 +02:00
#include <jack/statistics.h>
2019-04-11 16:36:52 +02:00
SPA_EXPORT
2018-10-10 18:50:11 +02:00
float jack_get_max_delayed_usecs (jack_client_t *client)
{
2019-08-22 13:25:01 +02:00
struct client *c = (struct client *) client;
float res = 0.0f;
spa_return_val_if_fail(c != NULL, 0.0);
2019-08-22 13:25:01 +02:00
if (c->driver_activation)
res = (float)c->driver_activation->max_delay / SPA_USEC_PER_SEC;
2021-10-03 08:52:27 +02:00
pw_log_trace("%p: max delay %f", client, res);
2019-08-22 13:25:01 +02:00
return res;
2018-10-10 18:50:11 +02:00
}
2019-04-11 16:36:52 +02:00
SPA_EXPORT
2018-10-10 18:50:11 +02:00
float jack_get_xrun_delayed_usecs (jack_client_t *client)
{
2019-08-22 13:25:01 +02:00
struct client *c = (struct client *) client;
float res = 0.0f;
spa_return_val_if_fail(c != NULL, 0.0);
2019-08-22 13:25:01 +02:00
if (c->driver_activation)
res = (float)c->driver_activation->xrun_delay / SPA_USEC_PER_SEC;
2021-10-03 08:52:27 +02:00
pw_log_trace("%p: xrun delay %f", client, res);
2019-08-22 13:25:01 +02:00
return res;
2018-10-10 18:50:11 +02:00
}
2019-04-11 16:36:52 +02:00
SPA_EXPORT
2018-10-10 18:50:11 +02:00
void jack_reset_max_delayed_usecs (jack_client_t *client)
{
2019-08-22 13:25:01 +02:00
struct client *c = (struct client *) client;
spa_return_if_fail(c != NULL);
2019-08-22 13:25:01 +02:00
if (c->driver_activation)
c->driver_activation->max_delay = 0;
2018-10-10 18:50:11 +02:00
}