From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 82A9849022 for ; Wed, 1 May 2024 20:45:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4B34468D73F; Wed, 1 May 2024 23:45:47 +0300 (EEST) Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3358868D642 for ; Wed, 1 May 2024 23:45:40 +0300 (EEST) Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-6eced6fd98aso6390191b3a.0 for ; Wed, 01 May 2024 13:45:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714596338; x=1715201138; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=aePD0DfdcSXfgYyMdhi7kH08nnxRp/NWeD45nmn7THs=; b=OyZbXt7NGnK1eHd+lx24qwWgV29HmakOtFUK1wQ240ij5fKOk5a0X0xjA9HiWYJpyr A5vSV9SfHlBIASvPXTuCfnjMKTJbx+j1FlQoViCO0vMqOWa4w/7ol+DVutntMSwtIVKF i9iOOt/avKOP80Nn+qzTpD4fp8+N6EZ05cFwdEdKgRz6xjUKOvkEyoVA3XheFVEp8Qxd pK7k0t6jeXqi9LSMG3R5ImiAVxJ/QeJP8DkyNFgBwdfStHpJymtJNGlnX9aUlRAiPggh hQbt3owp+Tn8uwG6/LFeqvyJRmnipLtLkgOsMuKZylJcYXIhIJFnAIt+8mrObzRmIJfR FB8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714596338; x=1715201138; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aePD0DfdcSXfgYyMdhi7kH08nnxRp/NWeD45nmn7THs=; b=rGIoj/rbbo6GPfcovD2OMl/gDYaqTnvCFJr47kWdLna0NuZ/LRBRE7SM85bVmUlLWv lMU9Ds7cQVDuLH8u9oPlfDpsBW30kfxW1sa9bWfRkNd6Z2zuCgcxOKHQbTgfWUR70TDm O9I3IhIyr1uzGlYH2nGEpWQDi57PCEqNfAEu00qrAnpoUbpTtMq7oU9Dy7MGvBsTy5Pt P0Oo4zjYzZeIcGkMaSSbDMQSQXJLW1MxQuGh2hDWwnhfIeXT1MwfvPlDCD5sSpDi48O8 n11s4PC3VScrXjtQD/BntwJnp2SHwYasxtrRtm1P9opJlh7RuDSINUpZ9uQPuHRPtV7y sn4w== X-Gm-Message-State: AOJu0YxiyJ86gun9w27imy6FsCCX+KicUw/zk8wfrIy9G2nV9wnbgFSV 14kOqmap5SvPrwH0wX4d7GvgimnckiDqJTVpWNEESXKBcKfNzZAIiFkXOw== X-Google-Smtp-Source: AGHT+IFDkN0dtHvZ6N2N3gWVED0LP/2VJTunPmemnrgDCcMN32HzRTprcw81GdlvRdJ8KrPwHRlwig== X-Received: by 2002:a05:6a00:2d90:b0:6f3:e720:cead with SMTP id fb16-20020a056a002d9000b006f3e720ceadmr162110pfb.5.1714596337286; Wed, 01 May 2024 13:45:37 -0700 (PDT) Received: from [192.168.0.10] ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id c18-20020a056a000ad200b006f40ab1250fsm4778239pfl.74.2024.05.01.13.45.35 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 May 2024 13:45:36 -0700 (PDT) Message-ID: Date: Wed, 1 May 2024 17:45:34 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: <20240501190156.36095-1-jamrial@gmail.com> <20240501190156.36095-3-jamrial@gmail.com> Content-Language: en-US From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 3/3] avcodec/avcodec: free decoded_side_data in ff_codec_close() when decoding 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 5/1/2024 5:43 PM, Andreas Rheinhardt wrote: > James Almer: >> It's set by the library, so it should be freed when closing the context. >> >> Signed-off-by: James Almer >> --- >> libavcodec/avcodec.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c >> index e560efff6a..189a0a2193 100644 >> --- a/libavcodec/avcodec.c >> +++ b/libavcodec/avcodec.c >> @@ -463,7 +463,9 @@ av_cold void ff_codec_close(AVCodecContext *avctx) >> av_freep(&avctx->coded_side_data[i].data); >> av_freep(&avctx->coded_side_data); >> avctx->nb_coded_side_data = 0; >> - } >> + } else if (av_codec_is_decoder(avctx->codec)) >> + av_frame_side_data_free(&avctx->decoded_side_data, >> + &avctx->nb_decoded_side_data); >> >> av_buffer_unref(&avctx->hw_frames_ctx); >> av_buffer_unref(&avctx->hw_device_ctx); > > The documentation actually states that it is "owned and freed by the > encoder" for encoding, so your restriction to decoders is wrong. And > without it, the corresponding code in avcodec_free_context() is redundant. > > - Andreas Do you suggest freeing it in ff_codec_close() for both scenarios then? _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".