From 5f129a05bf69d5655ae6d6ea82ca1a97f0b1913f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 25 Sep 2008 19:01:39 +0000 Subject: [PATCH] Do not free sps & pps on width/height changes. Fixes issue557. Originally committed as revision 15414 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/h264.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index d2daba1f66..c4a452810b 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2034,12 +2034,6 @@ static void free_tables(H264Context *h){ av_freep(&h->mb2b_xy); av_freep(&h->mb2b8_xy); - for(i = 0; i < MAX_SPS_COUNT; i++) - av_freep(h->sps_buffers + i); - - for(i = 0; i < MAX_PPS_COUNT; i++) - av_freep(h->pps_buffers + i); - for(i = 0; i < h->s.avctx->thread_count; i++) { hx = h->thread_context[i]; if(!hx) continue; @@ -7920,10 +7914,18 @@ static av_cold int decode_end(AVCodecContext *avctx) { H264Context *h = avctx->priv_data; MpegEncContext *s = &h->s; + int i; av_freep(&h->rbsp_buffer[0]); av_freep(&h->rbsp_buffer[1]); free_tables(h); //FIXME cleanup init stuff perhaps + + for(i = 0; i < MAX_SPS_COUNT; i++) + av_freep(h->sps_buffers + i); + + for(i = 0; i < MAX_PPS_COUNT; i++) + av_freep(h->pps_buffers + i); + MPV_common_end(s); // memset(h, 0, sizeof(H264Context));