aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorJanne Grunau <janne-libav@jannau.net>2012-12-12 16:42:05 +0100
committerJanne Grunau <janne-libav@jannau.net>2012-12-13 21:02:42 +0100
commit6a27ae28f9bde981e85c82cf5bf42c5f43fb6f13 (patch)
treed572b54b3b0cedc247f28dfc9fa2b94929c71483 /libavcodec/mpegvideo.c
parentbd255f9feb4deea4c990e582f0ba3b90d7b64b4c (diff)
downloadffmpeg-6a27ae28f9bde981e85c82cf5bf42c5f43fb6f13.tar.gz
mpegvideo: treat delayed pictures as used
This requires to move the avcodec_default_free_buffers() call to ff_MPV_common_end() since otherwise delayed pictures would get freed during a size change.
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 42367e1e48..773c9e258b 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1008,9 +1008,6 @@ static int free_context_frame(MpegEncContext *s)
for (i = 0; i < 3; i++)
av_freep(&s->visualization_buffer[i]);
- if (!(s->avctx->active_thread_type & FF_THREAD_FRAME))
- avcodec_default_free_buffers(s->avctx);
-
return 0;
}
@@ -1126,6 +1123,9 @@ void ff_MPV_common_end(MpegEncContext *s)
free_context_frame(s);
+ if (!(s->avctx->active_thread_type & FF_THREAD_FRAME))
+ avcodec_default_free_buffers(s->avctx);
+
s->context_initialized = 0;
s->last_picture_ptr =
s->next_picture_ptr =
@@ -1244,7 +1244,7 @@ static inline int pic_is_unused(MpegEncContext *s, Picture *pic)
{
if (pic->f.data[0] == NULL)
return 1;
- if (pic->needs_realloc)
+ if (pic->needs_realloc && !(pic->f.reference & DELAYED_PIC_REF))
if (!pic->owner2 || pic->owner2 == s)
return 1;
return 0;