2018-10-10 18:50:11 +02:00
|
|
|
/* PipeWire
|
|
|
|
|
*
|
2020-02-07 15:43:13 +01:00
|
|
|
* Copyright © 2018 Wim Taymans
|
2018-10-10 18:50:11 +02:00
|
|
|
*
|
2020-02-07 15:43:13 +01:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
2018-10-10 18:50:11 +02:00
|
|
|
*
|
2020-02-07 15:43:13 +01:00
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
|
* Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
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;
|
|
|
|
|
|
2020-02-24 11:25:31 +01:00
|
|
|
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;
|
|
|
|
|
|
2020-02-24 11:25:31 +01:00
|
|
|
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;
|
2020-02-24 11:25:31 +01:00
|
|
|
|
|
|
|
|
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
|
|
|
}
|