From patchwork Tue Feb 1 01:56:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 33967 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2c4e:0:0:0:0 with SMTP id x14csp218103iov; Mon, 31 Jan 2022 17:58:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxRQGvp8Kz1vP+zIAhW6LxI7e30tkJ9uJMw2yFCTvGxOTpRuhQZZSxk81fKTZHpqmfG09z X-Received: by 2002:a50:fb8d:: with SMTP id e13mr1047902edq.334.1643680699665; Mon, 31 Jan 2022 17:58:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643680699; cv=none; d=google.com; s=arc-20160816; b=TbfH0WPsMwgms229bqHg17jfRnQf1J/5S/XCcqKurAwlMXPpqpSWHaz/UOdFqmlDo0 Ggp4FLJpQjyvJkehoOw5yJ5n1Jv8jqadU7wlxSVbKRiGwuk1wF6GOxS1Djkep8buqNVT 50inF0hhehWyryU+toLJPypdW9gguU8vUxvwDwBsTrhiI9MDlbeaEJXIm1WT1AsriID4 +D8nrL1kUfEiMRT5kT0Bg/OZOrXUtwsSxDw9od8tYlnYx3RQXARPeZbnDpVXLBdon6Hs vuPuW9kGjDIXHiyrfd1v0iU4MFQ5oR/XETAdjxu+LBiP3NPR5GBtQk3m3AtqOZsp0ty2 c+QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=gJU08iefzlLo4wjf70pLOqwShxJD37iM1RqZLLsEASQ=; b=BFunhsLXsZ9XPyB+36traCktGldVoofBNESChmy2Gh88hAZEXEeXx1rSBIoVp/tU1I 5bgPRdqQhwUdj+EFgG3L1M67P+IeOUoJ/aHjKIQM0TwwqWL5ha3xjMG4BI6XpBytiHFC mHEgbfqgwHrRYhnUX2gZFwJPhcqONOF3n6QCRcnANY9p+tqYo08BV1pDcEgr+UNZOuWo jrCZPvvWp8VG0Y9HKBgaa/yAG7qzoIcUSbNGbAko2KC2zUz8iPOq43Wy7387+0SueWZe Ni/Bk38VvAj43i2uEWl9XC0DdMbtV2hwESo3uR/K2xu5xs6QwZHNC9syoWF6mizCoYfP +OjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=kLdxeU6T; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q6si8378692eds.366.2022.01.31.17.58.19; Mon, 31 Jan 2022 17:58:19 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=kLdxeU6T; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 203DF68B212; Tue, 1 Feb 2022 03:57:51 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BDC3268B1B5 for ; Tue, 1 Feb 2022 03:57:44 +0200 (EET) Received: by mail-ot1-f43.google.com with SMTP id e21-20020a9d0195000000b005a3cd7c1e09so8085591ote.6 for ; Mon, 31 Jan 2022 17:57:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=6ne16MURgLdrH3v9jmUEoRYP08GoLIOSC5nvydIHQ9o=; b=kLdxeU6TGt2xqHgsNLQXLEZAy0EhXpJMdRwWcL88L38ZvlayCZb43SGho2yp5932hv B5F5ap9+FPooCGtW8l55Keeydav8wIakrGatpV0QrTz0oEYt6FKjpuhEFYOn3vLOXQgF Zvue8SUDGme0wKtRYvLbgV16IW9W/k9U2E/c4Aj+a/l7xlA648lpuDOePf/LoNPF60t/ VZNcQ+WpDuDN3S35knDoZKs9Fa9Xr1gwCsB6WC0uFjwuTkPfspOLxs6DjMyYlK5BFfJ3 4fvlimQqtK/T8NCjVKWRj1VbO1d7yIvyygmOh+qo2Aoutoh3UCR03283de3i+JHHvtYJ ctYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6ne16MURgLdrH3v9jmUEoRYP08GoLIOSC5nvydIHQ9o=; b=IlGcmNOfJ0ItYgX7VQC5ft6twTEJG6sFzJE+c1MvtbzoaTSQv3hDFjfLrnhJrx5LRu uQ9NX0udzhCxjdk0DVBgobS11seELvsmV3Go0cwarU2PQXNa8aV0mOsVmfI28r0twtB6 XP/8BOhoOMvsPezxovnDxn3+raT74ZGEnaZiG5NRUDW2iMiwexxQ2mvqtaa2QZFdEhXW fII9V21r8w9SJgLdMW7Hr2eVY8OKDVEAplGZpAKHtk/dsjmzn5AIP0Qt0bIidrMTdZcF BVp+/9oN9BbhsKB5b225g7kVF/BH2LaQd75AOT7va8QAH+G4ofeobcc6Hw55JTp5Bc9o gIlA== X-Gm-Message-State: AOAM532uL0XfD0FhYrnLVL48vIXIdILmRzOSdRIQa3saB8WP/UFvvhoI +EVJSzHiDHbzU+NUfBqvwgUGi16nznw= X-Received: by 2002:a9d:6d01:: with SMTP id o1mr10208055otp.204.1643680663122; Mon, 31 Jan 2022 17:57:43 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id x1sm10811532oto.38.2022.01.31.17.57.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 17:57:42 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 31 Jan 2022 22:56:48 -0300 Message-Id: <20220201015648.2086-4-jamrial@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220201015648.2086-1-jamrial@gmail.com> References: <20220201015648.2086-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] avformat/demux: don't truncate the return value of ts_to_samples() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: 2Gt0oPmc/tDm Signed-off-by: James Almer --- libavformat/demux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/demux.c b/libavformat/demux.c index 4509015847..ec34b65288 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -1346,7 +1346,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) if (sti->first_discard_sample && pkt->pts != AV_NOPTS_VALUE) { int64_t pts = pkt->pts - (is_relative(pkt->pts) ? RELATIVE_TS_BASE : 0); int64_t sample = ts_to_samples(st, pts); - int duration = ts_to_samples(st, pkt->duration); + int64_t duration = ts_to_samples(st, pkt->duration); int64_t end_sample = sample + duration; if (duration > 0 && end_sample >= sti->first_discard_sample && sample < sti->last_discard_sample)