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 D50EC455F2 for ; Tue, 7 Feb 2023 08:43:34 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4F33D68BEE1; Tue, 7 Feb 2023 10:43:31 +0200 (EET) Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B568B68BE11 for ; Tue, 7 Feb 2023 10:43:24 +0200 (EET) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (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-202.mailbox.org (Postfix) with ESMTPS id 4P9xVL1yR1z9swp for ; Tue, 7 Feb 2023 09:43:22 +0100 (CET) Message-ID: Date: Tue, 7 Feb 2023 14:13:09 +0530 MIME-Version: 1.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20230204100121.6815-1-ffmpeg@gyani.pro> <167575737404.10789.1016094525223863600@lain.khirnov.net> <5919fecc-bb8e-43ae-8cf2-ad63d0a95ad4@gyani.pro> <167575883028.1179.2962715857403119894@lain.khirnov.net> From: Gyan Doshi In-Reply-To: <167575883028.1179.2962715857403119894@lain.khirnov.net> X-Rspamd-Queue-Id: 4P9xVL1yR1z9swp Subject: Re: [FFmpeg-devel] [PATCH] ffmpeg_mux: terminate stream thread queue only on sq_send EOF 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 2023-02-07 02:03 pm, Anton Khirnov wrote: > Quoting Gyan Doshi (2023-02-07 09:18:22) >> >> On 2023-02-07 01:39 pm, Anton Khirnov wrote: >>> Quoting Gyan Doshi (2023-02-04 11:01:21) >>>> Prior to 2d924b3a630, ffmpeg would exit if any packet write failed. >>>> After the switch to threaded mode for muxing, ffmpeg only closes that >>>> OutputStream instead of closng the file. This happens because EOF >>>> returned by write_packet isn't distinguished from EOF returned by sq_send, >>>> both relayed via sync_queue_process. >>>> >>>> This breaks the abort behaviour when there are multiple streams in an output, >>>> and can leave the ffmpeg process running beyond the intended point of abortion. >>>> >>>> Fixed by marking the OutputStream as finished upon sq_send EOF and letting >>>> write_packet EOF lead to muxer termination. >>> What is the situation you're handling exactly? >>> av_interleaved_write_frame() returns EOF? >> Yes. > How does that happen? Doesn't seem to me that muxers should do this. For repro, see this: https://ffmpeg.org/pipermail/ffmpeg-devel/2023-February/306247.html > Otherwise, I'm not a big fan of your patch since it adds yet more > overloading to ost->finished, which I'd like to remove actually. Not to > mention you manipulate it from the muxer thread, which is a race. > IMO this should be done without any context variables. How would one do that, in this case? I first thought of checking SyncQueue->stream[i]->finished but SyncQueueStream's declaration is private. Regards, Gyan _______________________________________________ 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".