summaryrefslogtreecommitdiff
path: root/spa
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-07-08 18:23:22 +0200
committerWim Taymans <wtaymans@redhat.com>2019-07-08 18:23:22 +0200
commit0154e6eaacc45e4849e7a7929b064dc55b4f2a55 (patch)
tree9847be5d9aadb039b1adfeec03c054e654b84619 /spa
parent98d10bbd1f236c38daabb7ce2df445101fccf089 (diff)
small cleanups
resample: remove unused index variable
Diffstat (limited to 'spa')
-rw-r--r--spa/plugins/alsa/alsa-source.c2
-rw-r--r--spa/plugins/audioconvert/resample-native-impl.h10
-rw-r--r--spa/plugins/audioconvert/resample-native.h9
-rw-r--r--spa/plugins/audioconvert/resample-peaks.h2
4 files changed, 9 insertions, 14 deletions
diff --git a/spa/plugins/alsa/alsa-source.c b/spa/plugins/alsa/alsa-source.c
index 7d277839..f085e10f 100644
--- a/spa/plugins/alsa/alsa-source.c
+++ b/spa/plugins/alsa/alsa-source.c
@@ -592,6 +592,8 @@ impl_node_port_set_io(void *object,
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
+ spa_log_debug(this->log, NAME " %p: io %d %p %zd", this, id, data, size);
+
switch (id) {
case SPA_IO_Buffers:
this->io = data;
diff --git a/spa/plugins/audioconvert/resample-native-impl.h b/spa/plugins/audioconvert/resample-native-impl.h
index 3cb278e2..422905ab 100644
--- a/spa/plugins/audioconvert/resample-native-impl.h
+++ b/spa/plugins/audioconvert/resample-native-impl.h
@@ -38,7 +38,6 @@ struct native_data {
uint32_t n_phases;
uint32_t in_rate;
uint32_t out_rate;
- uint32_t index;
uint32_t phase;
uint32_t inc;
uint32_t frac;
@@ -66,7 +65,7 @@ DEFINE_RESAMPLER(copy,arch) \
if (r->channels == 0) \
return; \
\
- index = data->index; \
+ index = 0; \
if (offs < olen && index + n_taps <= ilen) { \
uint32_t to_copy = SPA_MIN(olen - offs, \
ilen - (index + n_taps) + 1); \
@@ -80,7 +79,6 @@ DEFINE_RESAMPLER(copy,arch) \
} \
*in_len = index; \
*out_len = offs; \
- data->index = index; \
}
#define MAKE_RESAMPLER_FULL(arch) \
@@ -99,7 +97,7 @@ DEFINE_RESAMPLER(full,arch) \
const float *s = src[c]; \
float *d = dst[c]; \
\
- index = data->index; \
+ index = 0; \
phase = data->phase; \
\
for (o = offs; o < olen && index + n_taps <= ilen; o++) { \
@@ -118,7 +116,6 @@ DEFINE_RESAMPLER(full,arch) \
} \
*in_len = index; \
*out_len = o; \
- data->index = index; \
data->phase = phase; \
}
@@ -139,7 +136,7 @@ DEFINE_RESAMPLER(inter,arch) \
const float *s = src[c]; \
float *d = dst[c]; \
\
- index = data->index; \
+ index = 0; \
phase = data->phase; \
\
for (o = offs; o < olen && index + n_taps <= ilen; o++) { \
@@ -165,7 +162,6 @@ DEFINE_RESAMPLER(inter,arch) \
} \
*in_len = index; \
*out_len = o; \
- data->index = index; \
data->phase = phase; \
}
diff --git a/spa/plugins/audioconvert/resample-native.h b/spa/plugins/audioconvert/resample-native.h
index c8f15d6a..c13332b6 100644
--- a/spa/plugins/audioconvert/resample-native.h
+++ b/spa/plugins/audioconvert/resample-native.h
@@ -171,8 +171,8 @@ static void impl_native_process(struct resample *r,
in = hist + refill;
out = *out_len;
data->func(r, (const void**)history, &in, dst, 0, &out);
- spa_log_trace_fp(r->log, "native %p: in:%d/%d out %d/%d idx:%d hist:%d",
- r, hist + refill, in, *out_len, out, data->index, hist);
+ spa_log_trace_fp(r->log, "native %p: in:%d/%d out %d/%d hist:%d",
+ r, hist + refill, in, *out_len, out, hist);
} else {
out = in = 0;
}
@@ -180,7 +180,6 @@ static void impl_native_process(struct resample *r,
if (in >= hist) {
/* we are past the history and can now work on the new
* input data */
- data->index -= hist;
in = *in_len;
data->func(r, src, &in, dst, out, out_len);
spa_log_trace_fp(r->log, "native %p: in:%d/%d out %d/%d",
@@ -219,7 +218,6 @@ static void impl_native_process(struct resample *r,
}
}
data->hist = remain;
- data->index = 0;
return;
}
@@ -228,7 +226,6 @@ static void impl_native_reset (struct resample *r)
struct native_data *d = r->data;
memset(d->hist_mem, 0, r->channels * sizeof(float) * d->n_taps * 2);
d->hist = d->n_taps / 2;
- d->index = 0;
d->phase = 0;
}
@@ -279,7 +276,7 @@ static int impl_native_init(struct resample *r)
64);
if (d == NULL)
- return -ENOMEM;
+ return -errno;
r->data = d;
d->n_taps = n_taps;
diff --git a/spa/plugins/audioconvert/resample-peaks.h b/spa/plugins/audioconvert/resample-peaks.h
index f9ced5a9..28e3d87d 100644
--- a/spa/plugins/audioconvert/resample-peaks.h
+++ b/spa/plugins/audioconvert/resample-peaks.h
@@ -112,7 +112,7 @@ static int impl_peaks_init(struct resample *r)
r->reset = impl_peaks_reset;
d = r->data = calloc(1, sizeof(struct peaks_data) * sizeof(float) * r->channels);
if (r->data == NULL)
- return -ENOMEM;
+ return -errno;
d->i_count = d->o_count = 0;
return 0;