summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-12-09 05:31:30 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-12-09 06:13:32 +0100
commita5e5959d52860678d028df07ad1351a11aaf47f7 (patch)
tree56795002bec7d7818054bd1a938099fafba30de2 /libavformat/utils.c
parent720dffb843aa780d25b7be224c63ffc0aba13671 (diff)
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@gmx.at>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3246da67ed..3447b35c79 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;