From patchwork Tue Jan 11 20:45:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 33240 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp4048070iog; Tue, 11 Jan 2022 12:48:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxahTacVdbz9l5XyGO6xYj8OtHJRZLFEE6Hllj2zS9PBeWUCiP+mU6k6v4VdCCpzDyPfOuk X-Received: by 2002:a05:6402:712:: with SMTP id w18mr5984007edx.281.1641934112904; Tue, 11 Jan 2022 12:48:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641934112; cv=none; d=google.com; s=arc-20160816; b=CFjUZhj1FS4Z7fRhgMJZShyc6foZuWLHajoYsFfUgcZgQ4MKp2xWqcHdLaAvznJGOM ODn6n7438XdrE7lRHTu3qPRkYZNGqetmEHCqS5JCCHTNCzqFbk+3xoiD7KEuT7WYhGl7 loUtNgBVdaSzveiavoJslWWmEgr/Sj3R8SgySULIYPkpq4PLgJX4bg3p8z1abb+NKcbV jTP2261EWRh9lfiq6dMUC7eUR7whrL0R7k5DB80//Iz0fACDS34L+lJI/keXPrPSjOLC M7hkBHfgnh6J2rfdJBJkwilhpeBV/hd3dyLrP7L2bx6EEq8niMf9ZbcrNK0u3qtJzLz4 uRyg== 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:delivered-to; bh=SwgY4bikswTj5quNGmD1XrOhHFbWV3psLwA94/OgI/8=; b=OKdweqBo0Byyk3ySjyGtKAecI8Nrn8APNsFWfgSjWRwg0xFgnBW6PBh/M2kOn2JLoF W7KPJv8/gwrlnt9At7/vfrscHMqoG2d/uCVh+eyhGWP4T6/WBHqM3drYBs2E8HfNX9XQ HXvT0UwnUxgeqedyQqi3hkd+I6lYU6dqBq7RcSeARC7Y/rCW6oXRs4kwITY//nSE+XQ/ fw4MRg77W9gqjqwPmQu6LGGEUbp9WHJ7BcVspZf/ACjwzZ6vWDrLeAOQVPGPj3YSlO2b Cx8eY83DWYfNsWwPxluifAqZ6CG7sllL12j2oO7tHI48uHmRJRMma5ufhNs6RxUWrxF3 TF5A== ARC-Authentication-Results: i=1; mx.google.com; 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 b8si1656881edz.15.2022.01.11.12.48.32; Tue, 11 Jan 2022 12:48:32 -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; 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 30E2A68A6E0; Tue, 11 Jan 2022 22:47:39 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AB10A68AD15 for ; Tue, 11 Jan 2022 22:47:33 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id BA84D24017C for ; Tue, 11 Jan 2022 21:47:32 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id k2tsPITvZPIY for ; Tue, 11 Jan 2022 21:47:32 +0100 (CET) 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 mail0.khirnov.net (Postfix) with ESMTPS id 35C97240592 for ; Tue, 11 Jan 2022 21:47:26 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 228233A0A7F; Tue, 11 Jan 2022 21:47:25 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Jan 2022 21:45:49 +0100 Message-Id: <20220111204610.14262-14-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220111204610.14262-1-anton@khirnov.net> References: <20220111204610.14262-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 14/35] lavc/cuviddec: do not reallocate the fifo unnecessarily 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: JK3Y145G5sO3 --- libavcodec/cuviddec.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c index f03bbd8c4b..b1a3d674ab 100644 --- a/libavcodec/cuviddec.c +++ b/libavcodec/cuviddec.c @@ -1030,13 +1030,7 @@ static void cuvid_flush(AVCodecContext *avctx) if (ret < 0) goto error; - av_fifo_freep(&ctx->frame_queue); - - ctx->frame_queue = av_fifo_alloc(ctx->nb_surfaces * sizeof(CuvidParsedFrame)); - if (!ctx->frame_queue) { - av_log(avctx, AV_LOG_ERROR, "Failed to recreate frame queue on flush\n"); - return; - } + av_fifo_reset(ctx->frame_queue); if (ctx->cudecoder) { ctx->cvdl->cuvidDestroyDecoder(ctx->cudecoder);