[FFmpeg-devel] [PATCH 2/2] avformat/mov: increase current_sample after reading, to avoid discontinuous sample

Zhang Rui bbcallen at gmail.com
Thu May 21 06:12:19 CEST 2015


---
 libavformat/mov.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index bfbf599..a8f818f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4241,8 +4241,6 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
         goto retry;
     }
     sc = st->priv_data;
-    /* must be done just before reading, to avoid infinite loop on sample */
-    sc->current_sample++;
 
     if (mov->next_root_atom) {
         sample->pos = FFMIN(sample->pos, mov->next_root_atom);
@@ -4281,6 +4279,9 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
 #endif
     }
 
+    /* increase current_sample after reading, to avoid discontinuous sample */
+    sc->current_sample++;
+
     pkt->stream_index = sc->ffindex;
     pkt->dts = sample->timestamp;
     if (sc->ctts_data && sc->ctts_index < sc->ctts_count) {
-- 
2.0.0



More information about the ffmpeg-devel mailing list