[FFmpeg-devel] [PATCH] cmdutils: poison released unrefed video buffers.
Nicolas George
nicolas.george at normalesup.org
Sat Aug 18 10:35:29 CEST 2012
Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
cmdutils.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
Similar to the patch I sent yesterday, but this time the buffer is poisoned
when its refcount falls to 0 (sorry to have missed the refcount business),
should be correct.
The following FATE tests are broken by it:
filter-yadif-mode0
filter-yadif-mode1
h264-conformance-frext-hpcamolq_brcm_b
h264-conformance-frext-hpcvmolq_brcm_b
id-cin-video
mpeg2-field-enc
diff --git a/cmdutils.c b/cmdutils.c
index 6859692..c4a453c 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -1297,6 +1297,20 @@ static void unref_buffer(FrameBuffer *buf)
buf->refcount--;
if (!buf->refcount) {
FrameBuffer *tmp;
+
+#if CONFIG_MEMORY_POISONING
+ {
+ int i, vsub = av_pix_fmt_descriptors[buf->pix_fmt].log2_chroma_h;
+ for (i = 0; i < 4 && buf->data[i]; i++) {
+ int y, h = buf->h >> (i == 1 || i == 2 ? vsub : 0);
+ size_t size = av_image_get_linesize(buf->pix_fmt, buf->w, i);
+ uint8_t *data = buf->data[i];
+ for (y = 0; y < h; y++, data += buf->linesize[i])
+ memset(data, 0x2a, size);
+ }
+ }
+#endif
+
for(tmp= *pool; tmp; tmp= tmp->next)
av_assert1(tmp != buf);
--
1.7.10.4
More information about the ffmpeg-devel
mailing list