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 6A4F04A3C8 for ; Wed, 27 Mar 2024 12:53:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E5D7B68D66E; Wed, 27 Mar 2024 14:53:19 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5A4D068D22E for ; Wed, 27 Mar 2024 14:53:13 +0200 (EET) Authentication-Results: mail0.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=JD5h8zEh; dkim-atps=neutral Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 19AA5240DAC for ; Wed, 27 Mar 2024 13:53:13 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id lCn7qoSl_-qh for ; Wed, 27 Mar 2024 13:53:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1711543992; bh=W+IBKghuYxcvVy7dEcVVAFWnhyAP1XKjCJ4SRhGc6+k=; h=Subject:From:To:In-Reply-To:References:Date:From; b=JD5h8zEh2CM2FQdTTAAGLM+Ql932N/k4XPkEqU3uGxjdy7pqkv5rnsd7ZWzzmp0cQ qLh6Ra5TJ/m8blm6v9AQiJuqo+6eUycIUKdibRDtEoqTB8qzbdgtkGio1L52Mt99fm OZ316dMseuUHrIvDCm/3nmllSQjp8OGjPUi7ngwhRuZkehXq4rU9ePJ2Io8Y9hGlRr VxvsVn5ygz5i0RAAH9xecD60nNF+34LfUi6781JlCdesFWrCXyVkE44QDoESW6HkwF mDBbSK9xNRANdj3yI1ssTEVdGxL5QfX9lIe8HQLkk9ryhJ2aIVK5vr8bPYGpZcKvfR h2lMPV2AthhTA== Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (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 "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 6074A2404AF for ; Wed, 27 Mar 2024 13:53:12 +0100 (CET) Received: by lain.khirnov.net (Postfix, from userid 1000) id 4D56C1601B9; Wed, 27 Mar 2024 13:53:12 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <91da0313-e4c4-46e7-9379-30306ee3f0ca@noa-archive.com> References: <1711536691-15749-1-git-send-email-t.rapp@noa-archive.com> <1711536691-15749-2-git-send-email-t.rapp@noa-archive.com> <91da0313-e4c4-46e7-9379-30306ee3f0ca@noa-archive.com> Mail-Followup-To: FFmpeg development discussions and patches Date: Wed, 27 Mar 2024 13:53:12 +0100 Message-ID: <171154399229.7287.1645038161790058856@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 2/2] examples/decode_filter_video: Add loop for draining the filtergraph 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: Quoting Tobias Rapp (2024-03-27 13:46:40) > On 27/03/2024 13:06, Stefano Sabatini wrote: > > > On date Wednesday 2024-03-27 11:51:31 +0100, Tobias Rapp wrote: > >> Depending on the filters used the filtergraph can produce trailing data > >> after feeding it the last input frame. Update the example to include the > >> necessary loop for draining the filtergrap. > >> > >> Signed-off-by: Tobias Rapp > >> --- > >> doc/examples/decode_filter_video.c | 19 +++++++++++++++++++ > >> 1 file changed, 19 insertions(+) > >> > >> diff --git a/doc/examples/decode_filter_video.c b/doc/examples/decode_filter_video.c > >> index 454c192..a57e6df 100644 > >> --- a/doc/examples/decode_filter_video.c > >> +++ b/doc/examples/decode_filter_video.c > >> @@ -276,6 +276,25 @@ int main(int argc, char **argv) > >> } > >> av_packet_unref(packet); > >> } > >> + if (ret == AVERROR_EOF) { > >> + /* signal EOF to the filtergraph */ > >> + if (av_buffersrc_add_frame_flags(buffersrc_ctx, NULL, 0) < 0) { > >> + av_log(NULL, AV_LOG_ERROR, "Error while closing the filtergraph\n"); > >> + goto end; > >> + } > >> + > >> + /* pull remaining frames from the filtergraph */ > >> + while (1) { > >> + ret = av_buffersink_get_frame(buffersink_ctx, filt_frame); > >> + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) > >> + break; > > how are we supposed to handle the EAGAIN case? Shouldn't this be a > > sleep and retry? > > Good suggestion. I could add something like usleep(100) upon EAGAIN. No, EAGAIN from a filter after EOF on all inputs is a bug. -- Anton Khirnov _______________________________________________ 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".