aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-06-05 01:46:18 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-08-15 18:54:34 +0200
commitffb503c9a14c837d6f73a609129c4fca4836b51d (patch)
treeaf46ea2b9510369539a110b17733a69ec4a84661
parent2bbbd3e50a8f4ceb916c6ab64c5eb8630b8981b3 (diff)
downloadffmpeg-ffb503c9a14c837d6f73a609129c4fca4836b51d.tar.gz
avcodec/mpegvideo: Deallocate last/next picture earlier
Fixes regression with mplayers direct rendering and reduces buffer count pressure in some cases Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 39c0b22df42088cf4fb1ceb2447291c224a5c7ed) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/mpegvideo.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 4a40cf96d6..e067fc2cd1 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1210,6 +1210,8 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
}
ff_mpeg_unref_picture(s->avctx, &s->current_picture);
+ ff_mpeg_unref_picture(s->avctx, &s->last_picture);
+ ff_mpeg_unref_picture(s->avctx, &s->next_picture);
/* release non reference frames */
for (i = 0; i < MAX_PICTURE_COUNT; i++) {
@@ -1361,14 +1363,12 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
memset(s->next_picture.f->data, 0, sizeof(s->next_picture.f->data));
#endif
if (s->last_picture_ptr) {
- ff_mpeg_unref_picture(s->avctx, &s->last_picture);
if (s->last_picture_ptr->f->buf[0] &&
(ret = ff_mpeg_ref_picture(s->avctx, &s->last_picture,
s->last_picture_ptr)) < 0)
return ret;
}
if (s->next_picture_ptr) {
- ff_mpeg_unref_picture(s->avctx, &s->next_picture);
if (s->next_picture_ptr->f->buf[0] &&
(ret = ff_mpeg_ref_picture(s->avctx, &s->next_picture,
s->next_picture_ptr)) < 0)