[xcode] Fix last seconds being skipped when custom filters enabled

Seems EOF was not marked towards the ffmpeg filtergraph via a NULL frame to
av_buffersrc_add_frame(). This meant that the end of the track would get
stuck in the filters.

Fixes #1787
This commit is contained in:
ejurgensen 2024-08-09 17:42:58 +02:00
parent 297de1409a
commit d672332750

View File

@ -839,16 +839,15 @@ filter_encode_write(struct encode_ctx *ctx, struct stream_ctx *s, AVFrame *frame
{ {
int ret; int ret;
// Push the decoded frame into the filtergraph // Push the decoded frame into the filtergraph. If frame is NULL then it
if (frame) // signals EOF to ffmpeg which is necessary to make av_buffersink_get_frame
{ // return the last frames (see issue #1787)
ret = av_buffersrc_add_frame(s->buffersrc_ctx, frame); ret = av_buffersrc_add_frame(s->buffersrc_ctx, frame);
if (ret < 0) if (ret < 0)
{ {
DPRINTF(E_LOG, L_XCODE, "Error while feeding the filtergraph: %s\n", err2str(ret)); DPRINTF(E_LOG, L_XCODE, "Error while feeding the filtergraph: %s\n", err2str(ret));
return -1; return -1;
} }
}
// Pull filtered frames from the filtergraph and pass to encoder // Pull filtered frames from the filtergraph and pass to encoder
while (1) while (1)