From patchwork Fri Sep 29 17:23:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 5343 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.61.197 with SMTP id n188csp1021182jan; Fri, 29 Sep 2017 10:23:46 -0700 (PDT) X-Received: by 10.223.187.148 with SMTP id q20mr7907360wrg.34.1506705826400; Fri, 29 Sep 2017 10:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506705826; cv=none; d=google.com; s=arc-20160816; b=vRyMhQqSClnvdSTj06u3JcNwmaCNlM9dzwBi4PCHSgjfNWA9okIv3h4EEpjyZHPIBh ySHRgKicQ6HZTeJoBTnlXpWIY4ozNvZue+A6Inuyqn8UJMLxRIEkyn0IbHS0vBuxXWBb eBO6tRZtZymFlQSKWQlJLY8uxGfb1p0uhRLNiOjM2ZsbXcee+irdUwTxTMp32cC/+fN3 3pD8qx2PUYtikY014dNfura+EUJ2u+P1iu2DdL2xZjBY2pYruNwxrDIfttk++JCDNOM4 fHovGmfuBFMONadj6aJDRCG83wuOHiiEJdzTO57oHcz2fIRObRn8mvNRpvgTpyHtKCg4 UJSw== 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:delivered-to :arc-authentication-results; bh=irwz928ZuUtfQWp4wJt0u9WH8E/PQ+jnYi2jAavoEnU=; b=hXh1NZ8hEgUwv7+UK7yyiWKiDs36hZ0rc0nYgabKoTSX+daCpIlUQnv8MOQNPCd+yt 7m93UnWNlE3DGwKdMRAb+HjfvQdJnj42QB8Y/WAtLM5/vcIsqMd7KU2hOuM6365p3a45 AKCmZ5DrgJeOQZH0clTe89hTbtgSgApcAHz8QpekHprZzFz8xeE+3Z3XSYrnIrPMmsuI Q9ecgnkyG4fkznvnCT+KeTJ2jQ4eAAVikRaLKwsJaFfics3DAURgdJXLqUo1F1qAV7ej LxsPVnt1DrhpRk3ciQPCOdSu4pV986vSOlNKMfF/uBYAgwK8W9AE1qVKDIaXvRG3Eh0u QXoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=I+Yi4HzL; 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=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 m15si3075794wmb.74.2017.09.29.10.23.45; Fri, 29 Sep 2017 10:23:46 -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=I+Yi4HzL; 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=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0E1C4689A84; Fri, 29 Sep 2017 20:23:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io0-f174.google.com (mail-io0-f174.google.com [209.85.223.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 543A3689A66 for ; Fri, 29 Sep 2017 20:23:26 +0300 (EEST) Received: by mail-io0-f174.google.com with SMTP id k101so407175iod.0 for ; Fri, 29 Sep 2017 10:23:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=G3KgNX63fxsdnGv6J0lDhOzKNQcI0e8nIay2UCS+alg=; b=I+Yi4HzL/XfYjLcJPSsIX7dGx2OkpFE94R5BrJ5MGPlYD2YKpwNjGqLGsOfgGErSFk z73a6sDFGc3n3HA7h6Cg9t3R6yWa5MOo0igRM3grW3h+fZ+aSC46A9vloS5yt6QSI9hO Sxmy8f+5PQkH3vtyaJEwjnZPljb1BVRd/7hibmGkdlvH3+UuDPvLzi5fYyob0JRBziyn m89s2tgDKvRknqSsYNhyPyS4+foXaBzNAI6mAGxYHUJbUIp3dblFIkuPefogPMNcjDp6 oMPOFWNySER0GbNYI936UErZcxxbGBoSqESjnJoThpO5n61rK0mvKQUSaBs5yy2lSiWc 9Cyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=G3KgNX63fxsdnGv6J0lDhOzKNQcI0e8nIay2UCS+alg=; b=YbAQVDbHejuvHESNbTewuuZSdPoVeMERjUSMbBJ15H1aorzDX2egH/ZPUEyTvLYNtV 9M3/h/5QWwQsvm07jSmsi/sTYjOWgAm8JHozlUz8lU869B0q5zuakiHuZhVzqC/1r7h5 S1kEJZP/FnHoyCnyoQvRfd0wp3B3fpGtq2vzmw4oczKwI94BxkM+hqV2RMI64JzhsbGd jZTjn3k/GfHVtPiOrobgv/PfncMJi5V3/pbR+goCoBGKPm5i7cAquqUzVkpRv4C+LoCa Avq/jQrPk+VGGJPXuZfi1o+j8aDRJyAokyPyWdMXvHTzTjhTIuT29INMgm+BbeuWPnDL xRww== X-Gm-Message-State: AMCzsaWEXcsa4yvVtd0K8gqb/bZqDGMSqc8PtotdhStW+X3IKd3gKQ+b wlz4DQUPV693u19G9TbolTx94d2MjAnbTFTkSP8= X-Google-Smtp-Source: AOwi7QCY8Vib/nEqSotXpDQ8jnFMSuQOvK6y82jcDMqD1kAYKuivaxje3HW/QZSICmeMw+NOFiAfTVixQvYrJR5vddk= X-Received: by 10.107.10.9 with SMTP id u9mr14703562ioi.107.1506705818427; Fri, 29 Sep 2017 10:23:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.2.139.4 with HTTP; Fri, 29 Sep 2017 10:23:17 -0700 (PDT) From: Carl Eugen Hoyos Date: Fri, 29 Sep 2017 19:23:17 +0200 Message-ID: To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH]lavf/bit: Fix the G.729 bit auto-detection 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" Hi! The G.729 bit auto-detection has never worked, patch attached. Please comment, Carl Eugen From 2521a9bd86d807a3e18fe930b35039beb7674b3e Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 29 Sep 2017 19:10:46 +0200 Subject: [PATCH] lavf/bit: Fix the G.729 bit auto-detection. --- libavformat/bit.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/libavformat/bit.c b/libavformat/bit.c index d742a5b..f90e4a7 100644 --- a/libavformat/bit.c +++ b/libavformat/bit.c @@ -32,20 +32,23 @@ #if CONFIG_BIT_DEMUXER static int probe(AVProbeData *p) { - int i, j; + int i = 0, j, valid = 0; - if(p->buf_size < 0x40) - return 0; - - for(i=0; i+3buf_size && i< 10*0x50; ){ - if(AV_RL16(&p->buf[0]) != SYNC_WORD) + while (2 * i + 3 < p->buf_size){ + if (AV_RL16(&p->buf[2 * i++]) != SYNC_WORD) return 0; - j=AV_RL16(&p->buf[2]); - if(j!=0x40 && j!=0x50) + j = AV_RL16(&p->buf[2 * i++]); + if (j != 0 && j != 0x10 && j != 0x40 && j != 0x50) return 0; - i+=j; + if (j) + valid++; + i += j; } - return AVPROBE_SCORE_EXTENSION; + if (valid > 10) + return AVPROBE_SCORE_MAX; + if (valid > 2) + return AVPROBE_SCORE_EXTENSION - 1; + return 0; } static int read_header(AVFormatContext *s) -- 1.7.10.4