changeset 6452:2a2f9cb7f1b0 libavcodec

fix the WC3 Xan decoder by correcting the frame accounting logic
author melanson
date Wed, 05 Mar 2008 06:58:20 +0000
parents 355b2eb9f553
children 3cd8e50f4e1e
files xan.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/xan.c	Wed Mar 05 03:59:07 2008 +0000
+++ b/xan.c	Wed Mar 05 06:58:20 2008 +0000
@@ -435,12 +435,12 @@
     if (s->last_frame.data[0])
         avctx->release_buffer(avctx, &s->last_frame);
 
-    /* shuffle frames */
-    s->last_frame = s->current_frame;
-
     *data_size = sizeof(AVFrame);
     *(AVFrame*)data = s->current_frame;
 
+    /* shuffle frames */
+    FFSWAP(AVFrame, s->current_frame, s->last_frame);
+
     /* always report that the buffer was completely consumed */
     return buf_size;
 }
@@ -449,9 +449,11 @@
 {
     XanContext *s = avctx->priv_data;
 
-    /* release the last frame */
+    /* release the frames */
     if (s->last_frame.data[0])
         avctx->release_buffer(avctx, &s->last_frame);
+    if (s->current_frame.data[0])
+        avctx->release_buffer(avctx, &s->current_frame);
 
     av_free(s->buffer1);
     av_free(s->buffer2);