[FFmpeg-cvslog] Handle 0-size sync packets when only parsing headers.

Reimar Döffinger git at videolan.org
Mon Mar 26 20:04:32 CEST 2012


ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Sun Mar 25 13:16:48 2012 +0200| [699c61d2f0b9eb2d8e2da0ebd971b4432e33d140] | committer: Reimar Döffinger

Handle 0-size sync packets when only parsing headers.

Currently, the duration of those packets is just discarded
when enabling parsing, thus the output of the Metal Gear Solid
demuxer breaks completely when just setting AVSTREAM_PARSE_HEADERS.
The result will not be correct if a parser creates a delay even
with PARSER_FLAG_COMPLETE_FRAMES and there might be other cases
where it does not work correct, but just discarding them as it
is done currently seems worse.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>

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

 libavformat/utils.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 77ac180..2989a08 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1133,6 +1133,9 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index)
         av_init_packet(&flush_pkt);
         pkt = &flush_pkt;
         got_output = 1;
+    } else if (!size && st->parser->flags & PARSER_FLAG_COMPLETE_FRAMES) {
+        // preserve 0-size sync packets
+        compute_pkt_fields(s, st, st->parser, pkt);
     }
 
     while (size > 0 || (pkt == &flush_pkt && got_output)) {



More information about the ffmpeg-cvslog mailing list