mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-09-20 00:11:31 +00:00
improve latency debug
This commit is contained in:
parent
8bab9a18ec
commit
fe417bd123
|
@ -4973,9 +4973,13 @@ SPA_EXPORT
|
||||||
void jack_port_set_latency (jack_port_t *port, jack_nframes_t frames)
|
void jack_port_set_latency (jack_port_t *port, jack_nframes_t frames)
|
||||||
{
|
{
|
||||||
struct object *o = (struct object *) port;
|
struct object *o = (struct object *) port;
|
||||||
|
struct client *c;
|
||||||
jack_latency_range_t range = { frames, frames };
|
jack_latency_range_t range = { frames, frames };
|
||||||
|
|
||||||
spa_return_if_fail(o != NULL);
|
spa_return_if_fail(o != NULL);
|
||||||
|
c = o->client;
|
||||||
|
|
||||||
|
pw_log_debug("%p: %s set latency %d", c, o->port.name, frames);
|
||||||
|
|
||||||
if (o->port.flags & JackPortIsOutput) {
|
if (o->port.flags & JackPortIsOutput) {
|
||||||
jack_port_set_latency_range(port, JackCaptureLatency, &range);
|
jack_port_set_latency_range(port, JackCaptureLatency, &range);
|
||||||
|
@ -5013,7 +5017,8 @@ void jack_port_get_latency_range (jack_port_t *port, jack_latency_callback_mode_
|
||||||
range->max = (info->max_quantum * nframes) +
|
range->max = (info->max_quantum * nframes) +
|
||||||
info->max_rate + (info->max_ns * rate) / SPA_NSEC_PER_SEC;
|
info->max_rate + (info->max_ns * rate) / SPA_NSEC_PER_SEC;
|
||||||
|
|
||||||
pw_log_debug("%p: get %d latency range %d %d", o, mode, range->min, range->max);
|
pw_log_debug("%p: %s get %d latency range %d %d", c, o->port.name,
|
||||||
|
mode, range->min, range->max);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -1314,10 +1314,13 @@ int pw_impl_port_recalc_latency(struct pw_impl_port *port)
|
||||||
struct spa_pod *param;
|
struct spa_pod *param;
|
||||||
struct spa_pod_builder b = { 0 };
|
struct spa_pod_builder b = { 0 };
|
||||||
uint8_t buffer[1024];
|
uint8_t buffer[1024];
|
||||||
|
bool changed;
|
||||||
|
|
||||||
if (port->destroying)
|
if (port->destroying)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* given an output port, we calculate the total latency to the sinks or the input
|
||||||
|
* latency. */
|
||||||
spa_latency_info_combine_start(&latency, SPA_DIRECTION_REVERSE(port->direction));
|
spa_latency_info_combine_start(&latency, SPA_DIRECTION_REVERSE(port->direction));
|
||||||
|
|
||||||
if (port->direction == PW_DIRECTION_OUTPUT) {
|
if (port->direction == PW_DIRECTION_OUTPUT) {
|
||||||
|
@ -1345,17 +1348,20 @@ int pw_impl_port_recalc_latency(struct pw_impl_port *port)
|
||||||
|
|
||||||
current = &port->latency[latency.direction];
|
current = &port->latency[latency.direction];
|
||||||
|
|
||||||
if (spa_latency_info_compare(current, &latency) == 0)
|
changed = spa_latency_info_compare(current, &latency) != 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
*current = latency;
|
pw_log_info("port %d: %s %s latency %f-%f %d-%d %"PRIu64"-%"PRIu64,
|
||||||
|
port->info.id, changed ? "set" : "keep",
|
||||||
pw_log_debug("port %d: set %s latency %f-%f %d-%d %"PRIu64"-%"PRIu64,
|
pw_direction_as_string(latency.direction),
|
||||||
port->info.id, pw_direction_as_string(latency.direction),
|
|
||||||
latency.min_quantum, latency.max_quantum,
|
latency.min_quantum, latency.max_quantum,
|
||||||
latency.min_rate, latency.max_rate,
|
latency.min_rate, latency.max_rate,
|
||||||
latency.min_ns, latency.max_ns);
|
latency.min_ns, latency.max_ns);
|
||||||
|
|
||||||
|
if (!changed)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
*current = latency;
|
||||||
|
|
||||||
if (!port->have_latency_param)
|
if (!port->have_latency_param)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue