From: Peter Meerwald <p.meerwald@xxxxxxxxxxxxxxxxxx> buf in struct ffmpeg is reset() initially and freed, but never actually used when a new block is allocated ffmpeg_data->buf[c].length is used (which is always 0) to compute the new block size so, drop buf Signed-off-by: Peter Meerwald <p.meerwald at bct-electronic.com> --- src/pulsecore/resampler.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c index cdfaf8f..5f0cb4b 100644 --- a/src/pulsecore/resampler.c +++ b/src/pulsecore/resampler.c @@ -107,7 +107,6 @@ struct pa_resampler { struct { /* data specific to ffmpeg */ struct AVResampleContext *state; - pa_memchunk buf[PA_CHANNELS_MAX]; } ffmpeg; }; @@ -1623,7 +1622,7 @@ static void ffmpeg_resample(pa_resampler *r, const pa_memchunk *input, unsigned int consumed_frames; /* Allocate a new block */ - b = pa_memblock_new(r->mempool, r->ffmpeg.buf[c].length + in_n_frames * sizeof(int16_t)); + b = pa_memblock_new(r->mempool, in_n_frames * sizeof(int16_t)); p = pa_memblock_acquire(b); /* Now copy the input data, splitting up channels */ @@ -1678,21 +1677,13 @@ static void ffmpeg_resample(pa_resampler *r, const pa_memchunk *input, unsigned } static void ffmpeg_free(pa_resampler *r) { - unsigned c; - pa_assert(r); if (r->ffmpeg.state) av_resample_close(r->ffmpeg.state); - - for (c = 0; c < PA_ELEMENTSOF(r->ffmpeg.buf); c++) - if (r->ffmpeg.buf[c].memblock) - pa_memblock_unref(r->ffmpeg.buf[c].memblock); } static int ffmpeg_init(pa_resampler *r) { - unsigned c; - pa_assert(r); /* We could probably implement different quality levels by @@ -1706,9 +1697,6 @@ static int ffmpeg_init(pa_resampler *r) { r->impl_free = ffmpeg_free; r->impl_resample = ffmpeg_resample; - for (c = 0; c < PA_ELEMENTSOF(r->ffmpeg.buf); c++) - pa_memchunk_reset(&r->ffmpeg.buf[c]); - return 0; } -- 1.7.9.5