From patchwork Tue May 22 20:21:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9058 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp9078jad; Tue, 22 May 2018 13:21:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpx9jTeuayFf7/HsWkl1sUnKLMTj5dMryfDF7O9sqbzmyYJhQ1Xco83vNLu8q4l0cJ3eZjS X-Received: by 2002:a1c:7d42:: with SMTP id y63-v6mr2418961wmc.121.1527020482908; Tue, 22 May 2018 13:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527020482; cv=none; d=google.com; s=arc-20160816; b=BK4E0MNSNC/5sV1eEMvnY86NoUB8ConfeTn/wh3IclBlWL3tya6yGRq6vK9Mgft+YN tBfCSTzTm01m3BRGSIDHdGZDU3AX7Gc8hcEa/CIKpMw3vl44CQQFWDuS3J3Bo62BzU4a i2F/h9AaHme1NH0JD0cOsYSvnilBkFnsku6AUgJmpodjBfUV2fHWFDnReVGIcLarjBJU zaWudAjRjDdQv9jUHQZIAyEVbuiC6q4Ze4DWNgoZBHIgC/E/9cMofGMg3ie02hsHMfNe 6bD/444jPeoJJFr402Umu5bR4rwKksvqhq9YKWrtxJfMRKVvk47+3hSajXR50grGHZtx RJnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=V2I43+wfWbgzyeADC8SGDJrfF4uorOxF8XP1CbJolDw=; b=p0AL+IjSHzizwXux5ezAXwPObP0I08KwdsLvLq1Gh1uADQx+syWAlNGNl0BsGHGR0l 3x68N7giVcuKeUN3zjIehZFP7EyACeR4d6hr/a6CMUC2o+6XQPoJ/znvn0VSWG9gjpoc iU4jOK7bhIp3hNQw38Nett7VVW9jGrqG5OV2Z5vmcKwXBIY5tl0E40s4+cGFJVU2d0wF j2harzF2EW0dDtZrZDTiomhN553edntEyn6oTTq0ZQc6opPnxA+ZP4XA15fZ/Wl+P/ke KDvucCIuEDMXQxRBQ83+xz5d4Dgx8MAMDgM9KJ2jw9RPStFKOXub0CMTRZiL4QIwEYJ1 EY1A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g15-v6si15249445wrd.55.2018.05.22.13.21.22; Tue, 22 May 2018 13:21:22 -0700 (PDT) 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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0D145689D94; Tue, 22 May 2018 23:20:39 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-3.mx.upcmail.net (vie01a-qmta-pe01-3.mx.upcmail.net [62.179.121.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0665168042B for ; Tue, 22 May 2018 23:20:33 +0300 (EEST) Received: from [172.31.218.52] (helo=vie01a-dmta-pe08-1.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fLDmT-0003AW-4P for ffmpeg-devel@ffmpeg.org; Tue, 22 May 2018 22:21:13 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe08.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fLDmN-0000sF-28 for ffmpeg-devel@ffmpeg.org; Tue, 22 May 2018 22:21:07 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id pYM41x02A0S5wYM01YM50v; Tue, 22 May 2018 22:21:06 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 22 May 2018 22:21:04 +0200 Message-Id: <20180522202104.22853-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.0 Subject: [FFmpeg-devel] [PATCH] avformat/mov: Discard redundant and invalid STSC entries 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This reduces the amount of log message noise for files that contain many such redundant entries Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index f2a540ad50..b555c8cb7f 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2638,6 +2638,13 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc->stsc_data[i].first = avio_rb32(pb); sc->stsc_data[i].count = avio_rb32(pb); sc->stsc_data[i].id = avio_rb32(pb); + if (i && + sc->stsc_data[i].count == sc->stsc_data[i-1].count && + sc->stsc_data[i].id == sc->stsc_data[i-1].id && + sc->stsc_data[i].first >= sc->stsc_data[i-1].first) { + i --; + entries --; + } } sc->stsc_count = i;