Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 3/8] fftools/ffmpeg: stop handling max_frames in do_video_out()
Date: Mon, 14 Nov 2022 16:13:45 +0100
Message-ID: <20221114151350.5134-3-anton@khirnov.net> (raw)
In-Reply-To: <20221114151350.5134-1-anton@khirnov.net>

Frame limiting is now handled using sync queues. This code prevents the
sync queue from triggering EOF, resulting in unnecessarily many frames
being decoded, filtered, and then discarded.

Found-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
---
 fftools/ffmpeg.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 0fa2fe8c52..dfdfad3ce4 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1206,14 +1206,6 @@ static void do_video_out(OutputFile *of,
         }
     }
 
-    /*
-     * For video, number of frames in == number of packets out.
-     * But there may be reordering, so we can't throw away frames on encoder
-     * flush, we need to limit them here, before they go into encoder.
-     */
-    nb_frames = FFMIN(nb_frames, ost->max_frames - ost->vsync_frame_number);
-    nb0_frames = FFMIN(nb0_frames, nb_frames);
-
     memmove(ost->last_nb0_frames + 1,
             ost->last_nb0_frames,
             sizeof(ost->last_nb0_frames[0]) * (FF_ARRAY_ELEMS(ost->last_nb0_frames) - 1));
@@ -1262,7 +1254,9 @@ static void do_video_out(OutputFile *of,
         in_picture->pict_type = forced_kf_apply(ost, in_picture, i);
 
         ret = submit_encode_frame(of, ost, in_picture);
-        if (ret < 0 && ret != AVERROR_EOF)
+        if (ret == AVERROR_EOF)
+            break;
+        else if (ret < 0)
             exit_program(1);
 
         ost->next_pts++;
-- 
2.35.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".

  parent reply	other threads:[~2022-11-14 15:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 15:13 [FFmpeg-devel] [PATCH 1/8] fftools/ffmpeg: simplify ost_iter() Anton Khirnov
2022-11-14 15:13 ` [FFmpeg-devel] [PATCH 2/8] fftools/ffmpeg_mux_init: move more code from of_open() to create_streams() Anton Khirnov
2022-11-14 15:13 ` Anton Khirnov [this message]
2022-11-14 15:13 ` [FFmpeg-devel] [PATCH 4/8] fftools/ffmpeg: move OutputStream.max_frames to MuxStream Anton Khirnov
2022-11-14 15:13 ` [FFmpeg-devel] [PATCH 5/8] fftools/ffmpeg_mux_init: move validating codec avoptions to a separate function Anton Khirnov
2022-11-14 15:13 ` [FFmpeg-devel] [PATCH 6/8] fftools/ffmpeg_mux_init: do not call av{codec, format}_get_class() repeatedly Anton Khirnov
2022-11-14 15:13 ` [FFmpeg-devel] [PATCH 7/8] fftools/ffmpeg_mux_init: use av_dict_iterate() where appropriate Anton Khirnov
2022-11-14 15:13 ` [FFmpeg-devel] [PATCH 8/8] fftools/ffmpeg_mux_init: drop an always-false check Anton Khirnov
2022-11-14 17:29 ` [FFmpeg-devel] [PATCH 1/8] fftools/ffmpeg: simplify ost_iter() Soft Works

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=20221114151350.5134-3-anton@khirnov.net \
    --to=anton@khirnov.net \
    --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