* [PATCH] alsa-lib: update linked hw_ptr and appl_ptr @ 2016-11-25 10:25 sutar.mounesh 2016-11-28 19:16 ` Takashi Iwai 0 siblings, 1 reply; 4+ messages in thread From: sutar.mounesh @ 2016-11-25 10:25 UTC (permalink / raw) To: patch; +Cc: alsa-devel, Andreas Pape, mounesh_sutar From: Andreas Pape <apape@de.adit-jv.com> 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 <apape@de.adit-jv.com> --- 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 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] alsa-lib: update linked hw_ptr and appl_ptr 2016-11-25 10:25 [PATCH] alsa-lib: update linked hw_ptr and appl_ptr sutar.mounesh @ 2016-11-28 19:16 ` Takashi Iwai 2016-12-08 10:56 ` Sutar, Mounesh 0 siblings, 1 reply; 4+ messages in thread From: Takashi Iwai @ 2016-11-28 19:16 UTC (permalink / raw) To: sutar.mounesh; +Cc: alsa-devel, Andreas Pape, mounesh_sutar On Fri, 25 Nov 2016 11:25:05 +0100, sutar.mounesh@gmail.com wrote: > > From: Andreas Pape <apape@de.adit-jv.com> > > 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 <apape@de.adit-jv.com> 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 > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] alsa-lib: update linked hw_ptr and appl_ptr 2016-11-28 19:16 ` Takashi Iwai @ 2016-12-08 10:56 ` Sutar, Mounesh 2016-12-14 14:45 ` Takashi Iwai 0 siblings, 1 reply; 4+ messages in thread From: Sutar, Mounesh @ 2016-12-08 10:56 UTC (permalink / raw) To: Takashi Iwai; +Cc: sutar.mounesh, alsa-devel, Andreas Pape Hi Takashi, This is the update I got from Andreas: "This is not a generic problem, but can be observed in plugins which use manual linking method. The plugins such as PLUG, FILE, METER, MULTI and HOOK use manual linkage. PLUG is the 'bad guy' which might change the linking in hw_param operation. METER and MULTI might need to be fixed as well. HOOKS does not use transfer/processing of frames, so seems harmless (but not 100% sure- linkage should be updated for completeness) The current fix is provided for FILE plugin ONLY" Regards, Mounesh -----Original Message----- From: Takashi Iwai [mailto:tiwai@suse.de] Sent: 29 November 2016 00:46 To: sutar.mounesh@gmail.com Cc: alsa-devel@alsa-project.org; Sutar, Mounesh <Mounesh_Sutar@mentor.com>; Andreas Pape <apape@de.adit-jv.com> Subject: Re: [PATCH] alsa-lib: update linked hw_ptr and appl_ptr On Fri, 25 Nov 2016 11:25:05 +0100, sutar.mounesh@gmail.com wrote: > > From: Andreas Pape <apape@de.adit-jv.com> > > 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 <apape@de.adit-jv.com> 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 > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] alsa-lib: update linked hw_ptr and appl_ptr 2016-12-08 10:56 ` Sutar, Mounesh @ 2016-12-14 14:45 ` Takashi Iwai 0 siblings, 0 replies; 4+ messages in thread From: Takashi Iwai @ 2016-12-14 14:45 UTC (permalink / raw) To: Sutar, Mounesh; +Cc: sutar.mounesh, alsa-devel, Andreas Pape On Thu, 08 Dec 2016 11:56:12 +0100, Sutar, Mounesh wrote: > > Hi Takashi, > This is the update I got from Andreas: > > "This is not a generic problem, but can be observed in plugins which use manual linking method. > The plugins such as PLUG, FILE, METER, MULTI and HOOK use manual linkage. > PLUG is the 'bad guy' which might change the linking in hw_param operation. > METER and MULTI might need to be fixed as well. > HOOKS does not use transfer/processing of frames, so seems harmless (but not 100% sure- linkage should be updated for completeness) > > The current fix is provided for FILE plugin ONLY" OK, now I applied the patch as is. The change callback handling would be good if we really have, but let's cover the bug quickly for now. thanks, Takashi > > Regards, > Mounesh > > > -----Original Message----- > From: Takashi Iwai [mailto:tiwai@suse.de] > Sent: 29 November 2016 00:46 > To: sutar.mounesh@gmail.com > Cc: alsa-devel@alsa-project.org; Sutar, Mounesh <Mounesh_Sutar@mentor.com>; Andreas Pape <apape@de.adit-jv.com> > Subject: Re: [PATCH] alsa-lib: update linked hw_ptr and appl_ptr > > On Fri, 25 Nov 2016 11:25:05 +0100, > sutar.mounesh@gmail.com wrote: > > > > From: Andreas Pape <apape@de.adit-jv.com> > > > > 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 <apape@de.adit-jv.com> > > 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 > > > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-12-14 14:45 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-11-25 10:25 [PATCH] alsa-lib: update linked hw_ptr and appl_ptr sutar.mounesh 2016-11-28 19:16 ` Takashi Iwai 2016-12-08 10:56 ` Sutar, Mounesh 2016-12-14 14:45 ` Takashi Iwai
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.