summaryrefslogtreecommitdiff
path: root/gst/audioresample
diff options
context:
space:
mode:
authorKipp Cannon <kipp.cannon@ligo.org>2014-07-08 12:37:41 -0400
committerSebastian Dröge <sebastian@centricular.com>2014-09-05 11:17:43 +0300
commit684cf44ee3c8ccdbcc2f5711f050ba57d9909183 (patch)
tree573a06bf382c5701a0186b9358bf756605ef4e06 /gst/audioresample
parentf47c2442fe7e3c0235b4c9afd72359627a2df416 (diff)
downloadgstreamer-plugins-base-684cf44ee3c8ccdbcc2f5711f050ba57d9909183.tar.gz
audioresample: don't skip input samples
when downsampling, the output buffer can be filled before all the input samples are consumed. this is correct: when downsampling, several input samples are needed for each output sample, so when only a small number of input samples are available the number of output samples produced can be 0. the resampler, however, was discarding those extra input samples instead of clocking them into its filter history for the next iteration. this patch fixes this by removing the check that the output buffer is full. the code now always loops until all input samples are consumed, and relies on the calling code to have provided a suitably sized location for the output. note that there are already other checks in place in the calling code to ensure that this is the case. https://bugzilla.gnome.org/show_bug.cgi?id=732908
Diffstat (limited to 'gst/audioresample')
-rw-r--r--gst/audioresample/resample.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gst/audioresample/resample.c b/gst/audioresample/resample.c
index d4df97902..d06719229 100644
--- a/gst/audioresample/resample.c
+++ b/gst/audioresample/resample.c
@@ -1183,7 +1183,7 @@ speex_resampler_process_float (SpeexResamplerState * st,
if (st->magic_samples[channel_index])
olen -= speex_resampler_magic (st, channel_index, &out, olen);
if (!st->magic_samples[channel_index]) {
- while (ilen && olen) {
+ while (ilen) {
spx_uint32_t ichunk = (ilen > xlen) ? xlen : ilen;
spx_uint32_t ochunk = olen;
@@ -1238,7 +1238,7 @@ speex_resampler_process_int (SpeexResamplerState * st,
st->out_stride = 1;
- while (ilen && olen) {
+ while (ilen) {
spx_word16_t *y = ystack;
spx_uint32_t ichunk = (ilen > xlen) ? xlen : ilen;
spx_uint32_t ochunk = (olen > ylen) ? ylen : olen;