You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
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>
This commit is contained in:
@@ -1216,6 +1216,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->current_picture);
|
||||||
|
ff_mpeg_unref_picture(s->avctx, &s->last_picture);
|
||||||
|
ff_mpeg_unref_picture(s->avctx, &s->next_picture);
|
||||||
|
|
||||||
/* release non reference frames */
|
/* release non reference frames */
|
||||||
for (i = 0; i < MAX_PICTURE_COUNT; i++) {
|
for (i = 0; i < MAX_PICTURE_COUNT; i++) {
|
||||||
@@ -1367,14 +1369,12 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
|
|||||||
memset(s->next_picture.f->data, 0, sizeof(s->next_picture.f->data));
|
memset(s->next_picture.f->data, 0, sizeof(s->next_picture.f->data));
|
||||||
#endif
|
#endif
|
||||||
if (s->last_picture_ptr) {
|
if (s->last_picture_ptr) {
|
||||||
ff_mpeg_unref_picture(s->avctx, &s->last_picture);
|
|
||||||
if (s->last_picture_ptr->f->buf[0] &&
|
if (s->last_picture_ptr->f->buf[0] &&
|
||||||
(ret = ff_mpeg_ref_picture(s->avctx, &s->last_picture,
|
(ret = ff_mpeg_ref_picture(s->avctx, &s->last_picture,
|
||||||
s->last_picture_ptr)) < 0)
|
s->last_picture_ptr)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
if (s->next_picture_ptr) {
|
if (s->next_picture_ptr) {
|
||||||
ff_mpeg_unref_picture(s->avctx, &s->next_picture);
|
|
||||||
if (s->next_picture_ptr->f->buf[0] &&
|
if (s->next_picture_ptr->f->buf[0] &&
|
||||||
(ret = ff_mpeg_ref_picture(s->avctx, &s->next_picture,
|
(ret = ff_mpeg_ref_picture(s->avctx, &s->next_picture,
|
||||||
s->next_picture_ptr)) < 0)
|
s->next_picture_ptr)) < 0)
|
||||||
|
Reference in New Issue
Block a user