From patchwork Fri May 22 16:56:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19807 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 B364644B729 for ; Fri, 22 May 2020 19:56:56 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 910AF68A303; Fri, 22 May 2020 19:56:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 424AA68A285 for ; Fri, 22 May 2020 19:56:50 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id A181028A64C for ; Fri, 22 May 2020 18:56:49 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id dm6BJviev6Da for ; Fri, 22 May 2020 18:56:48 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (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 "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id A4EA128A633 for ; Fri, 22 May 2020 18:56:48 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 5DA6122D91 for ; Fri, 22 May 2020 18:56:48 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id j4KOhb3dmDQ2 for ; Fri, 22 May 2020 18:56:46 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 4200920279 for ; Fri, 22 May 2020 18:56:46 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id E40BC20E008E; Fri, 22 May 2020 18:56:45 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 22 May 2020 18:56:42 +0200 Message-Id: <20200522165642.8766-1-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc/decode: do not use a context variable for function-local data 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" --- libavcodec/decode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index f3327d74af..dbecdf3f46 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -586,6 +586,7 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) int attribute_align_arg avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt) { AVCodecInternal *avci = avctx->internal; + AVPacket buffer_pkt = { NULL }; int ret; if (!avcodec_is_open(avctx) || !av_codec_is_decoder(avctx->codec)) @@ -597,16 +598,15 @@ int attribute_align_arg avcodec_send_packet(AVCodecContext *avctx, const AVPacke if (avpkt && !avpkt->size && avpkt->data) return AVERROR(EINVAL); - av_packet_unref(avci->buffer_pkt); if (avpkt && (avpkt->data || avpkt->side_data_elems)) { - ret = av_packet_ref(avci->buffer_pkt, avpkt); + ret = av_packet_ref(&buffer_pkt, avpkt); if (ret < 0) return ret; } - ret = av_bsf_send_packet(avci->bsf, avci->buffer_pkt); + ret = av_bsf_send_packet(avci->bsf, &buffer_pkt); if (ret < 0) { - av_packet_unref(avci->buffer_pkt); + av_packet_unref(&buffer_pkt); return ret; }