From patchwork Tue Mar 4 11:51:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "MONTANARO Luciano (MM)" X-Patchwork-Id: 3761501 X-Patchwork-Delegate: tiwai@suse.de 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9D11A9F1EE for ; Tue, 4 Mar 2014 11:51:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BF7BC203B6 for ; Tue, 4 Mar 2014 11:51:53 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 366BE203AF for ; Tue, 4 Mar 2014 11:51:51 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3110A26576E; Tue, 4 Mar 2014 12:51:50 +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=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 4E1BF26575F; Tue, 4 Mar 2014 12:51:46 +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 3DE19265765; Tue, 4 Mar 2014 12:51:45 +0100 (CET) Received: from mx2.ex2007.fiatgroup.com (mx1.ex2007.fiatgroup.com [129.35.118.116]) by alsa0.perex.cz (Postfix) with ESMTP id 5C1F32656E9 for ; Tue, 4 Mar 2014 12:51:38 +0100 (CET) Received: from cshu06.fgremc.it (151.92.205.127) by mx1.ex2007.fiatgroup.com (151.88.80.20) with Microsoft SMTP Server (TLS) id 8.3.298.1; Tue, 4 Mar 2014 12:51:37 +0100 Received: from MXCL13.fgremc.it ([151.92.204.153]) by cshu06.fgremc.it ([151.92.205.127]) with mapi; Tue, 4 Mar 2014 12:51:37 +0100 From: "MONTANARO Luciano (MM)" To: "alsa-devel@alsa-project.org" Date: Tue, 4 Mar 2014 12:51:36 +0100 Thread-Topic: [PATCH] Wrap hw_ptr to boundary in pcm_ioplug Thread-Index: Ac83oBh/q7INquvKQgieFuY4bVv8qw== Message-ID: <67BA5DEFFBE7BF46B4C53F7E5FC5AD44344700ED7C@MXCL13.fgremc.it> Accept-Language: it-IT Content-Language: it-IT X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: it-IT MIME-Version: 1.0 Subject: [alsa-devel] [PATCH] Wrap hw_ptr to boundary in pcm_ioplug 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 The function snd_pcm_ioplug_hw_ptr_update() always increased the hw_ptr by delta, without wrapping it to the boundary. This would lead to problems when after many hours, the hw_ptr would overflow. --- src/pcm/pcm_ioplug.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- 1.7.0.4 -- Luciano Montanaro EntryNAV - Audio Software Integrator Magneti Marelli Electronic Systems Viale Carlo Emanuele II 150, Venaria Reale (To) Tel. (+39) 011 6879765 VISITA IL NOSTRO NUOVO SITO WEB! - VISIT OUR NEW WEB SITE! www.magnetimarelli.com Confidential Notice: This message - including its attachments - may contain proprietary, confidential and/or legally protected information and is intended solely for the use of the designated addressee(s) above. If you are not the intended recipient be aware that any downloading, copying, disclosure, distribution or use of the contents of the above information is strictly prohibited. If you have received this communication by mistake, please forward the message back to the sender at the email address above, delete the message from all mailboxes and any other electronic storage medium and destroy all copies. Disclaimer Notice: Internet communications cannot be guaranteed to be safe or error-free. Therefore we do not assure that this message is complete or accurate and we do not accept liability for any errors or omissions in the contents of this message. diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c index a90c844..c1c3a98 100644 --- a/src/pcm/pcm_ioplug.c +++ b/src/pcm/pcm_ioplug.c @@ -60,7 +60,7 @@ static void snd_pcm_ioplug_hw_ptr_update(snd_pcm_t *pcm) delta = hw - io->last_hw; else delta = pcm->buffer_size + hw - io->last_hw; - io->data->hw_ptr += delta; + snd_pcm_mmap_hw_forward(io->data->pcm, delta); io->last_hw = hw; } else io->data->state = SNDRV_PCM_STATE_XRUN;