mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
resample: use a float phase in update_rate
My making the phase into a float, the resampler can do finer grained adjustments, which should improve the stability of adaptive resampling
This commit is contained in:
parent
764ae650e2
commit
77f6c009c1
2 changed files with 7 additions and 5 deletions
|
|
@ -134,7 +134,8 @@ static inline uint32_t calc_gcd(uint32_t a, uint32_t b)
|
|||
static void impl_native_update_rate(struct resample *r, double rate)
|
||||
{
|
||||
struct native_data *data = r->data;
|
||||
uint32_t in_rate, out_rate, phase, gcd, old_out_rate;
|
||||
uint32_t in_rate, out_rate, gcd, old_out_rate;
|
||||
float phase;
|
||||
|
||||
if (SPA_LIKELY(data->rate == rate))
|
||||
return;
|
||||
|
|
@ -149,7 +150,7 @@ static void impl_native_update_rate(struct resample *r, double rate)
|
|||
out_rate /= gcd;
|
||||
|
||||
data->rate = rate;
|
||||
data->phase = phase * out_rate / old_out_rate;
|
||||
data->phase = phase * out_rate / (float)old_out_rate;
|
||||
data->in_rate = in_rate;
|
||||
data->out_rate = out_rate;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue