diff mbox series

[FFmpeg-devel,1/2] avutil/buffer: use the default allocator if none is provided to av_buffer_pool_init2()

Message ID 20200601133508.1795-1-jamrial@gmail.com
State Accepted
Commit ec39c2276ac795d8221198d4e6e837beac016ff2
Headers show
Series [FFmpeg-devel,1/2] avutil/buffer: use the default allocator if none is provided to av_buffer_pool_init2() | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

James Almer June 1, 2020, 1:35 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 doc/APIchanges      | 3 +++
 libavutil/buffer.c  | 3 +++
 libavutil/version.h | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)

Comments

Anton Khirnov June 5, 2020, 10:10 a.m. UTC | #1
Quoting James Almer (2020-06-01 15:35:07)
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  doc/APIchanges      | 3 +++
>  libavutil/buffer.c  | 3 +++
>  libavutil/version.h | 2 +-
>  3 files changed, 7 insertions(+), 1 deletion(-)
> 

Looks ok
diff mbox series

Patch

diff --git a/doc/APIchanges b/doc/APIchanges
index fb5534b5f5..c7e4ce3e6a 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@  libavutil:     2017-10-21
 
 API changes, most recent first:
 
+2020-06-xx - xxxxxxxxxx - lavu 56.50.100 - buffer.h
+  Passing NULL as alloc argument to av_buffer_pool_init2() is now allowed.
+
 2020-xx-xx - xxxxxxxxxx - lavc 58.88.100 - avcodec.h codec.h
   Move AVCodec-related public API to new header codec.h.
 
diff --git a/libavutil/buffer.c b/libavutil/buffer.c
index 6d9cb7428e..b43cd179d7 100644
--- a/libavutil/buffer.c
+++ b/libavutil/buffer.c
@@ -229,6 +229,7 @@  AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
     pool->size      = size;
     pool->opaque    = opaque;
     pool->alloc2    = alloc;
+    pool->alloc     = av_buffer_alloc; // fallback
     pool->pool_free = pool_free;
 
     atomic_init(&pool->refcount, 1);
@@ -310,6 +311,8 @@  static AVBufferRef *pool_alloc_buffer(AVBufferPool *pool)
     BufferPoolEntry *buf;
     AVBufferRef     *ret;
 
+    av_assert0(pool->alloc || pool->alloc2);
+
     ret = pool->alloc2 ? pool->alloc2(pool->opaque, pool->size) :
                          pool->alloc(pool->size);
     if (!ret)
diff --git a/libavutil/version.h b/libavutil/version.h
index 7acecf5a97..5d5cec62ab 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@ 
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  56
-#define LIBAVUTIL_VERSION_MINOR  49
+#define LIBAVUTIL_VERSION_MINOR  50
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \