[FFmpeg-cvslog] fftools/ffmpeg_mux: flush bsfs immediately on exceeding recoding time
Anton Khirnov
git at videolan.org
Wed May 31 17:26:25 EEST 2023
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu May 25 08:50:19 2023 +0200| [106167374c7e14c6e2afb0049897f1a59a25c839] | committer: Anton Khirnov
fftools/ffmpeg_mux: flush bsfs immediately on exceeding recoding time
Current code marks the output stream as finished and waits for a flush
packet, but that is both unnecessary and suspect, as in theory nothing
should be sent to a finished stream - not even flush packets.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=106167374c7e14c6e2afb0049897f1a59a25c839
---
fftools/ffmpeg_mux.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index 3da3c04d7f..feb014ca31 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -386,6 +386,11 @@ void of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts)
AVPacket *opkt = ost->pkt;
av_packet_unref(opkt);
+
+ if (of->recording_time != INT64_MAX &&
+ dts >= of->recording_time + start_time)
+ pkt = NULL;
+
// EOF: flush output bitstream filters.
if (!pkt) {
of_output_packet(of, opkt, ost, 1);
@@ -407,12 +412,6 @@ void of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts)
return;
}
- if (of->recording_time != INT64_MAX &&
- dts >= of->recording_time + start_time) {
- close_output_stream(ost);
- return;
- }
-
if (av_packet_ref(opkt, pkt) < 0)
exit_program(1);
More information about the ffmpeg-cvslog
mailing list