[FFmpeg-cvslog] avformat/demux: don't discard empty Theora packets

James Almer git at videolan.org
Thu Feb 20 00:52:58 EET 2025


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri Feb 14 00:14:35 2025 -0300| [6e26f57f672b05e7b8b052007a83aef99dc81ccb] | committer: James Almer

avformat/demux: don't discard empty Theora packets

Theora signals "Output last frame again" with an empty packet.

Finishes fixing ticket #11451.

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6e26f57f672b05e7b8b052007a83aef99dc81ccb
---

 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)) {



More information about the ffmpeg-cvslog mailing list