From patchwork Fri Nov 25 10:25:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sutar.mounesh@gmail.com X-Patchwork-Id: 9447359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CECA760778 for ; Fri, 25 Nov 2016 11:03:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDAED27FB6 for ; Fri, 25 Nov 2016 11:03:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B297828111; Fri, 25 Nov 2016 11:03:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0852627FB6 for ; Fri, 25 Nov 2016 11:03:06 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8EA24266912; Fri, 25 Nov 2016 12:03:03 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 2FC4C2671FF; Fri, 25 Nov 2016 12:00:43 +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 4B16126720A; Fri, 25 Nov 2016 11:25:20 +0100 (CET) Received: from mail-pg0-f66.google.com (mail-pg0-f66.google.com [74.125.83.66]) by alsa0.perex.cz (Postfix) with ESMTP id 0B1482671EF; Fri, 25 Nov 2016 11:25:13 +0100 (CET) Received: by mail-pg0-f66.google.com with SMTP id e9so5248654pgc.1; Fri, 25 Nov 2016 02:25:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=KeGnz89x2Pzx2Kv1UNG2oy5QRniWbRZhTzwUz8bqMm0=; b=n/FDg5GLQyGtEyojMORcYsEYGe9/iqSpGAvJS1gugYgdyhk/5OwMOqE2b1/YQogu33 vkT8KdBWzga4+wmTsWQLq7E6yVQtRUNAq1boueOG0cEMyb5H7Y9FHG0/hJq7PdWnrn2N urwm49yt8WWrHTKEl/1Ypj9zIP9Z4wwJY4eq5Ldc1dG/QL4//WeC/S4w5LiJvcTsMrOK rIv+xC+YNbbHWrDWkCRLJ8PAtZ9JmVlSuz6IR9NBABLNqEU0rV6UkkTs7z1eN+R0MzJx 5OOLVvky0mlokMXv6a2ga7oKzX9Dmfr0XQzUucmKDOpN/YUGkqCVElRMYoQhn4sUa0Fu oexw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=KeGnz89x2Pzx2Kv1UNG2oy5QRniWbRZhTzwUz8bqMm0=; b=Tm0hMBO8B4rOKjM7FDuogLIb735d7o4EmIY4gNs65SCN9EINZeylIKIeOaxZ1SsGfv 6ov3fH0CHkz1UO7QOA4AGIsqSpti3+dX7t/23WEnXvwilGCOvNz+aHDhyKjpZD7Zwz1H uHEaLCCO4DIG+3oYWp8BdY5FJDSZFTtfYT/064FkbyQWsPtthfjv092T1KIbkuiBSXpQ eOgzdrzj3OOx4pIvusIJTPOG4j9VvgQrRRYvrAKiF/P5WBuiDj8zRjF6ezbNpy7lcSI5 F3uUIYVyIeh1TdFmx1FU+eGzteJlhU1a0tMN0Wln9BVfSC1JUJ30lgMnLNHDkOeUtFgE fhxA== X-Gm-Message-State: AKaTC00VqqwMH/ylxEaOjHg/isNhDvnyGmZyLbjkgz7F/QY41nS03s3dA5lpvCuzENeHqQ== X-Received: by 10.99.116.25 with SMTP id p25mr12701069pgc.161.1480069511753; Fri, 25 Nov 2016 02:25:11 -0800 (PST) Received: from mounesh-VirtualBox.inp.mentorg.com ([139.181.35.34]) by smtp.gmail.com with ESMTPSA id q2sm48790248pga.8.2016.11.25.02.25.09 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Nov 2016 02:25:11 -0800 (PST) From: sutar.mounesh@gmail.com To: patch@alsa-project.org Date: Fri, 25 Nov 2016 15:55:05 +0530 Message-Id: <1480069505-16668-1-git-send-email-sutar.mounesh@gmail.com> X-Mailer: git-send-email 1.7.9.5 Cc: alsa-devel@alsa-project.org, Andreas Pape , mounesh_sutar@mentor.com Subject: [alsa-devel] [PATCH] alsa-lib: update linked hw_ptr and appl_ptr 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Andreas Pape Plugin file provides no private hw_ptr and appl_ptr but instead links them to the slave pcm. If the slave pcm itself changes its hw_ptr or app_prt this needs to be done in file plugin, too. Plugin 'plug' is such a candidate changing the hw_ptr and app_ptr in hw_params call dependent on the automatically inserted plugins. ALSA unfortunately has no support for automatically updating chained pointers. A notification on pointer change seems to be prepared inside the snd_pcm_set_ptr() routine via rbptr->changed(), but it is not (yet) implemented so that we need to care for it manually. Signed-off-by: Andreas Pape --- src/pcm/pcm_file.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c index fec76eb..1e3d35b 100644 --- a/src/pcm/pcm_file.c +++ b/src/pcm/pcm_file.c @@ -634,6 +634,14 @@ static int snd_pcm_file_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) return err; } } + + /* pointer may have changed - e.g if plug is used. */ + snd_pcm_unlink_hw_ptr(pcm, file->gen.slave); + snd_pcm_unlink_appl_ptr(pcm, file->gen.slave); + + snd_pcm_link_hw_ptr(pcm, file->gen.slave); + snd_pcm_link_appl_ptr(pcm, file->gen.slave); + return 0; }