From patchwork Mon Jun 1 13:35:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 20054 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id DCE4244B6B6 for ; Mon, 1 Jun 2020 16:35:30 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BA8CB689AB3; Mon, 1 Jun 2020 16:35:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F2857680415 for ; Mon, 1 Jun 2020 16:35:23 +0300 (EEST) Received: by mail-qt1-f175.google.com with SMTP id e16so7667085qtg.0 for ; Mon, 01 Jun 2020 06:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=YVFduDvD/OKdGOXarEEP7YpSOam7WzrDcohcBcE72lo=; b=fUlf565zn6yi4K1gcVfOxQFvsJYBHAywU/SO8P+OeMLBQk8geTIj/s3xpcfMDqchIY rie+LjrxRTJAMYEdu5gyQbLyBmplJ59Hinlg+zzOnCbYTmOtpLsdxj9pMBOHAes4mMmX foMUhU5iWEWDcI6vm71IE1eqtbQvdgf6+S9064vhBCbNSO+QlHcU+glqBC7f6zrbYWlY gauuwjww673POKChYgRsApyQNp3Qk+DBZ1EkTXVtdTWLALMqb/Nldp9lfQ2BlwMPTcL4 sSihKpok2hjrULK7oMkGc4y0MFoY1nMEXBwBDJ7yNqNdW4VL4+TlBnfXvhgN2LIe2NuS Olhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=YVFduDvD/OKdGOXarEEP7YpSOam7WzrDcohcBcE72lo=; b=pwAbCF4R+O/oluyJW5W1H/HxQn/kSdgzp1ZHDfJoyxmWM0eIaS7grP4pkUiZR+1umz oTyLdOlLor5haT+20YDLwYU6SWVaz9ZHxOik3P23cz0mocNzgYYtPcqDVIkAkTT/whA0 JsJ2Vijye8GLA6icdEu7DcH8lKgKFTGbUpsksiv2PYlnD5Sso6dPK4bV2G0LJDPDSP00 4IeVbnUmH6eeKVRJRofokb6QrYiS18eOOKN3UmlhY3BzLTxd1G3m9mbClt7u+ojjz8KC LNjVmWJQ7ZnqMNECBSzs0HycjdNJdjc9kArm7JbRKfo3NYXp4nI8UgZUuMZnWRh1rJKO Smcg== X-Gm-Message-State: AOAM530ZEWIgZk8DNyHUBnvmxKZETjugQYR52hiF7+xnyUi49TFnVz+k d46veBqYpPiFBQF2GghkHgY5lcZw X-Google-Smtp-Source: ABdhPJz+wTw/25Ka7eZyO+udJt+0SUU1dileFIBe2DmZwJWrdW5tF2vcI+Bgq81f2oArf7Wa5B8Uig== X-Received: by 2002:aed:3fb4:: with SMTP id s49mr22572845qth.16.1591018522078; Mon, 01 Jun 2020 06:35:22 -0700 (PDT) Received: from localhost.localdomain ([181.23.72.208]) by smtp.gmail.com with ESMTPSA id d140sm13584055qkc.22.2020.06.01.06.35.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2020 06:35:21 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 1 Jun 2020 10:35:07 -0300 Message-Id: <20200601133508.1795-1-jamrial@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avutil/buffer: use the default allocator if none is provided to av_buffer_pool_init2() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: James Almer --- doc/APIchanges | 3 +++ libavutil/buffer.c | 3 +++ libavutil/version.h | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) 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, \