mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-28 14:01:27 +00:00
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
This commit is contained in:
parent
bd5a60201e
commit
8e39d4a744
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user