mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct node *n = data;
|
||||
|
|
@ -273,9 +280,9 @@ static void context_do_profile(void *data)
|
|||
if (n->force_quantum != 0)
|
||||
latency.num = n->force_quantum;
|
||||
if (n->force_rate != 0)
|
||||
latency.denom = n->force_rate;
|
||||
update_denom(&latency, n->force_rate);
|
||||
else if (n->rate.denom != 0)
|
||||
latency.denom = n->rate.denom;
|
||||
update_denom(&latency, n->rate.denom);
|
||||
} else {
|
||||
spa_zero(latency);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue