showwaves: fix first sample of frame test.
authorNicolas George <nicolas.george@normalesup.org>
Sat, 23 Jun 2012 09:50:19 +0000 (11:50 +0200)
committerNicolas George <nicolas.george@normalesup.org>
Sat, 23 Jun 2012 13:08:22 +0000 (15:08 +0200)
Avoids a huge memleak when n != 1.

libavfilter/avf_showwaves.c

index 645065f..90d3ec9 100644 (file)
@@ -196,7 +196,7 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
 
     /* draw data in the buffer */
     for (i = 0; i < nb_samples; i++) {
-        if (showwaves->buf_idx == 0) {
+        if (showwaves->buf_idx == 0 && showwaves->sample_count_mod == 0) {
             showwaves->outpicref = outpicref =
                 ff_get_video_buffer(outlink, AV_PERM_WRITE|AV_PERM_ALIGN,
                                     outlink->w, outlink->h);