From patchwork Fri Feb 23 13:58:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 46474 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:26a3:b0:19e:cdac:8cce with SMTP id h35csp993657pze; Fri, 23 Feb 2024 06:34:17 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV9T5KD6E1EdVghWe9bE1ytKQDKKa67TeZc56S2/JG7lcRXkDsTOlAVu5NW7IXN5qqXBrO+hTrxbD9J2KvQk9NDlKnnfQ56H4+yGw== X-Google-Smtp-Source: AGHT+IGIl84Lf89/84F8B6fWiZuGfXKsMcZSQiW4xrDiNV5dmzJ8/lZypBejWyknloloCn4ZvRo2 X-Received: by 2002:aa7:cf19:0:b0:565:552a:6f8f with SMTP id a25-20020aa7cf19000000b00565552a6f8fmr17071edy.7.1708698856727; Fri, 23 Feb 2024 06:34:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708698856; cv=none; d=google.com; s=arc-20160816; b=U0iv4sxHrz3yo2B6SSk5T9X+2eCurUzKTpI0Zpt85FLNfzb8gceOR88qZE0RtzVCpS nB5hQZ6bl1yMsDFqTIVRmjE6Dz4fQ0NyAMMda/Yle6BgT0NWnCPyuSYLOCGz2oomIqsx 6WZqlJOuE7fz5Kg8prNOtu0NuQaDOp5FRZa0w7Ze4G6A9S7BMGLr3q5cu6At7tyRBhmZ Y/Splm5gocgnM6NAhCDRguLHEjyMTnYWPgfRuQvSjEtCgJVHcQ3QqkDLOueWIJCRcvoA RShTcmaCtcvHgWtZF5fBnUVI7Y9pv8c2oZHABhCcxgBaYDMExleZZJ7SuXOhxFlyEDEI kF/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=NuZN8dON9lPo5cTFZeZsGjIMGaK4uJP8sF1jBWo95ZY=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=KDpkdIs9Ohq0EPM6LGWWmSVHenpDqOsxcF8iNKC7orwbqyoS1XUAEm8cBKiJ24FzKF IWAE10AA1uCm9mJNeyi70KtqBYfJfC4eoen2Jagqneg7XkRzFEP1H42u8NsYyEN6O01b 5l5P+geNvSmCRzqJklikg18cqlnLk+kOtpnITYMdDWpKV2cJYUwQ4Ftl15BYtsPMMMlx NDUNU18cegovRL7Ok22OQrYhfL+iIx/wqMd8w0glYjrDnN/m0/leXkgKvz31IgHDjBgg ufo9RY3lAG6C70pVQ7hh8EyHnsMiu9lX4z39hr36cjOF2M1gYYdgvbKGjVM9JXX4BX/e yzwA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=JxwxgWVN; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y2-20020a056402358200b00564f1974a0esi108012edc.137.2024.02.23.06.34.16; Fri, 23 Feb 2024 06:34:16 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=JxwxgWVN; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3849C68CA4C; Fri, 23 Feb 2024 16:31:56 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CDA5A68C678 for ; Fri, 23 Feb 2024 16:31:35 +0200 (EET) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=JxwxgWVN; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id D809F4D56 for ; Fri, 23 Feb 2024 15:31:34 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 8eNjxOkhSVvC for ; Fri, 23 Feb 2024 15:31:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1708698688; bh=FFAKXREVXCglj8KQRSP6QOwI2Pk2FS1jIukyFGIv9zU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JxwxgWVNc+9IRwgF7X5IM/62FkCCGsSaczFCjjMls5ShzdPxswdjiRjWUBfat2iti eWxpJ92F7s+9uzM2fJj+J/ByAOGRA7JgJCWfTDFobpumABmmkFWkUUlGgEHfNNj8QX kfCkecm1CKrfsSaa8pCtkVON6lABt+Nfia5opnqbYOsVFOjBJsuToPUS9rn8f3f5iW ZGj84ghwK5WxRJSPtgbCQgl1sKZA7HVpyMIavqvA90xXhnsHJba/XDQIng5A40n3Bv iXi1E0n5Sq0tuKa6oGpAMOU5SngWV6N3wYjXlq1Di5P6yqEfNOBXPqsQ+0h69CVX2l 6rioU+87hR+jQ== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id DE81A4D59 for ; Fri, 23 Feb 2024 15:31:27 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id EADCB3A21E7 for ; Fri, 23 Feb 2024 15:31:22 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 23 Feb 2024 14:58:46 +0100 Message-ID: <20240223143115.16521-25-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240223143115.16521-1-anton@khirnov.net> References: <20240223143115.16521-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 24/38] avcodec/libjxldec: respect side data preference X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: Qxz6cos2pZtt From: Niklas Haas Also fixes a memory leak where the side data was previously not properly cleaned up on OOM, although we now unfortunately don't distinguish between OOM and overriden side data. Signed-off-by: Anton Khirnov --- libavcodec/libjxldec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c index b830eee784..e1dda99b73 100644 --- a/libavcodec/libjxldec.c +++ b/libavcodec/libjxldec.c @@ -483,9 +483,9 @@ static int libjxl_receive_frame(AVCodecContext *avctx, AVFrame *frame) /* full image is one frame, even if animated */ av_log(avctx, AV_LOG_DEBUG, "FULL_IMAGE event emitted\n"); if (ctx->iccp) { - AVFrameSideData *sd = av_frame_new_side_data_from_buf(ctx->frame, AV_FRAME_DATA_ICC_PROFILE, ctx->iccp); + AVFrameSideData *sd = ff_frame_new_side_data_from_buf(avctx, ctx->frame, AV_FRAME_DATA_ICC_PROFILE, ctx->iccp); if (!sd) - return AVERROR(ENOMEM); + av_buffer_unref(&ctx->iccp); /* ownership is transfered, and it is not ref-ed */ ctx->iccp = NULL; }