From patchwork Sun Dec 23 15:29:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul B Mahol X-Patchwork-Id: 11529 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 87E6444DFB3 for ; Sun, 23 Dec 2018 17:35:28 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 36A6B68B085; Sun, 23 Dec 2018 17:35:25 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1E9B068ACFF for ; Sun, 23 Dec 2018 17:35:19 +0200 (EET) Received: by mail-wr1-f66.google.com with SMTP id x10so9664530wrs.8 for ; Sun, 23 Dec 2018 07:35:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=Hsxsg/MnTmS4oBKI5QfUch8tficK9syUD52GcBxOIeY=; b=e6QZ8CgXmtuiNtj+lKbi7qv6D9x3wSmY9DABM74zhrFeKl8WAn9OHdzpx8K1xjFUSY giKVyiIiZvZck1MH+E8oYg7IpdH/iSg5X5aKF9IEg1HFDJKq76wLE8IyHzWdtBfPrxoE /izUXSzUhKW+MTsWd+ekMOmqn+sV4HOYUveoZT7hMen0Rg1LxypxBwTuAsoqjTzEM3Hj iiOGtFGdVnPmEYVfhLB7GLmX80FquAMgFtn6Dsj55nval77Ug5V1ED9u4jCaA8r4IdnZ 56bXy+H0VPVietMXl4DR/0Wm6PAho/+gIbG9oYYLG/yvWrPiug+rzB41KTvhGEB9jPJ+ XQCw== 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; bh=Hsxsg/MnTmS4oBKI5QfUch8tficK9syUD52GcBxOIeY=; b=P9XrNfZTpPqwz7hZeHpKnO4SNkri6qzbPjwrT8d8iLdwJ/U3/OeXNaamSQmENmXsH8 zcyvfmC9TPGZ8xT3Jyu3s0KRmQfF1GlunBWR9vk1eiBMnbcLZjg3NMPJJHJkQgJmkO9N F8+aS+I4SWBnnMQJXYMyxMSfGZkoVI4a02678eIGGNwkTmpvrDFiQ+0MYP6X/RbtzRD8 3kwI7J004kE3JX5QG0/sD6xksVBzPbFMSMiYR3JzgE8ys2SwuvwgkDY9eDrXOhVvDby/ nG8NSUR0Ks2PYbKOEZ8GOtVXk8mFAeOIyINrMETafS+LP4osYDj85WlafUMQ4xDP3HHg 2TYw== X-Gm-Message-State: AJcUukd5KQd5p1PujT3mY3SeWg/Hj7x/+IHnpWWjNsQxiP7bGXbyc5XW kNA+iZA/FMFmsV4fZG6kaIJH7Jlj X-Google-Smtp-Source: ALg8bN45GfBPklFu0akByHSLZYK0XrJh65TsGzCkTqzTp38nshl7ywkTpllsQHYoqGUcm0o1OPo3GA== X-Received: by 2002:a5d:6808:: with SMTP id w8mr8729520wru.270.1545578963940; Sun, 23 Dec 2018 07:29:23 -0800 (PST) Received: from localhost.localdomain ([94.250.174.60]) by smtp.gmail.com with ESMTPSA id m15sm15312696wrr.95.2018.12.23.07.29.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Dec 2018 07:29:23 -0800 (PST) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Sun, 23 Dec 2018 16:29:14 +0100 Message-Id: <20181223152914.14638-1-onemda@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH] avformat/au: do not use invalid block_align for small bits per sample 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" Fixes #5481. Signed-off-by: Paul B Mahol --- libavformat/au.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/au.c b/libavformat/au.c index 520824fc12..0b2b7eac15 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -140,7 +140,7 @@ static int au_read_header(AVFormatContext *s) unsigned int tag; AVIOContext *pb = s->pb; unsigned int id, channels, rate; - int bps; + int bps, ba = 0; enum AVCodecID codec; AVStream *st; @@ -178,6 +178,7 @@ static int au_read_header(AVFormatContext *s) } else { const uint8_t bpcss[] = {4, 0, 3, 5}; av_assert0(id >= 23 && id < 23 + 4); + ba = bpcss[id - 23]; bps = bpcss[id - 23]; } } else if (!bps) { @@ -205,7 +206,7 @@ static int au_read_header(AVFormatContext *s) st->codecpar->sample_rate = rate; st->codecpar->bits_per_coded_sample = bps; st->codecpar->bit_rate = channels * rate * bps; - st->codecpar->block_align = FFMAX(bps * st->codecpar->channels / 8, 1); + st->codecpar->block_align = ba ? ba : FFMAX(bps * st->codecpar->channels / 8, 1); if (data_size != AU_UNKNOWN_SIZE) st->duration = (((int64_t)data_size)<<3) / (st->codecpar->channels * (int64_t)bps);