[FFmpeg-devel] [PATCH] lavf/mux: do not fail in case of non monotonically increasing DTS values for data packets

Stefano Sabatini stefasab at gmail.com
Thu Apr 30 14:20:52 CEST 2015


Disable monotonicity test for data packets. Data packets are not supposed
to be decoded by FFmpeg, and this checks cause conversion failure with
some files with non strictly monotonous timestamps.
---
 libavformat/mux.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 9101925..f714168 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -486,10 +486,11 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt)
         pkt->dts = st->pts_buffer[0];
     }
 
-    if (st->cur_dts && st->cur_dts != AV_NOPTS_VALUE &&
+    if ((st->codec->codec_type != AVMEDIA_TYPE_DATA) &&
+        (st->cur_dts && st->cur_dts != AV_NOPTS_VALUE &&
         ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) &&
           st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE &&
-          st->cur_dts >= pkt->dts) || st->cur_dts > pkt->dts)) {
+          st->cur_dts >= pkt->dts) || st->cur_dts > pkt->dts))) {
         av_log(s, AV_LOG_ERROR,
                "Application provided invalid, non monotonically increasing dts to muxer in stream %d: %s >= %s\n",
                st->index, av_ts2str(st->cur_dts), av_ts2str(pkt->dts));
-- 
1.8.3.2



More information about the ffmpeg-devel mailing list