[FFmpeg-devel] [PATCH] lavf/mux: ignore nonmonotonic timestamps for timestampless muxers

rcombs rcombs at rcombs.me
Tue Nov 22 02:08:10 EET 2022


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

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 37fe19358d..7b13dd8012 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -538,7 +538,7 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *
     }
 
     if (sti->cur_dts && sti->cur_dts != AV_NOPTS_VALUE &&
-        ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) &&
+        ((!(s->oformat->flags & (AVFMT_TS_NONSTRICT | AVFMT_NOTIMESTAMPS)) &&
           st->codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE &&
           st->codecpar->codec_type != AVMEDIA_TYPE_DATA &&
           sti->cur_dts >= pkt->dts) || sti->cur_dts > pkt->dts)) {
@@ -783,7 +783,8 @@ static int prepare_input_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt)
         /* check that the dts are increasing (or at least non-decreasing,
          * if the format allows it */
         if (sti->cur_dts != AV_NOPTS_VALUE &&
-            ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) && sti->cur_dts >= pkt->dts) ||
+            ((!(s->oformat->flags & (AVFMT_TS_NONSTRICT | AVFMT_NOTIMESTAMPS)) &&
+              sti->cur_dts >= pkt->dts) ||
              sti->cur_dts > pkt->dts)) {
             av_log(s, AV_LOG_ERROR,
                    "Application provided invalid, non monotonically increasing "
-- 
2.38.1



More information about the ffmpeg-devel mailing list