Skip to content

Commit

Permalink
Handle 0-size sync packets when only parsing headers.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rdoeffinger committed Mar 26, 2012
1 parent fca62f0 commit 699c61d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libavformat/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 699c61d

Please sign in to comment.