aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2011-01-22 14:42:56 +0000
committerMichael Niedermayer <michaelni@gmx.at>2011-01-23 19:32:08 +0100
commit2ed0f76655a76cc49f8a1a1d59e545f5906e7924 (patch)
tree491e29143345dd0061b45e14c8e0572a42b96da3 /libavcodec
parent60c99b55108b964f49b2bb96918d26dd8263a4e7 (diff)
downloadffmpeg-2ed0f76655a76cc49f8a1a1d59e545f5906e7924.tar.gz
Fix crash on resolution change (issue 2393).
Don't free RBSP tables (containing decoded NAL units) on resolution change, because we actually need this data to decode the frame after reiniting (with new resolution). Fixed issue 2393. Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net> (cherry picked from commit 9107892624c8f9978489ab5b4c0ef2fc5637fb62)
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 52a161bde7..1990d5d6c5 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -614,7 +614,7 @@ static void hl_motion(H264Context *h, uint8_t *dest_y, uint8_t *dest_cb, uint8_t
}
-static void free_tables(H264Context *h){
+static void free_tables(H264Context *h, int free_rbsp){
int i;
H264Context *hx;
av_freep(&h->intra4x4_pred_mode);
@@ -637,10 +637,12 @@ static void free_tables(H264Context *h){
av_freep(&hx->top_borders[1]);
av_freep(&hx->top_borders[0]);
av_freep(&hx->s.obmc_scratchpad);
+ if (free_rbsp){
av_freep(&hx->rbsp_buffer[1]);
av_freep(&hx->rbsp_buffer[0]);
hx->rbsp_buffer_size[0] = 0;
hx->rbsp_buffer_size[1] = 0;
+ }
if (i) av_freep(&h->thread_context[i]);
}
}
@@ -748,7 +750,7 @@ int ff_h264_alloc_tables(H264Context *h){
return 0;
fail:
- free_tables(h);
+ free_tables(h, 1);
return -1;
}
@@ -1776,7 +1778,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|| av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio))) {
if(h != h0)
return -1; // width / height changed during parallelized decoding
- free_tables(h);
+ free_tables(h, 0);
flush_dpb(s->avctx);
MPV_common_end(s);
}
@@ -3331,7 +3333,7 @@ av_cold void ff_h264_free_context(H264Context *h)
{
int i;
- free_tables(h); //FIXME cleanup init stuff perhaps
+ free_tables(h, 1); //FIXME cleanup init stuff perhaps
for(i = 0; i < MAX_SPS_COUNT; i++)
av_freep(h->sps_buffers + i);