Commit 5f44f47b authored by Michael Niedermayer's avatar Michael Niedermayer

mpegvideo_enc: do not unreference frames before the code is done with them

Fixes Ticket2592
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 5292dac3
...@@ -1714,7 +1714,6 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) ...@@ -1714,7 +1714,6 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
* frame has been coded/decoded. */ * frame has been coded/decoded. */
void ff_MPV_frame_end(MpegEncContext *s) void ff_MPV_frame_end(MpegEncContext *s)
{ {
int i;
/* redraw edges for the frame if decoding didn't complete */ /* redraw edges for the frame if decoding didn't complete */
// just to make sure that all data is rendered. // just to make sure that all data is rendered.
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) {
...@@ -1763,13 +1762,6 @@ void ff_MPV_frame_end(MpegEncContext *s) ...@@ -1763,13 +1762,6 @@ void ff_MPV_frame_end(MpegEncContext *s)
assert(i < MAX_PICTURE_COUNT); assert(i < MAX_PICTURE_COUNT);
#endif #endif
if (s->encoding) {
/* release non-reference frames */
for (i = 0; i < MAX_PICTURE_COUNT; i++) {
if (!s->picture[i].reference)
ff_mpeg_unref_picture(s, &s->picture[i]);
}
}
// clear copies, to avoid confusion // clear copies, to avoid confusion
#if 0 #if 0
memset(&s->last_picture, 0, sizeof(Picture)); memset(&s->last_picture, 0, sizeof(Picture));
......
...@@ -1632,6 +1632,13 @@ vbv_retry: ...@@ -1632,6 +1632,13 @@ vbv_retry:
} else { } else {
s->frame_bits = 0; s->frame_bits = 0;
} }
/* release non-reference frames */
for (i = 0; i < MAX_PICTURE_COUNT; i++) {
if (!s->picture[i].reference)
ff_mpeg_unref_picture(s, &s->picture[i]);
}
assert((s->frame_bits & 7) == 0); assert((s->frame_bits & 7) == 0);
pkt->size = s->frame_bits / 8; pkt->size = s->frame_bits / 8;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment