From patchwork Sat Feb 3 01:55:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WGlhb2hhbiBXYW5nICjnjovmtojlr5Ip?= X-Patchwork-Id: 7496 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.150.1 with SMTP id c1csp160011jai; Fri, 2 Feb 2018 18:01:20 -0800 (PST) X-Google-Smtp-Source: AH8x224kAiMeSdc6StUGUYYOBWuJMIJ53HZwCt+/GzdoD4HwnwYQ2zT9WRxeRVKSt8se79MDgWap X-Received: by 10.223.165.81 with SMTP id j17mr5821315wrb.173.1517623280007; Fri, 02 Feb 2018 18:01:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517623279; cv=none; d=google.com; s=arc-20160816; b=vI9fKkGJV9uivieLFHI1Khjyyn/0WX47yUsF/mLNDfA9Q3ASipB2i2JSnJmaOqj3Em zCaH8kXljQ0HmvReC2PtiaZgu20BP7pHxvNU3cV4IAXdH8w6/GygeA7oTyTjIZf3ozha ZEDX5O4Nao5YScgEUCDBbr1JgzPnj+bKm8fSQucUbPoGvHRNMYcabkGBfVB5Ntyp8GH1 XaMVQbRh80mNN0ptDrTb1cZxqk19cLdxvXCB3OcSpDv9r3iyI6v1saYyCvkAy+HkHBDL MuhUe3iqV8VBMDVbx+0Kukiu+lijoawH12D6qSCv4QZDlyy7+XjBijysEDQLOBu/8CI/ irDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:mime-version:dkim-signature:dkim-signature :delivered-to:arc-authentication-results; bh=dlruxTikJoaVk+37fJAQsba5sF14ls8HV/QqJnxJad8=; b=bd01/qeNrn5wuri6f6ttM+sdiO/78tG7Nzr+IoOm/uUusSWiLA2BmtbYofdo3K1+M1 u6tlxJqhBJLk3gmaqbh6zycuGoshEkUcokguSoVpRx/SmJZAo2JtUTdCBZ97kapycATv EDuoxKTvTIr/14Ii44jg1a1ZriVnI1/s2uUXZm9S8P/OU53AOpYyWiGykNyNB3qZNLoK aIGTusE/ANT8uDG30ndcgkwAwbuwN/KjychOpoyFBW09tgW/xtqRPGd7hxO5jHbXWKP5 97B3LmG5QsBRYLAbwSYJf+58TIHGZYmFNkyhjZEo5J7As69b0sGxDX/4BGwV96+iqTmc TDjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com header.s=20161025 header.b=OYODWI/i; dkim=neutral (body hash did not verify) header.i=@chromium.org header.s=google header.b=UXm9as+V; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m13si2605904wrh.473.2018.02.02.18.01.17; Fri, 02 Feb 2018 18:01: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=@google.com header.s=20161025 header.b=OYODWI/i; dkim=neutral (body hash did not verify) header.i=@chromium.org header.s=google header.b=UXm9as+V; 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=NONE dis=NONE) header.from=chromium.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D19566883BC; Sat, 3 Feb 2018 04:01:09 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw0-f173.google.com (mail-yw0-f173.google.com [209.85.161.173]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 82F286804BB for ; Sat, 3 Feb 2018 04:01:03 +0200 (EET) Received: by mail-yw0-f173.google.com with SMTP id j128so14631086ywg.7 for ; Fri, 02 Feb 2018 18:01:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=OC1wgO0rGc1rRtOANDLa6yDgya2gNwzqfCnO2lROcyM=; b=OYODWI/i+IWXLt5+kcCoG3OuvA/Q4QOzKbkSW6OrT44TEOBbJbYofx527IbytSiRLH GqxNQBpcMQMUcgyHhEWgQBT8UHJme/JaMbec1UXRyG8jhd5f/cEpCxTV9LnSs+PtmXwh C+xgIHDMMYSniulnqpsTV547kdMA5fqotGr0KvHJp2oHwVQ5rLG9zGHsWtOPGl9Vlsvs B6sxq+tFdh51yaf5oLtW6mCGmHfPJxudEGFTW7SHO9Ur9V9hMuStr2zvkfgdV9EG7gCn wEZNLzjJHT5iv6TALmzTw/eIip/SodpPUs7SYOKKXS7QSzMf/Nap/E76bqSo59eSDCmX b8GQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:from:date:message-id:subject:to; bh=OC1wgO0rGc1rRtOANDLa6yDgya2gNwzqfCnO2lROcyM=; b=UXm9as+VV1WFrpKbIU/9M52b/xI1l1E7cCY3RPy0F3qHad/jxhyd2QruoDW6Da08y3 PY1z2ErtEkrVXkfS3gi6UImZdP+RXpwdoLlqyg5sQbWbGH/u10z2QtDw0MzruM54fmAS wsqQC8b6ozys85WPExFOfh19LU3GBo5fw4kkM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=OC1wgO0rGc1rRtOANDLa6yDgya2gNwzqfCnO2lROcyM=; b=conLZqihi5idaQ0pZuxi4Wp6Qfyu+zoP+oyjnpHZeHaklRCkLy8ABYANT3NXek7Uk0 0bSFYVu5WjJaiLPKfqzo/8UHWDBaoYvsPjoeovdsj+9KkmmI+/gf+lg2J1YfQsmtcBLF MeweHNeIiGNStiepvRk56yFrOTOePrvQyYKGahsvQTsDw6rKViaJmZTTNNwj+HUYhcZB XCltY7ehWJgUoQkWd+F0Ib0CX3d+X1QIep+Nlw4L6bZiPZigbwovVVomLhpr8TqIvttZ EnezbJdhWtpAyJO3nBjvW5h5Em7PJuXIViNsQN/niVCFTWIFsqZlT3MAYz02owujveBw eOtg== X-Gm-Message-State: AKwxytfwsCrgs0Ft/HYKRPG7ulXYfiS7gFXPkadF7b+T9MnkGgcRMdd3 XdNDmJd9IeQzbw8T6zeNqjoJd8ocG3azg6EhUOp5fmA0 X-Received: by 10.129.85.84 with SMTP id j81mr29317964ywb.17.1517622959093; Fri, 02 Feb 2018 17:55:59 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.132.77 with HTTP; Fri, 2 Feb 2018 17:55:38 -0800 (PST) From: =?UTF-8?B?WGlhb2hhbiBXYW5nICjnjovmtojlr5Ip?= Date: Fri, 2 Feb 2018 17:55:38 -0800 X-Google-Sender-Auth: aE2M6c4hNCs-QS6CrAaIi4d1NG0 Message-ID: To: ffmpeg-devel@ffmpeg.org X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: [FFmpeg-devel] Fix ctts_index calculation 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" From bb376fd2de5da5f9ecdef41621a579252b899d7d Mon Sep 17 00:00:00 2001 From: Xiaohan Wang Date: Fri, 2 Feb 2018 17:33:56 -0800 Subject: [PATCH] Fix ctts_index calculation An index should never be equal to the count. Hence we must make sure *ctts_index < ctts_count. --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 5adba52e08..f0bd3e3623 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3148,7 +3148,7 @@ static int find_prev_closest_index(AVStream *st, *ctts_index = 0; *ctts_sample = 0; for (index_ctts_count = 0; index_ctts_count < *index; index_ctts_count++) { - if (*ctts_index < ctts_count) { + if (*ctts_index < ctts_count - 1) { (*ctts_sample)++; if (ctts_data[*ctts_index].count == *ctts_sample) { (*ctts_index)++; -- 2.16.0.rc1.238.g530d649a79-goog