[FFmpeg-cvslog] avformat/utils: fix calculating the absolute difference of timestamps

Michael Niedermayer git at videolan.org
Tue Dec 9 06:23:00 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Dec  9 05:31:30 2014 +0100| [a5e5959d52860678d028df07ad1351a11aaf47f7] | committer: Michael Niedermayer

avformat/utils: fix calculating the absolute difference of timestamps

we dont use FFABS(a-b) as that could result in undefined behavior if it overflows

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

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

 libavformat/utils.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3246da6..3447b35 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1105,7 +1105,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
             if (pkt->dts != AV_NOPTS_VALUE &&
                 pkt->pts == AV_NOPTS_VALUE &&
                 st->last_IP_duration > 0 &&
-                (st->cur_dts - next_dts) <= 1 &&
+                ((uint64_t)st->cur_dts - (uint64_t)next_dts + 1) <= 2 &&
                 next_dts != next_pts &&
                 next_pts != AV_NOPTS_VALUE)
                 pkt->pts = next_dts;



More information about the ffmpeg-cvslog mailing list