From cea3a63ba3d89d8403eef008f7a7c54d645cff70 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 17 Mar 2013 18:36:16 +0100 Subject: avutil/buffer: Fix race in pool. This race will always happen sooner or later in a multi-threaded environment and it will over time lead to OOM. This fix works by spinning, there are other ways by which this can be fixed, like simply detecting the issue after it happened and freeing the over-allocated memory or simply using a mutex. Signed-off-by: Michael Niedermayer --- libavutil/buffer_internal.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libavutil/buffer_internal.h') diff --git a/libavutil/buffer_internal.h b/libavutil/buffer_internal.h index b2602f8809..c29190839e 100644 --- a/libavutil/buffer_internal.h +++ b/libavutil/buffer_internal.h @@ -85,6 +85,8 @@ struct AVBufferPool { */ volatile int refcount; + volatile int nb_allocated; + int size; AVBufferRef* (*alloc)(int size); }; -- cgit v1.2.3