Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Gyan Doshi <ffmpeg@gyani.pro>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] ffmpeg_mux: terminate stream thread queue only on sq_send EOF
Date: Tue, 7 Feb 2023 14:13:09 +0530
Message-ID: <d1246f2d-a0c7-4241-d3f4-dbe43e56a572@gyani.pro> (raw)
In-Reply-To: <167575883028.1179.2962715857403119894@lain.khirnov.net>



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".

  reply	other threads:[~2023-02-07  8:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-04 10:01 Gyan Doshi
2023-02-07  8:09 ` Anton Khirnov
2023-02-07  8:18   ` Gyan Doshi
2023-02-07  8:33     ` Anton Khirnov
2023-02-07  8:43       ` Gyan Doshi [this message]
2023-02-09 15:57         ` [FFmpeg-devel] [PATCH] fftools/ffmpeg_mux: distinguish between sync queue and muxer EOF Anton Khirnov
2023-02-09 16:16           ` Gyan Doshi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d1246f2d-a0c7-4241-d3f4-dbe43e56a572@gyani.pro \
    --to=ffmpeg@gyani.pro \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git