[pulseaudio-commits] src/pulsecore

Tanu Kaskinen tanuk at kemper.freedesktop.org
Thu Dec 5 00:48:51 PST 2013


 src/pulsecore/resampler.c |   12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

New commits:
commit 742b93d32cfb90d23016f8f0dfe6bd66e5909d74
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Fri Nov 29 15:33:25 2013 +0100

    resampler: Clean up ffmpeg resampler buffering
    
    buf in struct ffmpeg_data 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>

diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index 3ac8f5e..b475571 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -100,7 +100,6 @@ struct peaks_data { /* data specific to the peak finder pseudo resampler */
 
 struct ffmpeg_data { /* data specific to ffmpeg */
     struct AVResampleContext *state;
-    pa_memchunk buf[PA_CHANNELS_MAX];
 };
 
 static int copy_init(pa_resampler *r);
@@ -1768,7 +1767,7 @@ static unsigned ffmpeg_resample(pa_resampler *r, const pa_memchunk *input, unsig
         int consumed_frames;
 
         /* Allocate a new block */
-        b = pa_memblock_new(r->mempool, ffmpeg_data->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 */
@@ -1817,7 +1816,6 @@ static unsigned ffmpeg_resample(pa_resampler *r, const pa_memchunk *input, unsig
 }
 
 static void ffmpeg_free(pa_resampler *r) {
-    unsigned c;
     struct ffmpeg_data *ffmpeg_data;
 
     pa_assert(r);
@@ -1825,14 +1823,9 @@ static void ffmpeg_free(pa_resampler *r) {
     ffmpeg_data = r->impl.data;
     if (ffmpeg_data->state)
         av_resample_close(ffmpeg_data->state);
-
-    for (c = 0; c < PA_ELEMENTSOF(ffmpeg_data->buf); c++)
-        if (ffmpeg_data->buf[c].memblock)
-            pa_memblock_unref(ffmpeg_data->buf[c].memblock);
 }
 
 static int ffmpeg_init(pa_resampler *r) {
-    unsigned c;
     struct ffmpeg_data *ffmpeg_data;
 
     pa_assert(r);
@@ -1851,9 +1844,6 @@ static int ffmpeg_init(pa_resampler *r) {
     r->impl.resample = ffmpeg_resample;
     r->impl.data = (void *) ffmpeg_data;
 
-    for (c = 0; c < PA_ELEMENTSOF(ffmpeg_data->buf); c++)
-        pa_memchunk_reset(&ffmpeg_data->buf[c]);
-
     return 0;
 }
 



More information about the pulseaudio-commits mailing list