All of lore.kernel.org
 help / color / mirror / Atom feed
* snd_pcm_poll_descriptors() error return
@ 2018-10-01 21:23 Alan Horstmann
  2018-10-01 23:32 ` Takashi Sakamoto
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Horstmann @ 2018-10-01 21:23 UTC (permalink / raw)
  To: alsa-devel; +Cc: Takashi Iwai

Hi,

A user of the Portaudio library is reporting that from Alsa version 1.1.4 the 
function snd_pcm_poll_descriptors() can return -32 (Broken Pipe), and this 
fails an assert within Portaudio.  Earlier 1.1.3 does not seem to  show this 
issue.  For more details, see 
https://app.assembla.com/spaces/portaudio/support/tickets/268.

The Alsa docs don't mention any possible negative error code from this 
function - has the behaviour changed, or is it likely something else is 
triggering the difference?

Regards

Alan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: snd_pcm_poll_descriptors() error return
  2018-10-01 21:23 snd_pcm_poll_descriptors() error return Alan Horstmann
@ 2018-10-01 23:32 ` Takashi Sakamoto
  2018-10-02 15:38   ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Sakamoto @ 2018-10-01 23:32 UTC (permalink / raw)
  To: Alan Horstmann, alsa-devel; +Cc: Takashi Iwai

Hi,

On Oct 02 2018 06:23, Alan Horstmann wrote:
> A user of the Portaudio library is reporting that from Alsa version 1.1.4 the
> function snd_pcm_poll_descriptors() can return -32 (Broken Pipe), and this
> fails an assert within Portaudio.  Earlier 1.1.3 does not seem to  show this
> issue.  For more details, see
> https://app.assembla.com/spaces/portaudio/support/tickets/268.
> 
> The Alsa docs don't mention any possible negative error code from this
> function - has the behaviour changed, or is it likely something else is
> triggering the difference?

Return values from a call of 'snd_pcm_poll_descriptors()' varies
depending on implementation of PCM plugins for used PCM node. Therefore
it's impossible to cover all of the values in documentation.

In a design of alsa-lib, 'snd_pcm_poll_descriptors()' is a thin wrapper
of '.poll_descriptors' callback of internal/external structure of PCM
plugins, therefore its behaviour is dynamically different depending on
each implementation.

For example, when using 'hw' PCM node directly, a call of this function
can returns '-ENOMEM' or '2':
http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/pcm/pcm_hw.c;h=59a242009e9f5f1098759305499eaa27bef6c1ab;hb=HEAD#l227

When using 'dmix' PCM node, '-EIO', '0', '-EPIPE' and '1':
http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/pcm/pcm_direct.c;h=2b07eff90ff6e12200e27a0d40378f29a7bf0d24;hb=HEAD#l668

When using PCM node with external PCM plugins such as 'pulse',
'snd_pcm_ioplug_create()' is called to instantiate plugin structure,
and a call of 'snd_pcm_poll_descriptors()' can return '-EIO', '0', '1',
and value depending on plugin implementation.
http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/pcm/pcm_ioplug.c;h=881a1a85adaf09b4732375e2161b0a1ebb53900f;hb=HEAD#l772

When having good discussion to investigate cause, discover solution for
this kind of issues, you need to identify which PCM node triggers the
issue, at least.


Regards

Takashi Sakamoto

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: snd_pcm_poll_descriptors() error return
  2018-10-01 23:32 ` Takashi Sakamoto
@ 2018-10-02 15:38   ` Takashi Iwai
  2018-10-02 20:28     ` Alan Horstmann
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2018-10-02 15:38 UTC (permalink / raw)
  To: Takashi Sakamoto; +Cc: alsa-devel

On Tue, 02 Oct 2018 01:32:10 +0200,
Takashi Sakamoto wrote:
> 
> Hi,
> 
> On Oct 02 2018 06:23, Alan Horstmann wrote:
> > A user of the Portaudio library is reporting that from Alsa version 1.1.4 the
> > function snd_pcm_poll_descriptors() can return -32 (Broken Pipe), and this
> > fails an assert within Portaudio.  Earlier 1.1.3 does not seem to  show this
> > issue.  For more details, see
> > https://app.assembla.com/spaces/portaudio/support/tickets/268.
> >
> > The Alsa docs don't mention any possible negative error code from this
> > function - has the behaviour changed, or is it likely something else is
> > triggering the difference?
> 
> Return values from a call of 'snd_pcm_poll_descriptors()' varies
> depending on implementation of PCM plugins for used PCM node. Therefore
> it's impossible to cover all of the values in documentation.
> 
> In a design of alsa-lib, 'snd_pcm_poll_descriptors()' is a thin wrapper
> of '.poll_descriptors' callback of internal/external structure of PCM
> plugins, therefore its behaviour is dynamically different depending on
> each implementation.
> 
> For example, when using 'hw' PCM node directly, a call of this function
> can returns '-ENOMEM' or '2':
> http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/pcm/pcm_hw.c;h=59a242009e9f5f1098759305499eaa27bef6c1ab;hb=HEAD#l227
> 
> When using 'dmix' PCM node, '-EIO', '0', '-EPIPE' and '1':
> http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/pcm/pcm_direct.c;h=2b07eff90ff6e12200e27a0d40378f29a7bf0d24;hb=HEAD#l668
> 
> When using PCM node with external PCM plugins such as 'pulse',
> 'snd_pcm_ioplug_create()' is called to instantiate plugin structure,
> and a call of 'snd_pcm_poll_descriptors()' can return '-EIO', '0', '1',
> and value depending on plugin implementation.
> http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/pcm/pcm_ioplug.c;h=881a1a85adaf09b4732375e2161b0a1ebb53900f;hb=HEAD#l772
> 
> When having good discussion to investigate cause, discover solution for
> this kind of issues, you need to identify which PCM node triggers the
> issue, at least.

Yes, this function may return an error code, and it's the defined
behavior from the beginning.  So, please fix the error handling in the
application side.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: snd_pcm_poll_descriptors() error return
  2018-10-02 15:38   ` Takashi Iwai
@ 2018-10-02 20:28     ` Alan Horstmann
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Horstmann @ 2018-10-02 20:28 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On Tuesday 02 October 2018 16:38, Takashi Iwai wrote:
> On Tue, 02 Oct 2018 01:32:10 +0200,
>
> Takashi Sakamoto wrote:
> > Hi,
> >
> > On Oct 02 2018 06:23, Alan Horstmann wrote:
> > > A user of the Portaudio library is reporting that from Alsa version
> > > 1.1.4 the function snd_pcm_poll_descriptors() can return -32 (Broken
> > > Pipe), and this fails an assert within Portaudio.  Earlier 1.1.3 does
> > > not seem to  show this issue.  For more details, see
> > > https://app.assembla.com/spaces/portaudio/support/tickets/268.
> > >
> > > The Alsa docs don't mention any possible negative error code from this
> > > function - has the behaviour changed, or is it likely something else is
> > > triggering the difference?
> >
> > Return values from a call of 'snd_pcm_poll_descriptors()' varies
> > depending on implementation of PCM plugins for used PCM node. Therefore
> > it's impossible to cover all of the values in documentation.
> >
> > In a design of alsa-lib, 'snd_pcm_poll_descriptors()' is a thin wrapper
> > of '.poll_descriptors' callback of internal/external structure of PCM
> > plugins, therefore its behaviour is dynamically different depending on
> > each implementation.
> >
> > For example, when using 'hw' PCM node directly, a call of this function
> > can returns '-ENOMEM' or '2':
> > http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/pcm/pcm_hw.c;h=5
> >9a242009e9f5f1098759305499eaa27bef6c1ab;hb=HEAD#l227
> >
> > When using 'dmix' PCM node, '-EIO', '0', '-EPIPE' and '1':
> > http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/pcm/pcm_direct.c
> >;h=2b07eff90ff6e12200e27a0d40378f29a7bf0d24;hb=HEAD#l668
> >
> > When using PCM node with external PCM plugins such as 'pulse',
> > 'snd_pcm_ioplug_create()' is called to instantiate plugin structure,
> > and a call of 'snd_pcm_poll_descriptors()' can return '-EIO', '0', '1',
> > and value depending on plugin implementation.
> > http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/pcm/pcm_ioplug.c
> >;h=881a1a85adaf09b4732375e2161b0a1ebb53900f;hb=HEAD#l772
> >
> > When having good discussion to investigate cause, discover solution for
> > this kind of issues, you need to identify which PCM node triggers the
> > issue, at least.
>
> Yes, this function may return an error code, and it's the defined
> behavior from the beginning.  So, please fix the error handling in the
> application side.

OK, thanks for that info - so we will have to check the function return more 
carefully than at present!  I appreciate the input from both of you on this.

Regards

Alan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-02 20:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-01 21:23 snd_pcm_poll_descriptors() error return Alan Horstmann
2018-10-01 23:32 ` Takashi Sakamoto
2018-10-02 15:38   ` Takashi Iwai
2018-10-02 20:28     ` Alan Horstmann

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.