mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-03 07:15:32 -04:00
profiler: scale quantum with rate
When we have a forced or suggested rate, adjust the latency with the new denominator. Fixes #4555
This commit is contained in:
parent
75243b7b02
commit
f8272c767f
1 changed files with 9 additions and 2 deletions
|
|
@ -196,6 +196,13 @@ static void do_flush_event(void *data, uint64_t count)
|
||||||
pw_profiler_resource_profile(resource, &p->pod);
|
pw_profiler_resource_profile(resource, &p->pod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void update_denom(struct spa_fraction *frac, uint32_t denom)
|
||||||
|
{
|
||||||
|
if (frac->denom != 0)
|
||||||
|
frac->num = frac->num * denom / frac->denom;
|
||||||
|
frac->denom = denom;
|
||||||
|
}
|
||||||
|
|
||||||
static void context_do_profile(void *data)
|
static void context_do_profile(void *data)
|
||||||
{
|
{
|
||||||
struct node *n = data;
|
struct node *n = data;
|
||||||
|
|
@ -273,9 +280,9 @@ static void context_do_profile(void *data)
|
||||||
if (n->force_quantum != 0)
|
if (n->force_quantum != 0)
|
||||||
latency.num = n->force_quantum;
|
latency.num = n->force_quantum;
|
||||||
if (n->force_rate != 0)
|
if (n->force_rate != 0)
|
||||||
latency.denom = n->force_rate;
|
update_denom(&latency, n->force_rate);
|
||||||
else if (n->rate.denom != 0)
|
else if (n->rate.denom != 0)
|
||||||
latency.denom = n->rate.denom;
|
update_denom(&latency, n->rate.denom);
|
||||||
} else {
|
} else {
|
||||||
spa_zero(latency);
|
spa_zero(latency);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue