From: Takashi Iwai Subject: Re: [PATCH] alsa-lib: update linked hw_ptr and appl_ptr Date: Mon, 28 Nov 2016 20:16:24 +0100 Message-ID: References: <1480069505-16668-1-git-send-email-sutar.mounesh@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 8359E266DD3 for ; Mon, 28 Nov 2016 20:16:26 +0100 (CET) In-Reply-To: <1480069505-16668-1-git-send-email-sutar.mounesh@gmail.com> 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 To: sutar.mounesh@gmail.com Cc: alsa-devel@alsa-project.org, Andreas Pape , mounesh_sutar@mentor.com List-Id: alsa-devel@alsa-project.org On Fri, 25 Nov 2016 11:25:05 +0100, sutar.mounesh@gmail.com wrote: > > 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 Judging from the description, isn't it a generic problem, not specific to file plugin? thanks, Takashi > --- > 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; > } > > -- > 1.7.9.5 >