From patchwork Mon Jun 25 21:22:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 9506 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:141:0:0:0:0:0 with SMTP id c62-v6csp4584039jad; Mon, 25 Jun 2018 14:29:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdmouaoXy01ijLfK+UnjZJdkJuUcXr6VTJRX6CRIVuu+csBXxWGOuE94x1cwfCC8v6crPKO X-Received: by 2002:a1c:ac89:: with SMTP id v131-v6mr2021735wme.121.1529962196371; Mon, 25 Jun 2018 14:29:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529962196; cv=none; d=google.com; s=arc-20160816; b=Gk2Q7AlenSSOZF6nbdZz2SoxQkjo54MjG1oQbp8Vh6yZ4EyK2IyUAznPGNsgGYhXdG OiF8shayDDQDyhxltybtU0GfbwFz5q+Di89lYuNPwXykNWnYT3D5+gGId6alNEl+RplZ P6bE9g8EHDgSq9tiIJPq+KdfBrFc2jwFTxb75c2V5L6SpSC6p7JqlQ+LsPcPNGrymHo6 qNAK7E0yBFFnoCLIaEd8BfAZztxaQ/YYlmx4zUqh/z96BIe8qXBbcdpVzHmjmVGyO/ju WZB1pIKwMaCKZJR+m5xtVMKcMVcmxOG0pKI5EU8Nv1y1MPwP0wo22m0ACmjq2RK/wlqC wM5A== 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:references:in-reply-to:mime-version :dkim-signature:delivered-to:arc-authentication-results; bh=jWyOOc8s/0aD3BWeBMokkJ3QYRdla6T6zYpaM2r4w8Q=; b=TbKp++U7Cl/Rf4bB09IRHUa0wYbicorYnGogFkV14emrfdXcWrjHW7ApH7s2ySPZTo bKQhyFZylKTsqjmW7LfRsT6kEy6NpxIkQ/4wzZ1bZmVaunBwHFNAumBRIg7QGMH9K7Yo kB9bNjJXUpyKON+0Xt5niCWbxELPRjdqeyJfRZ4WYXDTONBiSR8nIg1dj2E0r2WmtgTA rko52mwym01flC2C1MpBtWw9ma640L1QKVWZbGf919dXafUV+OmXamUkwEiiwtCa6THh nPfS1jTngx4n8OuRMQuzp1xq9/QvjIIdCAV7Ktr5V2RB+m503amB/VXO4/49HrcwI5Pu f8fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=EkQxM96u; 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 l185-v6si225974wmg.76.2018.06.25.14.29.55; Mon, 25 Jun 2018 14:29:56 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=EkQxM96u; 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 0B3AC68A27F; Tue, 26 Jun 2018 00:28:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-it0-f46.google.com (mail-it0-f46.google.com [209.85.214.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A6745689CC7 for ; Tue, 26 Jun 2018 00:28:51 +0300 (EEST) Received: by mail-it0-f46.google.com with SMTP id 128-v6so8617970itf.1 for ; Mon, 25 Jun 2018 14:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=BcmPI2rdOu0AkrQOpphS1FeZtP26fI4L+oslorgEzXM=; b=EkQxM96uXibJ9rtO3BdrV3Oz65alJj5YW5ALHYGQ5YTINEF3/QJbmXECggI+gza+w6 dj76ipQNGPAswXt6MA3n96BTA1YhJsspsRs0Voaz01SYCWmjxS2A5ffed7Eltvnu118Q 1I1yJ6Nbag1b3r/TsFAJAdWqNf9Yr7piW3ISBerLq8TWAD+OJ4RY1V+LZLtjHoZrFPMJ N08GNUcyc0qCzBFOpeRo50ZEv/AdJYMpi8Rzj70TqsKRuxHAAQpCFR8t3IbwZI+UN6oO d7qOwkBRziA7GNmd96u5XzYuTMKyJBo5yRTxKVZMditPxz0aDcWqw2lpC6Bv/nMCBusA mPnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=BcmPI2rdOu0AkrQOpphS1FeZtP26fI4L+oslorgEzXM=; b=MPD3rpbCz66IY96s1aFXIT8qqgfnMegqIi1Y+5STOvZmVx6ceKWGoul0a5kTnLWAgU wfpE7cFITmd5QMiPA+R0QjvvjAsnzRT1uDnWw2Uqd36D1hULp8aMjqluGpWZe5KJcT1v h99dQLm/0Yutj0eobBlkeboRQISLbdInfMrREoG4h8VwXBXpJInr2J+6rzHYfWx3GNku C+lo3IQfJ7gNyJXrDleta0c7P7sS5N8X7QsPl7XiWBZKYoSpG8aq6seb0DFzWfMp9ooY f76qt9MUbxG6G+Chjl8A5jnoB07c8jJBUhzHz0420tx7pdBX5owft0wddKjOh+i139FY d6wA== X-Gm-Message-State: APt69E0DTv/thdJjMjOGX4IA5vkiPzV327lt3HJcBcog8u9gR1LF5ED/ C5E/nxNUjeaEhubOc6Dz2p6UFVN6pfB1Wz00ZGg= X-Received: by 2002:a24:2186:: with SMTP id e128-v6mr2375872ita.39.1529961752724; Mon, 25 Jun 2018 14:22:32 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:6f45:0:0:0:0:0 with HTTP; Mon, 25 Jun 2018 14:22:31 -0700 (PDT) In-Reply-To: <20180623124354.GB1753@michaelspb> References: <20180621220916.1B994175DA4@albiero.videolan.org> <20180623124354.GB1753@michaelspb> From: Carl Eugen Hoyos Date: Mon, 25 Jun 2018 23:22:31 +0200 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] lavf/amr: Make the heuristic for auto-detection even stricter. 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" 2018-06-23 14:43 GMT+02:00, Michael Niedermayer : > On Thu, Jun 21, 2018 at 10:09:14PM +0000, Carl Eugen Hoyos wrote: >> ffmpeg | branch: master | Carl Eugen Hoyos | Fri Jun >> 22 00:08:13 2018 +0200| [40b7e6071815fc416a4efc5dc1616f5460a3aacb] | >> committer: Carl Eugen Hoyos >> >> lavf/amr: Make the heuristic for auto-detection even stricter. >> >> Fixes ticket #7270. >> >> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=40b7e6071815fc416a4efc5dc1616f5460a3aacb >> --- >> >> libavformat/amr.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/libavformat/amr.c b/libavformat/amr.c >> index f954803d46..6cc06bceac 100644 >> --- a/libavformat/amr.c >> +++ b/libavformat/amr.c >> @@ -201,7 +201,7 @@ static int amrnb_probe(AVProbeData *p) >> i++; >> } >> } >> - if (valid > 100 && valid > invalid) >> + if (valid > 100 && valid >> 4 > invalid) >> return AVPROBE_SCORE_EXTENSION / 2 + 1; >> return 0; >> } >> @@ -258,8 +258,8 @@ static int amrwb_probe(AVProbeData *p) >> i++; >> } >> } >> - if (valid > 100 && valid > invalid) >> - return AVPROBE_SCORE_EXTENSION / 2 - 1; >> + if (valid > 100 && valid >> 4 > invalid) >> + return AVPROBE_SCORE_EXTENSION / 2 + 1; > > This breaks detecting the h263 file: > > https://samples.ffmpeg.org/V-codecs/h263/h263-raw/messenger.h263 Attached patch fixes the existing heuristic to avoid detection of files like this one. Sorry, Carl Eugen From 3bfac3c9a525e8ce92c025ee2853a600d71e64d5 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Mon, 25 Jun 2018 23:20:09 +0200 Subject: [PATCH] lavf/amr: Fix heuristic to avoid detection of repeated bytes. --- libavformat/amr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavformat/amr.c b/libavformat/amr.c index 6cc06bc..de34705 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -184,12 +184,11 @@ static int amrnb_probe(AVProbeData *p) while (i < p->buf_size) { mode = b[i] >> 3 & 0x0F; if (mode < 9 && (b[i] & 0x4) == 0x4) { - int last = mode; + int last = b[i]; int size = amrnb_packed_size[mode]; while (size--) { if (b[++i] != last) break; - last = b[i]; } if (size > 0) { valid++; @@ -241,12 +240,11 @@ static int amrwb_probe(AVProbeData *p) while (i < p->buf_size) { mode = b[i] >> 3 & 0x0F; if (mode < 10 && (b[i] & 0x4) == 0x4) { - int last = mode; + int last = b[i]; int size = amrwb_packed_size[mode]; while (size--) { if (b[++i] != last) break; - last = b[i]; } if (size > 0) { valid++; -- 1.7.10.4