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 B6BA440FBE for ; Sat, 12 Feb 2022 00:14:29 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2879168B262; Sat, 12 Feb 2022 02:14:08 +0200 (EET) Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 26F9A68AEDA for ; Sat, 12 Feb 2022 02:14:00 +0200 (EET) Received: by mail-oo1-f46.google.com with SMTP id 189-20020a4a03c6000000b003179d7b30d8so12240334ooi.2 for ; Fri, 11 Feb 2022 16:14:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=7miZhR3SLJ2dBecRcnIU3FbqgEQTWcFsNeliC0o0EF0=; b=oVnYLQWGxPk7CZuTp6NHGsP3WTGKCb22fhTV+XdVdNpmHX27m8BVIyAIeru8GSFfJJ FzgX06eMfS74WFJJy0jeFj4e0p009tLacyTAxhfKzGQJ38CChwpVz829T7PQ8dAABFkf lXMJ/FxufEjPCCdObludTSPNw1xmFm5lTKUYSRXXauhJ0N6yuA+frKfA/ORGt9/QXThN 2yKLiMFOCBOGqMaKUMoa4IO2GQ969v/5ohoS3rSC+YAAbESwGi652rWDUvIYy+Kz6i/T IxjEk2boWMVotQXr753Eu805pIAcg/fLE2DSpfUPmYpc9v0Z0xd0Ldi5uB174KqH41rj YjIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7miZhR3SLJ2dBecRcnIU3FbqgEQTWcFsNeliC0o0EF0=; b=NpMDXhtylM6Jfo5DHUFFzVizEH2z6Lr2eCBygm/LJ4LeeZIBOo6nMsHFFTGgoZ2Imr /60BpMikcdo1gra4gtS4a+iYnlQ4VdJ5koL8rCuyCywhN6DmYhtEysvNfnlCkGq4in33 GTnnENMZy7OdLIWZUPX24vd3D5CrT/gHt1qdPM1MePWlHLNFfS/gb4M3S7ISv3NXal7C Xsaus4/A/HXGfkZHnJG1klnUO70wu4cRZyBNcoVHCPvYEQdKCquh1UFgDWno6yh92uBa MJbUA7D3oUthQoFqZHzr61FHLaM4s2R5zATwhwACYHs5/XJMQRxIj6pFhmdEONkH1hPy BdqQ== X-Gm-Message-State: AOAM531ejtpFiVdPiz/i5oYJAhfynOCcZyAcmaa51WRzuU0OwBWzqG1L 3Atht7+4yc6g2d8pchvScQqf02Vn5x0= X-Google-Smtp-Source: ABdhPJxE8EjTJLIrFlLEiCbBo8bCIwIlrqAhquR/Dovmz0OFLV3zl9ASDmoTwwt22s66f5Mnko+9DQ== X-Received: by 2002:a05:6870:1805:: with SMTP id t5mr973736oaf.164.1644624838490; Fri, 11 Feb 2022 16:13:58 -0800 (PST) Received: from localhost.localdomain ([191.83.214.101]) by smtp.gmail.com with ESMTPSA id k19sm9777448oot.41.2022.02.11.16.13.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 16:13:58 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Fri, 11 Feb 2022 21:13:00 -0300 Message-Id: <20220212001301.4090-3-jamrial@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220212001301.4090-1-jamrial@gmail.com> References: <20220212001301.4090-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/wrapped_avframe: stop hardcoding sizeof(AVFrame) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Use instead the new internal avpriv_avframe_size constant. This will ensure the actual size of AVFrame from the libavutil loaded at runtime is used instead. Signed-off-by: James Almer --- libavcodec/wrapped_avframe.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavcodec/wrapped_avframe.c b/libavcodec/wrapped_avframe.c index 004bd5e0e7..543d9f85eb 100644 --- a/libavcodec/wrapped_avframe.c +++ b/libavcodec/wrapped_avframe.c @@ -30,6 +30,7 @@ #include "libavutil/internal.h" #include "libavutil/frame.h" +#include "libavutil/frame_internal.h" #include "libavutil/buffer.h" #include "libavutil/pixdesc.h" @@ -44,7 +45,8 @@ static int wrapped_avframe_encode(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) { uint8_t *data; - int ret, size = sizeof(*frame) + AV_INPUT_BUFFER_PADDING_SIZE; + const size_t size = avpriv_avframe_size; + int ret; data = av_mallocz(size); if (!data) { @@ -53,7 +55,7 @@ static int wrapped_avframe_encode(AVCodecContext *avctx, AVPacket *pkt, // Set frame defaults av_frame_unref((AVFrame *)data); - pkt->buf = av_buffer_create(data, size, + pkt->buf = av_buffer_create(data, size + AV_INPUT_BUFFER_PADDING_SIZE, wrapped_avframe_release_buffer, NULL, AV_BUFFER_FLAG_READONLY); if (!pkt->buf) { @@ -68,7 +70,7 @@ static int wrapped_avframe_encode(AVCodecContext *avctx, AVPacket *pkt, } pkt->data = data; - pkt->size = sizeof(*frame); + pkt->size = size; pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; @@ -86,7 +88,7 @@ static int wrapped_avframe_decode(AVCodecContext *avctx, void *data, return AVERROR(EPERM); } - if (pkt->size < sizeof(AVFrame)) + if (pkt->size < avpriv_avframe_size) return AVERROR(EINVAL); in = (AVFrame*)pkt->data; -- 2.35.1 _______________________________________________ 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".