From patchwork Sun Nov 15 09:00:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Lhomme X-Patchwork-Id: 23647 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A0A5344AB38 for ; Sun, 15 Nov 2020 11:00:35 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8634F68B9E4; Sun, 15 Nov 2020 11:00:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AE54968B0EE for ; Sun, 15 Nov 2020 11:00:28 +0200 (EET) Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4CYmPm2VSBzQjbR for ; Sun, 15 Nov 2020 10:00:28 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter04.heinlein-hosting.de (spamfilter04.heinlein-hosting.de [80.241.56.122]) (amavisd-new, port 10030) with ESMTP id fHEwa0Y91hID for ; Sun, 15 Nov 2020 10:00:25 +0100 (CET) From: Steve Lhomme To: ffmpeg-devel@ffmpeg.org Date: Sun, 15 Nov 2020 10:00:23 +0100 Message-Id: <20201115090023.26107-1-robux4@ycbcr.xyz> MIME-Version: 1.0 X-MBO-SPAM-Probability: * X-Rspamd-Score: 0.12 / 15.00 / 15.00 X-Rspamd-Queue-Id: 6B52517E6 X-Rspamd-UID: f61c71 Subject: [FFmpeg-devel] [PATCH] avformat/matroskadec: avoid warning on duration conversion X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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 --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);