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 0CB804490A for ; Thu, 2 Feb 2023 18:07:26 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B6DCF68BD9D; Thu, 2 Feb 2023 20:07:22 +0200 (EET) Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BFEA268BB9A for ; Thu, 2 Feb 2023 20:07:14 +0200 (EET) Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4P76FD2D5Jz9sTs for ; Thu, 2 Feb 2023 19:07:12 +0100 (CET) From: Gyan Doshi To: ffmpeg-devel@ffmpeg.org Date: Thu, 2 Feb 2023 23:36:42 +0530 Message-Id: <20230202180642.3479-1-ffmpeg@gyani.pro> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/tee: signal EOF if no more output is to be published. 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: Prior to 2d924b3a630, ffmpeg.c would exit if any packet write failed. tee's write_packet seemingly relied on that to enforce its abort failure policy. >From 2d924b3a630, ffmpeg only closes that OutputStream and keeps on sending packets of other streams. This breaks the abort behaviour with the tee muxer when there are multiple streams, leaving the ffmpeg process running beyond the intended point of abortion. Fixed by signaling EOF in tee's write_packet if an abort is required. --- libavformat/tee.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/tee.c b/libavformat/tee.c index dd408dd096..8362cdc972 100644 --- a/libavformat/tee.c +++ b/libavformat/tee.c @@ -54,6 +54,7 @@ typedef struct TeeContext { const AVClass *class; unsigned nb_slaves; unsigned nb_alive; + int abort; TeeSlave *slaves; int use_fifo; AVDictionary *fifo_options; @@ -438,6 +439,7 @@ static int tee_process_slave_failure(AVFormatContext *avf, unsigned slave_idx, i return err_n; } else if (tee_slave->on_fail == ON_SLAVE_FAILURE_ABORT) { av_log(avf, AV_LOG_ERROR, "Slave muxer #%u failed, aborting.\n", slave_idx); + tee->abort = 1; return err_n; } else { av_log(avf, AV_LOG_ERROR, "Slave muxer #%u failed: %s, continuing with %u/%u slaves.\n", @@ -599,7 +601,7 @@ static int tee_write_packet(AVFormatContext *avf, AVPacket *pkt) ret_all = ret; } } - return ret_all; + return (tee->abort || !tee->nb_alive) ? AVERROR_EOF : ret_all; } const AVOutputFormat ff_tee_muxer = { -- 2.39.1 _______________________________________________ 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".