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.
This commit is contained in:
Anton Khirnov 2023-05-25 08:50:19 +02:00
parent 2674532eee
commit 106167374c

View File

@ -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);