[FFmpeg-devel] [PATCH] Only using st->parser->pos when doing repacking in the parser.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Apr 24 18:17:14 CEST 2011


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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index e7ce911..d2b8fc2 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1069,7 +1069,11 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
                     pkt->stream_index = st->index;
                     pkt->pts = st->parser->pts;
                     pkt->dts = st->parser->dts;
-                    pkt->pos = st->parser->pos;
+                    // When not repacking, using parser pos can at best break
+                    // things since parsers are not designed to handle the
+                    // case where current packet pos + size < next packet pos
+                    if (st->needs_parsing == AVSTREAM_PARSE_FULL)
+                        pkt->pos = st->parser->pos;
                     if(pkt->data == st->cur_pkt.data && pkt->size == st->cur_pkt.size){
                         s->cur_st = NULL;
                         pkt->destruct= st->cur_pkt.destruct;
-- 
1.7.4.4



More information about the ffmpeg-devel mailing list