[FFmpeg-devel] [PATCH v2 2/2] avformat/demux: don't discard empty Theora packets
James Almer
jamrial at gmail.com
Fri Feb 14 05:14:35 EET 2025
Theora signals "Output last frame again" with an empty packet.
Finishes fixing ticket #11451.
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavformat/demux.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/libavformat/demux.c b/libavformat/demux.c
index d8ab29431e..0e39346f62 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1173,7 +1173,15 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
if (!size && !flush && sti->parser->flags & PARSER_FLAG_COMPLETE_FRAMES) {
// preserve 0-size sync packets
- compute_pkt_fields(s, st, sti->parser, pkt, AV_NOPTS_VALUE, AV_NOPTS_VALUE);
+ compute_pkt_fields(s, st, sti->parser, pkt, pkt->dts, pkt->pts);
+
+ // Theora has valid 0-sized packets that need to be output
+ if (st->codecpar->codec_id == AV_CODEC_ID_THEORA) {
+ ret = avpriv_packet_list_put(&fci->parse_queue,
+ pkt, NULL, 0);
+ if (ret < 0)
+ goto fail;
+ }
}
while (size > 0 || (flush && got_output)) {
--
2.48.1
More information about the ffmpeg-devel
mailing list