aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-04-29 13:24:18 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-04-29 13:26:33 +0200
commitd3a5dba81b3a0ab79df38751d31a6e7d8e251654 (patch)
treea31d42cacab4ed5a6512ecb61e130c31c44e9eba /libavcodec
parentab7ad5e6a1b8359b169e7bcbe96ce7162d0c0002 (diff)
parent11f024ef0ab923ed8680fc35a087d576e549c849 (diff)
downloadffmpeg-d3a5dba81b3a0ab79df38751d31a6e7d8e251654.tar.gz
Merge commit '11f024ef0ab923ed8680fc35a087d576e549c849'
* commit '11f024ef0ab923ed8680fc35a087d576e549c849': h264: move freeing the escaped RBSP buffer to free_context() Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c15
-rw-r--r--libavcodec/h264.h2
-rw-r--r--libavcodec/h264_slice.c4
3 files changed, 9 insertions, 12 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 61ad63733b..87a27e2c21 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -352,7 +352,7 @@ static int decode_rbsp_trailing(H264Context *h, const uint8_t *src)
return 0;
}
-void ff_h264_free_tables(H264Context *h, int free_rbsp)
+void ff_h264_free_tables(H264Context *h)
{
int i;
@@ -392,11 +392,6 @@ void ff_h264_free_tables(H264Context *h, int free_rbsp)
sl->edge_emu_buffer_allocated = 0;
sl->top_borders_allocated[0] = 0;
sl->top_borders_allocated[1] = 0;
-
- if (free_rbsp) {
- av_freep(&sl->rbsp_buffer);
- sl->rbsp_buffer_size = 0;
- }
}
}
@@ -453,7 +448,7 @@ int ff_h264_alloc_tables(H264Context *h)
return 0;
fail:
- ff_h264_free_tables(h, 1);
+ ff_h264_free_tables(h);
return AVERROR(ENOMEM);
}
@@ -1097,7 +1092,7 @@ static void flush_dpb(AVCodecContext *avctx)
h->mb_y = 0;
- ff_h264_free_tables(h, 1);
+ ff_h264_free_tables(h);
h->context_initialized = 0;
}
@@ -1853,7 +1848,7 @@ av_cold void ff_h264_free_context(H264Context *h)
{
int i;
- ff_h264_free_tables(h, 1); // FIXME cleanup init stuff perhaps
+ ff_h264_free_tables(h); // FIXME cleanup init stuff perhaps
if (h->DPB) {
for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)
@@ -1864,6 +1859,8 @@ av_cold void ff_h264_free_context(H264Context *h)
h->cur_pic_ptr = NULL;
+ for (i = 0; i < h->nb_slice_ctx; i++)
+ av_freep(&h->slice_ctx[i].rbsp_buffer);
av_freep(&h->slice_ctx);
h->nb_slice_ctx = 0;
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 5026ab2ddf..12e5245c19 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -1184,7 +1184,7 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
void ff_h264_flush_change(H264Context *h);
-void ff_h264_free_tables(H264Context *h, int free_rbsp);
+void ff_h264_free_tables(H264Context *h);
void ff_h264_set_erpic(ERPicture *dst, H264Picture *src);
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 7551df7da5..24f5bd43d6 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1090,7 +1090,7 @@ static int h264_slice_header_init(H264Context *h, int reinit)
}
if (reinit)
- ff_h264_free_tables(h, 0);
+ ff_h264_free_tables(h);
h->first_field = 0;
h->prev_interlaced_frame = 1;
@@ -1170,7 +1170,7 @@ static int h264_slice_header_init(H264Context *h, int reinit)
return 0;
fail:
- ff_h264_free_tables(h, 0);
+ ff_h264_free_tables(h);
h->context_initialized = 0;
return ret;
}