[FFmpeg-cvslog] avfilter/vf_shuffleframes: unbreak filter

Paul B Mahol git at videolan.org
Thu Sep 8 11:57:15 EEST 2016


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Sep  8 10:53:43 2016 +0200| [ae31ab807001e6e90eac5a79ee0b61c5e727138c] | committer: Paul B Mahol

avfilter/vf_shuffleframes: unbreak filter

Regression since 736e2e2c30088d0c2a428a51372c78a0bfb7f356.

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ae31ab807001e6e90eac5a79ee0b61c5e727138c
---

 libavfilter/vf_shuffleframes.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_shuffleframes.c b/libavfilter/vf_shuffleframes.c
index f49c9c6..bfbf4bd 100644
--- a/libavfilter/vf_shuffleframes.c
+++ b/libavfilter/vf_shuffleframes.c
@@ -84,14 +84,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
 {
     AVFilterContext    *ctx = inlink->dst;
     ShuffleFramesContext *s = ctx->priv;
-    int ret;
+    int ret = 0;
 
     if (s->in_frames < s->nb_frames) {
         s->frames[s->in_frames] = frame;
         s->pts[s->in_frames] = frame->pts;
         s->in_frames++;
-        ret = 0;
-    } else if (s->in_frames == s->nb_frames) {
+    }
+
+    if (s->in_frames == s->nb_frames) {
         int n, x;
 
         for (n = 0; n < s->nb_frames; n++) {
@@ -108,8 +109,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
 
         for (n = 0; n < s->nb_frames; n++)
             av_frame_free(&s->frames[n]);
-    } else
-        av_assert0(0);
+    }
 
     return ret;
 }
@@ -118,6 +118,11 @@ static av_cold void uninit(AVFilterContext *ctx)
 {
     ShuffleFramesContext *s = ctx->priv;
 
+    while (s->in_frames > 0) {
+        s->in_frames--;
+        av_frame_free(&s->frames[s->in_frames]);
+    }
+
     av_freep(&s->frames);
     av_freep(&s->map);
     av_freep(&s->pts);



More information about the ffmpeg-cvslog mailing list