From patchwork Sat Mar 16 10:24:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodger Combs X-Patchwork-Id: 12324 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 4E862448A2B for ; Sat, 16 Mar 2019 12:25:00 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2BE6868A71D; Sat, 16 Mar 2019 12:25:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 64D6B689C22 for ; Sat, 16 Mar 2019 12:24:53 +0200 (EET) Received: by mail-io1-f54.google.com with SMTP id x4so10424475ion.2 for ; Sat, 16 Mar 2019 03:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Ub88fjdlR6xBhQB9T7TLHvoQbycs6tmdSuEGe23n43E=; b=ZNwqwL0c6JQOjQPL5rcujqMZ1mTjgmStS3Wpadd72MJ13PTpywbFMZkDSKBUsqYiEO y26GMD85td7DzMDuwAe+T5uRaUp+SzCZ7eN93oQ8tS9Fl3sDJgKwWmWaglLVr2FP1tW2 mQJrQhxutX4UZ4Jp0AwzsBVnb1rdqKI/QTLPTJ4z3l/WqjjU0zoWoZ3yr37taYjLf6fr l11ChVkrdgjhfd3TGPYnRWrUTO9Wh8cH8FRNU3yIhUAJIdF+SmqbgR+pemiYbRR20gIN yPoKBNSz6rYLVId4T0QqA+4kF4pwxqyh7ey5iWd0/ocOgfA4/gdYQ3zT3F629Al6k5JP KnCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Ub88fjdlR6xBhQB9T7TLHvoQbycs6tmdSuEGe23n43E=; b=d9XW6CTZlFslKr3T735ukLwDdOk1b+oxPjKmkC5nig4vowu31QI7ffoZfgvFVTd/pj CBCzz9+oqHrW16t0Rlu2IpCOG9EOCSllG6RSTdTg21NmWNlHVy1a9ZJ5tOQgVqEKdySA YTgNBJsTYRUE7xHDEixPYFq03lsUfjJA3+vr81ozOOLrpDjoQpu9XmxiIDM3dCfyMFet UEoPWgg7dc5LmRZcKdArsVZAxAA+F34ab3/JPXKRSwAUyXBF/M1ZYfgNod7zScyu3V95 2t9dGE+OAZFRxEu1immbPcc95ccm5iKm1nkZCSRLSn3kZhn1hjkmaNJ9TD6A+ohxz6Hb R7EQ== X-Gm-Message-State: APjAAAX7MCkefXjdImdn5kh3ZnpTPh4ppWEziw/xRuzUBHN5oNSzkFkP 3LrRf0dpLdcRhJsLghdNiOYnRDdb X-Google-Smtp-Source: APXvYqy4vXmGMPxe5RQ7JCwxExPFFu6ICRW+0L3UCfHrmiGCB0Up9AqR6K4nqJFyn1Q8t9gU7niCYA== X-Received: by 2002:a5d:9446:: with SMTP id x6mr4326513ior.236.1552731891793; Sat, 16 Mar 2019 03:24:51 -0700 (PDT) Received: from MacBook-Pro.localdomain ([71.201.155.37]) by smtp.gmail.com with ESMTPSA id m2sm2404679itc.42.2019.03.16.03.24.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 16 Mar 2019 03:24:51 -0700 (PDT) From: Rodger Combs To: ffmpeg-devel@ffmpeg.org Date: Sat, 16 Mar 2019 05:24:46 -0500 Message-Id: <20190316102446.69900-1-rodger.combs@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavf/mp3dec: increase probe score of buffers entirely composed of valid packets 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" Fixes some files misdetecting as MPEG PS --- libavformat/mp3dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index ef884934e1..81da0c6090 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -100,13 +100,13 @@ static int mp3_read_probe(AVProbeData *p) max_framesizes = FFMAX(max_framesizes, framesizes); if(buf == buf0) { first_frames= frames; - if (buf2 == end + sizeof(uint32_t)) + if (buf2 >= end + sizeof(uint32_t)) whole_used = 1; } } // keep this in sync with ac3 probe, both need to avoid // issues with MPEG-files! - if (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1; + if (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1 + whole_used * FFMIN(first_frames / 2, 5); else if(max_frames>200 && p->buf_size < 2*max_framesizes)return AVPROBE_SCORE_EXTENSION; else if(max_frames>=4 && p->buf_size < 2*max_framesizes) return AVPROBE_SCORE_EXTENSION / 2; else if(ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC) && 2*ff_id3v2_tag_len(buf0) >= p->buf_size)