[FFmpeg-cvslog] avformat/mux: Check for and remove invalid packet durations

Michael Niedermayer git at videolan.org
Sat May 10 22:08:55 CEST 2014


ffmpeg | branch: release/1.1 | Michael Niedermayer <michaelni at gmx.at> | Wed Apr 23 06:04:50 2014 +0200| [8713b8e3fb76c64cdeedeb36caa7b4703824ba7e] | committer: Michael Niedermayer

avformat/mux: Check for and remove invalid packet durations

Fixes assertion failure
Fixes Ticket3575

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit dc6a17cf74a90e41d70ea1753cdb70c0a5b2ced8)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/mux.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 649b496..72ac40d 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -410,6 +410,12 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt)
     av_dlog(s, "compute_pkt_fields2: pts:%s dts:%s cur_dts:%s b:%d size:%d st:%d\n",
             av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts), delay, pkt->size, pkt->stream_index);
 
+    if (pkt->duration < 0 && st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) {
+        av_log(s, AV_LOG_WARNING, "Packet with invalid duration %d in stream %d\n",
+               pkt->duration, pkt->stream_index);
+        pkt->duration = 0;
+    }
+
     /* duration field */
     if (pkt->duration == 0) {
         ff_compute_frame_duration(&num, &den, st, NULL, pkt);



More information about the ffmpeg-cvslog mailing list