From 942619c779f9aba68c4eaaab086289ff53e41a4c Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 5 Jul 2014 16:56:36 +0200 Subject: [PATCH] demux: set filepos field when dequeuing a packet Otherwise the position can be too far ahead. --- demux/demux.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/demux/demux.c b/demux/demux.c index f3e57944d4..7b780c4411 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -205,9 +205,6 @@ int demuxer_add_packet(demuxer_t *demuxer, struct sh_stream *stream, * appear. */ ds->eof = 0; - if (dp->pos >= 0) - demuxer->filepos = dp->pos; - // For video, PTS determination is not trivial, but for other media types // distinguishing PTS and DTS is not useful. if (stream->type != STREAM_VIDEO && dp->pts == MP_NOPTS_VALUE) @@ -294,6 +291,8 @@ struct demux_packet *demux_read_packet(struct sh_stream *sh) if (pkt->stream_pts != MP_NOPTS_VALUE) sh->demuxer->stream_pts = pkt->stream_pts; + if (pkt && pkt->pos >= 0) + sh->demuxer->filepos = pkt->pos; return pkt; }