[FFmpeg-cvslog] avformat/mov: Only set pkt->duration to non negative values

Michael Niedermayer git at videolan.org
Tue Jul 10 12:06:05 EEST 2018


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Wed May 16 23:35:58 2018 +0200| [ed4e35a0fdef551041a2d0e412e90321dbd6bf3e] | committer: Michael Niedermayer

avformat/mov: Only set pkt->duration to non negative values

Reviewed-by: Sasi Inguva <isasi at google.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 8176799f31b23849382623f0f9001acc5edf7c76)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/mov.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 4f1662fc30..e48938e5b5 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4840,7 +4840,9 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
     } else {
         int64_t next_dts = (sc->current_sample < st->nb_index_entries) ?
             st->index_entries[sc->current_sample].timestamp : st->duration;
-        pkt->duration = next_dts - pkt->dts;
+
+        if (next_dts >= pkt->dts)
+            pkt->duration = next_dts - pkt->dts;
         pkt->pts = pkt->dts;
     }
     if (st->discard == AVDISCARD_ALL)



More information about the ffmpeg-cvslog mailing list