diff mbox series

[FFmpeg-devel] avformat/matroskadec: avoid warning on duration conversion

Message ID 20201115090023.26107-1-robux4@ycbcr.xyz
State New
Headers show
Series [FFmpeg-devel] avformat/matroskadec: avoid warning on duration conversion
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Steve Lhomme Nov. 15, 2020, 9 a.m. UTC
Do the conversion from double to uint64_t explicitly and only once.
The comparison to UINT64_MAX is not correct.
---
 libavformat/matroskadec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 8a5bc4018a..4ff472005e 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2328,8 +2328,8 @@  static int matroska_parse_tracks(AVFormatContext *s)
 
         if (track->type == MATROSKA_TRACK_TYPE_VIDEO) {
             if (!track->default_duration && track->video.frame_rate > 0) {
-                double default_duration = 1000000000 / track->video.frame_rate;
-                if (default_duration > UINT64_MAX || default_duration < 0) {
+                uint64_t default_duration = (double)1000000000 / track->video.frame_rate;
+                if (default_duration > UINT64_MAX) {
                     av_log(matroska->ctx, AV_LOG_WARNING,
                          "Invalid frame rate %e. Cannot calculate default duration.\n",
                          track->video.frame_rate);