diff --git a/libavfilter/audio.c b/libavfilter/audio.c index 7d87e9e9a0..308d04cf43 100644 --- a/libavfilter/audio.c +++ b/libavfilter/audio.c @@ -51,8 +51,8 @@ AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples) int align = av_cpu_max_align(); if (!li->frame_pool) { - li->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels, - nb_samples, link->format, align); + li->frame_pool = ff_frame_pool_audio_init(channels, nb_samples, + link->format, align); if (!li->frame_pool) return NULL; } else { @@ -71,8 +71,8 @@ AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples) pool_format != link->format || pool_align != align) { ff_frame_pool_uninit(&li->frame_pool); - li->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels, - nb_samples, link->format, align); + li->frame_pool = ff_frame_pool_audio_init(channels, nb_samples, + link->format, align); if (!li->frame_pool) return NULL; } diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c index 15ea66cdc6..d0d8dceffa 100644 --- a/libavfilter/framepool.c +++ b/libavfilter/framepool.c @@ -49,8 +49,7 @@ struct FFFramePool { }; -av_cold FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size), - int width, int height, +av_cold FFFramePool *ff_frame_pool_video_init(int width, int height, enum AVPixelFormat format, int align) { @@ -97,7 +96,10 @@ av_cold FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size) for (i = 0; i < 4 && sizes[i]; i++) { if (sizes[i] > SIZE_MAX - align) goto fail; - pool->pools[i] = av_buffer_pool_init(sizes[i] + align, alloc); + pool->pools[i] = av_buffer_pool_init(sizes[i] + align, + CONFIG_MEMORY_POISONING + ? NULL + : av_buffer_allocz); if (!pool->pools[i]) goto fail; } @@ -109,8 +111,7 @@ fail: return NULL; } -av_cold FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(size_t size), - int channels, int nb_samples, +av_cold FFFramePool *ff_frame_pool_audio_init(int channels, int nb_samples, enum AVSampleFormat format, int align) { @@ -137,7 +138,8 @@ av_cold FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(size_t size) if (pool->linesize[0] > SIZE_MAX - align) goto fail; - pool->pools[0] = av_buffer_pool_init(pool->linesize[0] + align, alloc); + pool->pools[0] = av_buffer_pool_init(pool->linesize[0] + align, + av_buffer_allocz); if (!pool->pools[0]) goto fail; diff --git a/libavfilter/framepool.h b/libavfilter/framepool.h index 2bef1fe0b6..f18d3c1536 100644 --- a/libavfilter/framepool.h +++ b/libavfilter/framepool.h @@ -35,17 +35,13 @@ typedef struct FFFramePool FFFramePool; /** * Allocate and initialize a video frame pool. * - * @param alloc a function that will be used to allocate new frame buffers when - * the pool is empty. May be NULL, then the default allocator will be used - * (av_buffer_alloc()). * @param width width of each frame in this pool * @param height height of each frame in this pool * @param format format of each frame in this pool * @param align buffers alignment of each frame in this pool * @return newly created video frame pool on success, NULL on error. */ -FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size), - int width, +FFFramePool *ff_frame_pool_video_init(int width, int height, enum AVPixelFormat format, int align); @@ -53,17 +49,13 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size), /** * Allocate and initialize an audio frame pool. * - * @param alloc a function that will be used to allocate new frame buffers when - * the pool is empty. May be NULL, then the default allocator will be used - * (av_buffer_alloc()). * @param channels channels of each frame in this pool * @param nb_samples number of samples of each frame in this pool * @param format format of each frame in this pool * @param align buffers alignment of each frame in this pool * @return newly created audio frame pool on success, NULL on error. */ -FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(size_t size), - int channels, +FFFramePool *ff_frame_pool_audio_init(int channels, int samples, enum AVSampleFormat format, int align); diff --git a/libavfilter/video.c b/libavfilter/video.c index 3f23a12c07..2727b2c28d 100644 --- a/libavfilter/video.c +++ b/libavfilter/video.c @@ -71,10 +71,7 @@ AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int alig } if (!li->frame_pool) { - li->frame_pool = ff_frame_pool_video_init(CONFIG_MEMORY_POISONING - ? NULL - : av_buffer_allocz, - w, h, link->format, align); + li->frame_pool = ff_frame_pool_video_init(w, h, link->format, align); if (!li->frame_pool) return NULL; } else { @@ -89,10 +86,7 @@ AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int alig pool_format != link->format || pool_align != align) { ff_frame_pool_uninit(&li->frame_pool); - li->frame_pool = ff_frame_pool_video_init(CONFIG_MEMORY_POISONING - ? NULL - : av_buffer_allocz, - w, h, link->format, align); + li->frame_pool = ff_frame_pool_video_init(w, h, link->format, align); if (!li->frame_pool) return NULL; }