summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-08-19 16:18:48 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-08-19 16:18:48 +0000
commit8e39d4a7447fc02a470008905b89a8dd61eb2bf4 (patch)
tree1a23155c8363c31803dafbac0112e7c9b6cec0e9 /libavcodec
parentbd5a60201e0fc253d55cef919a6d69de6efcbd1a (diff)
fix AVFrame.reference (the frames are used for decoding future frames so it should be !=0)
fix some assert in utils.c (no bug but its saver if the released pointers are NULL) fix double release_buffer() at the end Originally committed as revision 2126 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/vp3.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index c46b0bc6da..0a564b32b6 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2699,10 +2699,10 @@ static int vp3_decode_frame(AVCodecContext *avctx,
debug_vp3(", keyframe\n");
/* skip the other 2 header bytes for now */
skip_bits(&gb, 16);
-
if (s->last_frame.data[0] == s->golden_frame.data[0]) {
if (s->golden_frame.data[0])
avctx->release_buffer(avctx, &s->golden_frame);
+ s->last_frame= s->golden_frame; /* ensure that we catch any access to this released frame */
} else {
if (s->golden_frame.data[0])
avctx->release_buffer(avctx, &s->golden_frame);
@@ -2710,7 +2710,7 @@ static int vp3_decode_frame(AVCodecContext *avctx,
avctx->release_buffer(avctx, &s->last_frame);
}
- s->golden_frame.reference = 0;
+ s->golden_frame.reference = 3;
if(avctx->get_buffer(avctx, &s->golden_frame) < 0) {
printf("vp3: get_buffer() failed\n");
return -1;
@@ -2728,7 +2728,7 @@ static int vp3_decode_frame(AVCodecContext *avctx,
debug_vp3("\n");
/* allocate a new current frame */
- s->current_frame.reference = 0;
+ s->current_frame.reference = 3;
if(avctx->get_buffer(avctx, &s->current_frame) < 0) {
printf("vp3: get_buffer() failed\n");
return -1;
@@ -2789,6 +2789,7 @@ if (!s->keyframe) {
/* shuffle frames (last = current) */
memcpy(&s->last_frame, &s->current_frame, sizeof(AVFrame));
+ s->current_frame.data[0]= NULL; /* ensure that we catch any access to this released frame */
return buf_size;
}
@@ -2806,9 +2807,9 @@ static int vp3_decode_end(AVCodecContext *avctx)
av_free(s->superblock_macroblocks);
av_free(s->macroblock_fragments);
av_free(s->macroblock_coding);
-
+
/* release all frames */
- if (s->golden_frame.data[0])
+ if (s->golden_frame.data[0] && s->golden_frame.data[0] != s->last_frame.data[0])
avctx->release_buffer(avctx, &s->golden_frame);
if (s->last_frame.data[0])
avctx->release_buffer(avctx, &s->last_frame);