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 CC9244BD76 for ; Tue, 16 Jul 2024 18:15:42 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D104368DB32; Tue, 16 Jul 2024 21:14:21 +0300 (EEST) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8503E68DA6E for ; Tue, 16 Jul 2024 21:14:04 +0300 (EEST) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=P++5IPOD; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 28B994E08 for ; Tue, 16 Jul 2024 19:16:35 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 3pGJaxPViwmv for ; Tue, 16 Jul 2024 19:16:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1721150188; bh=9eQCjMMRjJ96MuKQP3MZfPaUaH8SscxNArllW77p49A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=P++5IPODK8ICT6pAk2h2jtNECMoy8uFM78e11bS30uNej9c3dP/AnsajpOXVkit2s xkTxIzgI6g7MAdlGn4XGfGo90sEvXHN7QXnKTXfuyDL9CGDXT6ZXnz4WQeyI1CI9VK G21Wb5BeLOMJI3sloHI+fZhnxCJnzRgskn6QHE/OQDxqoMQS1uvTI/xK49ZP+MCE6e NvxZgbDbKXDh1wyKANPeEgL8Uncmtvd7Iqd2htSijAaToGnNNuELCess4rU75+FwMw uJwidNJbJU7i7WgD/O/aBh52awxrLlvouMcso/BAgh+gQ7RZV213joIN8pwUcfj08t 2A0OnYX7xcLIg== 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 mail1.khirnov.net (Postfix) with ESMTPS id BFCFA4E0B for ; Tue, 16 Jul 2024 19:16:28 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 8FEB43A2E98 for ; Tue, 16 Jul 2024 19:16:21 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 16 Jul 2024 19:11:45 +0200 Message-ID: <20240716171155.31838-30-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240716171155.31838-1-anton@khirnov.net> References: <20240716171155.31838-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 30/39] lavc/internal: document the precise meaning of AVCodecInternal.draining 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: Also, set draining=1 in case a bitstream filter returns an internally-triggered EOF. While no bitstream filters currently inserted by decoders will do that, that may change in the future and it is better to cover this case. --- libavcodec/decode.c | 12 +++++------- libavcodec/internal.h | 6 +++++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 791940648d..6ad74bd94b 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -213,8 +213,6 @@ static int decode_get_packet(AVCodecContext *avctx, AVPacket *pkt) int ret; ret = av_bsf_receive_packet(avci->bsf, pkt); - if (ret == AVERROR_EOF) - avci->draining = 1; if (ret < 0) return ret; @@ -247,14 +245,14 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt) if (ret == AVERROR(EAGAIN) && (!AVPACKET_IS_EMPTY(avci->buffer_pkt) || dc->draining_started)) { ret = av_bsf_send_packet(avci->bsf, avci->buffer_pkt); - if (ret < 0) { - av_packet_unref(avci->buffer_pkt); - return ret; - } + if (ret >= 0) + continue; - continue; + av_packet_unref(avci->buffer_pkt); } + if (ret == AVERROR_EOF) + avci->draining = 1; return ret; } } diff --git a/libavcodec/internal.h b/libavcodec/internal.h index bc20a797ae..d7b0b9f880 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -123,7 +123,11 @@ typedef struct AVCodecInternal { void *hwaccel_priv_data; /** - * checks API usage: after codec draining, flush is required to resume operation + * decoding: AVERROR_EOF has been returned from ff_decode_get_packet(); must + * not be used by decoders that use the decode() callback, as they + * do not call ff_decode_get_packet() directly. + * + * encoding: a flush frame has been submitted to avcodec_send_frame(). */ int draining; -- 2.43.0 _______________________________________________ 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".