summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorJanne Grunau <janne-libav@jannau.net>2013-05-19 14:49:55 +0200
committerJanne Grunau <janne-libav@jannau.net>2013-05-19 23:02:35 +0200
commit4b79668154f3cf762a71665aea517bdde57b081c (patch)
treeb310def9b595b429a7d6372118ef2aa485dfa7ee /libavcodec/mpegvideo.c
parentdb347280eb3746d7b70888db97f1efe5f06f5624 (diff)
mpegvideo: unref old current_picture before allocating a new one
Allows decoding with only three frame buffers with frame reference counting. Fixes VAAPI based decoding in vlc which uses only three frame buffers for the mpegvideo-based codecs.
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index b5f1587178..b175d32ff1 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1495,6 +1495,8 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
}
}
+ ff_mpeg_unref_picture(s, &s->current_picture);
+
if (!s->encoding) {
ff_release_unused_pictures(s, 1);
@@ -1542,7 +1544,6 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
// s->current_picture_ptr->quality = s->new_picture_ptr->quality;
s->current_picture_ptr->f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;
- ff_mpeg_unref_picture(s, &s->current_picture);
if ((ret = ff_mpeg_ref_picture(s, &s->current_picture,
s->current_picture_ptr)) < 0)
return ret;