From patchwork Thu Dec 3 11:25:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Fitzgerald X-Patchwork-Id: 7758501 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 739A09F39D for ; Thu, 3 Dec 2015 11:26:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5306F20592 for ; Thu, 3 Dec 2015 11:26:04 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 06C3D20499 for ; Thu, 3 Dec 2015 11:26:02 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id EFBBC2666F2; Thu, 3 Dec 2015 12:26:00 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 25BE22666C9; Thu, 3 Dec 2015 12:25:53 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1E0722666D4; Thu, 3 Dec 2015 12:25:51 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by alsa0.perex.cz (Postfix) with ESMTP id 1CF64265325 for ; Thu, 3 Dec 2015 12:25:37 +0100 (CET) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.15.0.59/8.15.0.59) with SMTP id tB3BPbD2004708; Thu, 3 Dec 2015 05:25:37 -0600 Received: from mail1.cirrus.com (mail1.cirrus.com [141.131.3.20]) by mx0b-001ae601.pphosted.com with ESMTP id 1yf9jnyjnf-1; Thu, 03 Dec 2015 05:25:37 -0600 Received: from EX12.ad.cirrus.com (unknown [172.19.9.182]) by mail1.cirrus.com (Postfix) with ESMTP id 8469F34036; Thu, 3 Dec 2015 05:25:54 -0600 (CST) Received: from imbe.wolfsonmicro.main (172.20.9.178) by EX12.ad.cirrus.com (172.19.9.182) with Microsoft SMTP Server id 14.3.248.2; Thu, 3 Dec 2015 11:25:35 +0000 Received: from rf-debian.wolfsonmicro.main ([172.22.20.23]) by imbe.wolfsonmicro.main (8.14.4/8.14.4) with ESMTP id tB3BPZpJ011372; Thu, 3 Dec 2015 11:25:35 GMT From: Richard Fitzgerald To: Date: Thu, 3 Dec 2015 11:25:35 +0000 Message-ID: <1449141935-23350-1-git-send-email-rf@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1507310000 definitions=main-1512030191 Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com Subject: [alsa-devel] [PATCH] crec: Always read whole number of fragments when length limit specified X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch removes the lines that adjusted the read size to exactly read to the end of the calculated length in bytes. Doing this could lead to invalid fragment sizes being requested which may then cause a read error on some codecs. Instead we keep reading whole fragments until we have >= length bytes of data captured. Signed-off-by: Richard Fitzgerald --- src/utils/crec.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/utils/crec.c b/src/utils/crec.c index 258fade..e61e620 100644 --- a/src/utils/crec.c +++ b/src/utils/crec.c @@ -332,9 +332,6 @@ void capture_samples(char *name, unsigned int card, unsigned int device, fprintf(finfo, "%s: Capturing audio NOW!!!\n", __func__); do { - if (length && size > length - total_read) - size = length - total_read; - read = compress_read(compress, buffer, size); if (read < 0) { fprintf(stderr, "Error reading sample\n");