[FFmpeg-devel] [PATCH] avformat/mux: fix overflow in case one of dts in not set

Paul B Mahol onemda at gmail.com
Thu Sep 30 13:36:17 EEST 2021


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavformat/mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 2053a5636e..583328b123 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -949,7 +949,7 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
             last_dts = av_rescale_q(last->pkt.dts,
                                     st->time_base,
                                     AV_TIME_BASE_Q);
-            delta_dts = FFMAX(delta_dts, last_dts - top_dts);
+            delta_dts = FFMAX(delta_dts, (top_dts == AV_NOPTS_VALUE || last_dts == AV_NOPTS_VALUE) ? 0 : last_dts - top_dts);
         }
 
         if (delta_dts > s->max_interleave_delta) {
-- 
2.33.0



More information about the ffmpeg-devel mailing list