From patchwork Mon Jul 3 19:32:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 42416 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1e:b0:12b:9ae3:586d with SMTP id c30csp4589590pzh; Mon, 3 Jul 2023 12:34:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ42YjiP2APDKbEVMs7fUM5gSVVDIdPxugHk1m0pkWnVUve5QQ7BMZFkXdGsqu8+xHvA2pTD X-Received: by 2002:a17:907:9867:b0:97e:56d5:b885 with SMTP id ko7-20020a170907986700b0097e56d5b885mr6622202ejc.60.1688412852393; Mon, 03 Jul 2023 12:34:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688412852; cv=none; d=google.com; s=arc-20160816; b=UMJ4NNPLNs3GHhzzqLAQZs+2OJI2XvF4Vfy0qGd1ecGVBrHD199EZs81Pud4ivG9Jf OES/L2ir5WUPWS/eEpAIh1mdJ6t2gO3UiJwgCZM1PFW2schbHbqU7DR48jzMXoeGpv6g iSkQIzcsh+UUgCYHNG90WT4arKU7cn4+lL1xqNVQpd1SWpm8liRdTKSo3SuvTKA3HSET V6+WOrpwTjt4kinoeUPFRe8EJzJpGg+ar0Tvq5Mq8qYppstdiLDIERE9IlKu3T3vo41r +ntakiQNPTtLogSsOssjy8b8/EarbZWDUta8RdvMwjLYC8PalJoyl4xV58owlSP74y5e nJQw== 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=x6iayVBFthy93t1ltTyflhiTnfPG2D69x1Z8MnIL9TA=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=SWsyLOAlgQCeDwK1df4DuDQusgKkOXKWy9OTlJs/91/eE8vttE8hzDpZvaPOrG0BiC Ap7oyp+zoJFD+E0IGtC0fKQ+kZz3PWswtoqbySWzXSNgI6dgoroCYPoF9w5/h4zBMUic CBF3yGW/InLzjVh3Vb/7/wm7v/Gu0QEF7wnFirnGoqgY97Em4nMkZcvBsnVyYU7DJ9ug 7q0mazX20oCmRoexLw3NkQxLF/a5hoUjEFwL1G8zC5PUMem2Wf+3aLkjFBXbbLEmsZl3 7vo1m9scp+NVV3WKLeviwzDWYuNO11LAfjI1Dex11gpjjsxqSDyZkT3Taww8lXZbgJNg C0+w== 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 r20-20020a170906281400b00987d66e6d26si12593898ejc.250.2023.07.03.12.34.10; Mon, 03 Jul 2023 12:34:12 -0700 (PDT) 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 3BCA568C5CB; Mon, 3 Jul 2023 22:33:07 +0300 (EEST) 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 EACD268C5B0 for ; Mon, 3 Jul 2023 22:32:57 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id BE0ED2406CA for ; Mon, 3 Jul 2023 21:32:55 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id H1t79bWdwjkY for ; Mon, 3 Jul 2023 21:32:55 +0200 (CEST) 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 188D72406CB for ; Mon, 3 Jul 2023 21:32:52 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id DCF963A1A05 for ; Mon, 3 Jul 2023 21:32:45 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 3 Jul 2023 21:32:29 +0200 Message-Id: <20230703193229.8593-11-anton@khirnov.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230703193229.8593-1-anton@khirnov.net> References: <20230703193229.8593-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 10/10] lavc/decode: do not perform decoding when sending draining packets 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: ZhQJPhSfZwjG This way decoding errors will not be returned when the user starts draining the decoder, avoiding confusion over whether draining did or did not start. Fixes failures of fate-h264-attachment-631 for certain numbers of frame threads (e.g. 5). --- libavcodec/decode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 89c3c2a48d..269633ce10 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -674,7 +674,7 @@ int attribute_align_arg avcodec_send_packet(AVCodecContext *avctx, const AVPacke } else dc->draining_started = 1; - if (!avci->buffer_frame->buf[0]) { + if (!avci->buffer_frame->buf[0] && !dc->draining_started) { ret = decode_receive_frame_internal(avctx, avci->buffer_frame); if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) return ret;