summaryrefslogtreecommitdiff
path: root/spa
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-07-15 17:06:07 +0200
committerWim Taymans <wtaymans@redhat.com>2019-07-15 17:06:07 +0200
commit93006d6d9029e320f3634015ca7c38aed71153bf (patch)
tree1c1636c612dc9a7767db19a2dd19036ca53dc6fc /spa
parent80face4b92a9d9c0a316deb1043340d6cfeb0c37 (diff)
resample-native: only do full resample when rate == 1.0
Otherwise choose the interpollating resampler.
Diffstat (limited to 'spa')
-rw-r--r--spa/plugins/audioconvert/resample-native.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/spa/plugins/audioconvert/resample-native.h b/spa/plugins/audioconvert/resample-native.h
index 2af26871..869b4eec 100644
--- a/spa/plugins/audioconvert/resample-native.h
+++ b/spa/plugins/audioconvert/resample-native.h
@@ -94,8 +94,9 @@ 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;
+ uint32_t in_rate, out_rate, phase, gcd, old_out_rate;
+ old_out_rate = data->out_rate;
in_rate = r->i_rate / rate;
out_rate = r->o_rate;
phase = data->phase;
@@ -105,7 +106,7 @@ static void impl_native_update_rate(struct resample *r, double rate)
out_rate /= gcd;
data->rate = rate;
- data->phase = phase * out_rate / data->out_rate;
+ data->phase = phase * out_rate / old_out_rate;
data->in_rate = in_rate;
data->out_rate = out_rate;
@@ -118,7 +119,7 @@ static void impl_native_update_rate(struct resample *r, double rate)
if (data->in_rate == data->out_rate)
data->func = do_resample_copy_c;
else {
- bool is_full = r->i_rate == in_rate;
+ bool is_full = rate == 1.0;
data->func = is_full ? do_resample_full_c : do_resample_inter_c;
#if defined (HAVE_SSE)