All of lore.kernel.org
 help / color / mirror / Atom feed
* "Resource temporarily unavailable" while reading although poll returns POLLIN event
@ 2010-04-21 11:28 Stefan Schoenleitner
  2010-04-21 16:15 ` Stefan Schoenleitner
  2010-04-22  2:41 ` Raymond Yau
  0 siblings, 2 replies; 19+ messages in thread
From: Stefan Schoenleitner @ 2010-04-21 11:28 UTC (permalink / raw)
  To: alsa-devel

Hi,

I wrote a small application that opens both streams (i.e. capture and playback)
of a PCM in non blocking (i.e. SND_PCM_NONBLOCK) mode.

During device configuration I also set up the minimum number of
frames to consider a PCM ready:

---------------------------------------------------------------------------------
// when to consider the device to be ready for the next data transfer operation
if ((ret=snd_pcm_sw_params_set_avail_min(handle, swparams, pcm_period_size))<0)
{
	fprintf(stderr, "could not set avail_min: %s\n", snd_strerror(ret));
	return NULL;
}
---------------------------------------------------------------------------------

As you can see it is set to the number of frames one period contains.

In other words, each time there are at least that many frames available for reading
on the capture device, we should get a POLLIN event when using poll().
On the other side we should get a POLLOUT event if that many frames can be written
to the playback device.


Then, later in my application, I use poll() on the fds of the PCM devices.
As, according to the ALSA reference, poll events can be "mangeled", I use
snd_pcm_poll_descriptors_revents() to "demangle" the events:

---------------------------------------------------------------------------------
if ((ret=snd_pcm_poll_descriptors_revents(device_handle, &poll_fds[i], 1, &revents))<0)
{
	fprintf(stderr, "could not snd_pcm_poll_descriptors_revents: %s\n", snd_strerror(ret));
	exit(EXIT_FAILURE);
}
---------------------------------------------------------------------------------



After that, each time there was a POLLIN event, I am reading exactly one period from the
capture PCM.
On the other side, if there was a POLLOUT event, I am writing exactly one period to the
playback PCM.


While this works for a small number of periods (which is not always the same), I always end up
with a "Resource temporarily unavailable" error when trying to read one period from the capture PCM:

---------------------------------------------------------------------------------
demangled poll: POLLIN  on capture device
could not read from capture device: Resource temporarily unavailable
---------------------------------------------------------------------------------


Since a POLLIN event only occurs after at least a full period is available for
reading (as set up by snd_pcm_sw_params_set_avail_min() above)
and I only read after a POLLIN event occured on the capture device fd,
I really do not understand why I get the above error.

So why does the above happen ?
What am I doing wrong ?

If it helps, I pasted the source code here so that you can view it nicely: http://pastebin.com/fCicqctq

cheers,
stefan

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-21 11:28 "Resource temporarily unavailable" while reading although poll returns POLLIN event Stefan Schoenleitner
@ 2010-04-21 16:15 ` Stefan Schoenleitner
  2010-04-21 17:18   ` Jaroslav Kysela
  2010-04-22  4:28   ` Raymond Yau
  2010-04-22  2:41 ` Raymond Yau
  1 sibling, 2 replies; 19+ messages in thread
From: Stefan Schoenleitner @ 2010-04-21 16:15 UTC (permalink / raw)
  To: alsa-devel

Stefan Schoenleitner wrote:
> Since a POLLIN event only occurs after at least a full period is available for
> reading (as set up by snd_pcm_sw_params_set_avail_min() above)
> and I only read after a POLLIN event occured on the capture device fd,
> I really do not understand why I get the above error.

By using snd_pcm_avail_update() I found out that polling on the PCMs
*does not work at all*.

Although I verified that avail_min is 160 frames, polling on the
capture/playback PCMs returns a POLLIN/POLLOUT event even if the number
of frames for reading/writing *is less than avail_main*.

I also tried snd_pcm_wait() which should also wait until there are at
least avail_min frames available for reading/writing.
The result is the same: snd_pcm_avail_update() shows that it returns
even if there are far less than avail_min frames available for processing.

I suspect that this is a bug in ALSA ?


cheers,
stefan

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-21 16:15 ` Stefan Schoenleitner
@ 2010-04-21 17:18   ` Jaroslav Kysela
  2010-04-22 10:09     ` Stefan Schoenleitner
  2010-04-22  4:28   ` Raymond Yau
  1 sibling, 1 reply; 19+ messages in thread
From: Jaroslav Kysela @ 2010-04-21 17:18 UTC (permalink / raw)
  To: Stefan Schoenleitner; +Cc: alsa-devel

On Wed, 21 Apr 2010, Stefan Schoenleitner wrote:

> Stefan Schoenleitner wrote:
>> Since a POLLIN event only occurs after at least a full period is available for
>> reading (as set up by snd_pcm_sw_params_set_avail_min() above)
>> and I only read after a POLLIN event occured on the capture device fd,
>> I really do not understand why I get the above error.
>
> By using snd_pcm_avail_update() I found out that polling on the PCMs
> *does not work at all*.
>
> Although I verified that avail_min is 160 frames, polling on the
> capture/playback PCMs returns a POLLIN/POLLOUT event even if the number
> of frames for reading/writing *is less than avail_main*.
>
> I also tried snd_pcm_wait() which should also wait until there are at
> least avail_min frames available for reading/writing.
> The result is the same: snd_pcm_avail_update() shows that it returns
> even if there are far less than avail_min frames available for processing.
>
> I suspect that this is a bug in ALSA ?

It might be. Could you post snd_pcm_dump() when you read less frames?

 					Jaroslav

-----
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-21 11:28 "Resource temporarily unavailable" while reading although poll returns POLLIN event Stefan Schoenleitner
  2010-04-21 16:15 ` Stefan Schoenleitner
@ 2010-04-22  2:41 ` Raymond Yau
  2010-04-22 10:15   ` Stefan Schoenleitner
  1 sibling, 1 reply; 19+ messages in thread
From: Raymond Yau @ 2010-04-22  2:41 UTC (permalink / raw)
  To: ALSA Development Mailing List

2010/4/21 Stefan Schoenleitner <dev.c0debabe@gmail.com>

> Hi,
>
> I wrote a small application that opens both streams (i.e. capture and
> playback)
> of a PCM in non blocking (i.e. SND_PCM_NONBLOCK) mode.
>
> During device configuration I also set up the minimum number of
> frames to consider a PCM ready:
>
>
> ---------------------------------------------------------------------------------
> // when to consider the device to be ready for the next data transfer
> operation
> if ((ret=snd_pcm_sw_params_set_avail_min(handle, swparams,
> pcm_period_size))<0)
> {
>        fprintf(stderr, "could not set avail_min: %s\n", snd_strerror(ret));
>        return NULL;
> }
>
> ---------------------------------------------------------------------------------
>
> As you can see it is set to the number of frames one period contains.
>
> In other words, each time there are at least that many frames available for
> reading
> on the capture device, we should get a POLLIN event when using poll().
> On the other side we should get a POLLOUT event if that many frames can be
> written
> to the playback device.
>
>
> Then, later in my application, I use poll() on the fds of the PCM devices.
> As, according to the ALSA reference, poll events can be "mangeled", I use
> snd_pcm_poll_descriptors_revents() to "demangle" the events:
>
>
> ---------------------------------------------------------------------------------
> if ((ret=snd_pcm_poll_descriptors_revents(device_handle, &poll_fds[i], 1,
> &revents))<0)
> {
>        fprintf(stderr, "could not snd_pcm_poll_descriptors_revents: %s\n",
> snd_strerror(ret));
>        exit(EXIT_FAILURE);
> }
>
> ---------------------------------------------------------------------------------
>
>
>
> After that, each time there was a POLLIN event, I am reading exactly one
> period from the
> capture PCM.
> On the other side, if there was a POLLOUT event, I am writing exactly one
> period to the
> playback PCM.
>
>
> While this works for a small number of periods (which is not always the
> same), I always end up
> with a "Resource temporarily unavailable" error when trying to read one
> period from the capture PCM:
>
>
> ---------------------------------------------------------------------------------
> demangled poll: POLLIN  on capture device
> could not read from capture device: Resource temporarily unavailable
>
> ---------------------------------------------------------------------------------
>
>
> Since a POLLIN event only occurs after at least a full period is available
> for
> reading (as set up by snd_pcm_sw_params_set_avail_min() above)
> and I only read after a POLLIN event occured on the capture device fd,
> I really do not understand why I get the above error.
>
> So why does the above happen ?
> What am I doing wrong ?
>
> If it helps, I pasted the source code here so that you can view it nicely:
> http://pastebin.com/fCicqctq
>
> cheers,
> stefan
>

which sound card are you using ?

The program did not run on my two sound card since you are using 160 frames
and mono

are you using "pulse" device for testing since only pulse device return the
error messages "could not read from capture device: Resource temporarily
unavailable" ?

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-21 16:15 ` Stefan Schoenleitner
  2010-04-21 17:18   ` Jaroslav Kysela
@ 2010-04-22  4:28   ` Raymond Yau
  2010-04-22 10:49     ` Stefan Schoenleitner
  1 sibling, 1 reply; 19+ messages in thread
From: Raymond Yau @ 2010-04-22  4:28 UTC (permalink / raw)
  To: ALSA Development Mailing List

2010/4/22 Stefan Schoenleitner <dev.c0debabe@gmail.com>

> Stefan Schoenleitner wrote:
> > Since a POLLIN event only occurs after at least a full period is
> available for
> > reading (as set up by snd_pcm_sw_params_set_avail_min() above)
> > and I only read after a POLLIN event occured on the capture device fd,
> > I really do not understand why I get the above error.
>
> By using snd_pcm_avail_update() I found out that polling on the PCMs
> *does not work at all*.
>
> Although I verified that avail_min is 160 frames, polling on the
> capture/playback PCMs returns a POLLIN/POLLOUT event even if the number
> of frames for reading/writing *is less than avail_main*.
>
> I also tried snd_pcm_wait() which should also wait until there are at
> least avail_min frames available for reading/writing.
> The result is the same: snd_pcm_avail_update() shows that it returns
> even if there are far less than avail_min frames available for processing.
>
> I suspect that this is a bug in ALSA ?
>
>
> cheers,
> stefan
>


your program expect the driver support 2 periods per buffer but does not
expicitly set the period

8000 Hz , S16_LE and mono

>> I verified that avail_min is 160 frames

is there any specific reason to choose 160 frames ?

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-21 17:18   ` Jaroslav Kysela
@ 2010-04-22 10:09     ` Stefan Schoenleitner
  2010-04-23  4:10       ` Raymond Yau
  2010-04-24  1:32       ` Raymond Yau
  0 siblings, 2 replies; 19+ messages in thread
From: Stefan Schoenleitner @ 2010-04-22 10:09 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel

Jaroslav Kysela wrote:
> On Wed, 21 Apr 2010, Stefan Schoenleitner wrote:
>> I suspect that this is a bug in ALSA ?
> 
> It might be. Could you post snd_pcm_dump() when you read less frames?

Sure, here's the output:

-----------------------------------------------------------------
snd_pcm_avail_update(capture): 11
demangled poll: POLLIN  on capture device
could not read from capture device: Resource temporarily unavailable
ALSA <-> PulseAudio PCM I/O Plugin
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 16
  buffer_size  : 640
  period_size  : 160
  period_time  : 20000
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 160
  period_event : 0
  start_threshold  : 160
  stop_threshold   : 320
  silence_threshold: 0
  silence_size : 0
  boundary     : 5764607523034234880
-----------------------------------------------------------------

As you can see I'm using pulseaudio.
The version I'm using is 1:0.9.14-0ubuntu20 (on ubuntu jaunty).

For testing purposes I increased the period size to 320 so that the
program works on my hardware sound card "hw".
It turned out that the program is working fine there and the poll()
behavior is as it should be.

cheers,
stefan

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-22  2:41 ` Raymond Yau
@ 2010-04-22 10:15   ` Stefan Schoenleitner
  0 siblings, 0 replies; 19+ messages in thread
From: Stefan Schoenleitner @ 2010-04-22 10:15 UTC (permalink / raw)
  To: Raymond Yau; +Cc: ALSA Development Mailing List

Raymond Yau wrote:
> 2010/4/21 Stefan Schoenleitner <dev.c0debabe@gmail.com>
>> If it helps, I pasted the source code here so that you can view it nicely:
>> http://pastebin.com/fCicqctq
>>
> which sound card are you using ?
> 
> The program did not run on my two sound card since you are using 160 frames
> and mono
> 
> are you using "pulse" device for testing since only pulse device return the
> error messages "could not read from capture device: Resource temporarily
> unavailable" ?

Yes, I am using pulseaudio since my hardware sound card (an audigy 2)
does not support the period size I'm using.


The error message above is is from my own program (line 444):

-----------------------------------------------------------------
if ((ret=snd_pcm_readi(capture_device, buffer, 160))<0)
{
	if (ret == -EPIPE)
	{
		fprintf(stderr, "XRUN while reading from capture device: %s\n",
snd_strerror(ret));
		snd_pcm_prepare(capture_device);
		snd_pcm_start(capture_device);
	}
	else
	{
		fprintf(stderr, "could not read from capture device: %s\n",
snd_strerror(ret));
		exit(EXIT_FAILURE);
	}
}
-----------------------------------------------------------------

cheers,
stefan

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-22  4:28   ` Raymond Yau
@ 2010-04-22 10:49     ` Stefan Schoenleitner
  2010-04-23  7:45       ` Raymond Yau
  0 siblings, 1 reply; 19+ messages in thread
From: Stefan Schoenleitner @ 2010-04-22 10:49 UTC (permalink / raw)
  To: Raymond Yau; +Cc: ALSA Development Mailing List

Raymond Yau wrote:
> your program expect the driver support 2 periods per buffer but does not
> expicitly set the period
> 
> 8000 Hz , S16_LE and mono

I am not sure why you think this is the case.

The period size is set at line 170 with snd_pcm_hw_params_set_period_size().

I'm setting up the sampling rate of 8000Hz in setup_pcm() starting at line 111.
I either use snd_pcm_hw_params_set_rate_near() or snd_pcm_hw_params_set_rate(),
depending on whether the PCM supports the exact rate or not.

I set up the audio format SND_PCM_FORMAT_S16_LE at line 76 with
snd_pcm_hw_params_set_format().

And finally, I also set up the number of channels (mono) in line 85 with
snd_pcm_hw_params_set_channels().


Last but not least, snd_pcm_dump() shows that exactly these settings are actively used:

------------------------------------------------------------------------
ALSA <-> PulseAudio PCM I/O Plugin
Its setup is:
  stream       : CAPTURE
  [...]
  format       : S16_LE
  [...]
  channels     : 1
  rate         : 8000
  exact rate   : 8000 (8000/1)
  [...]
  period_size  : 160
  [...]
  avail_min    : 160
------------------------------------------------------------------------

In the above output you can see that the format, number of channels, rate, period size and
avail_min are indeed set to correct values.
 

>>> I verified that avail_min is 160 frames
> 
> is there any specific reason to choose 160 frames ?

Yes there is: 

The audio frames are used for processing by a DSP lateron, which
requires each speech packet (i.e. period) to have exactly 160 frames.
It is also required that the audio frames are in S16_LE format,
they have a sampling rate of 8kHz and they arrive at the
DSP each 20ms (which corresponds to period_time).


As my code will use the atmel-pcm on an embedded target, the above mentioned
constraints should be no problem.

In fact a look at the PCM in the alsa kernel sources (sound/soc/atmel/atmel-pcm.c) reveals:
------------------------------------------------------------------------
static const struct snd_pcm_hardware atmel_pcm_hardware = {
    .info           = SNDRV_PCM_INFO_MMAP |
                  SNDRV_PCM_INFO_MMAP_VALID |
                  SNDRV_PCM_INFO_INTERLEAVED |
                  SNDRV_PCM_INFO_PAUSE,
    .formats        = SNDRV_PCM_FMTBIT_S16_LE,
    .period_bytes_min   = 32,
    .period_bytes_max   = 8192,
    .periods_min        = 2,
    .periods_max        = 1024,
    .buffer_bytes_max   = 32 * 1024,
};
------------------------------------------------------------------------



However, as development on a slow ARM target can be a real pain, I am developing
the code *on a PC* which is why the poll() behavior really is an issue
(and maybe even a bug in alsa but more likely in pulseaudio).

As soon as the code is working, it will be easy to port it the ARM target.

cheers,
stefan

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-22 10:09     ` Stefan Schoenleitner
@ 2010-04-23  4:10       ` Raymond Yau
  2010-04-24  1:32       ` Raymond Yau
  1 sibling, 0 replies; 19+ messages in thread
From: Raymond Yau @ 2010-04-23  4:10 UTC (permalink / raw)
  To: ALSA Development Mailing List

2010/4/22 Stefan Schoenleitner <dev.c0debabe@gmail.com>

> Jaroslav Kysela wrote:
> > On Wed, 21 Apr 2010, Stefan Schoenleitner wrote:
> >> I suspect that this is a bug in ALSA ?
> >
> > It might be. Could you post snd_pcm_dump() when you read less frames?
>
> Sure, here's the output:
>
> -----------------------------------------------------------------
> snd_pcm_avail_update(capture): 11
> demangled poll: POLLIN  on capture device
> could not read from capture device: Resource temporarily unavailable
> ALSA <-> PulseAudio PCM I/O Plugin
> Its setup is:
>  stream       : CAPTURE
>  access       : RW_INTERLEAVED
>  format       : S16_LE
>  subformat    : STD
>  channels     : 1
>  rate         : 8000
>  exact rate   : 8000 (8000/1)
>  msbits       : 16
>  buffer_size  : 640
>  period_size  : 160
>  period_time  : 20000
>  tstamp_mode  : NONE
>  period_step  : 1
>  avail_min    : 160
>  period_event : 0
>  start_threshold  : 160
>  stop_threshold   : 320
>  silence_threshold: 0
>  silence_size : 0
>  boundary     : 5764607523034234880
> -----------------------------------------------------------------
>
> As you can see I'm using pulseaudio.
> The version I'm using is 1:0.9.14-0ubuntu20 (on ubuntu jaunty).
>
> For testing purposes I increased the period size to 320 so that the
> program works on my hardware sound card "hw".
> It turned out that the program is working fine there and the poll()
> behavior is as it should be.
>
> cheers,
> stefan
>
>
you will need to provide the full pulseaudio log if you are using pulseaudio

pulseaudio --kill; pulseaudio -vvvv

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-22 10:49     ` Stefan Schoenleitner
@ 2010-04-23  7:45       ` Raymond Yau
  2010-04-23 11:16         ` Stefan Schoenleitner
  0 siblings, 1 reply; 19+ messages in thread
From: Raymond Yau @ 2010-04-23  7:45 UTC (permalink / raw)
  To: ALSA Development Mailing List

2010/4/22 Stefan Schoenleitner <dev.c0debabe@gmail.com>

> Raymond Yau wrote:
> > your program expect the driver support 2 periods per buffer but does not
> > expicitly set the period
> >
> > 8000 Hz , S16_LE and mono
>
> I am not sure why you think this is the case.
>
> The period size is set at line 170 with
> snd_pcm_hw_params_set_period_size().
>
> I'm setting up the sampling rate of 8000Hz in setup_pcm() starting at line
> 111.
> I either use snd_pcm_hw_params_set_rate_near() or
> snd_pcm_hw_params_set_rate(),
> depending on whether the PCM supports the exact rate or not.
>
> I set up the audio format SND_PCM_FORMAT_S16_LE at line 76 with
> snd_pcm_hw_params_set_format().
>
> And finally, I also set up the number of channels (mono) in line 85 with
> snd_pcm_hw_params_set_channels().
>
>
> Last but not least, snd_pcm_dump() shows that exactly these settings are
> actively used:
>
> ------------------------------------------------------------------------
> ALSA <-> PulseAudio PCM I/O Plugin
> Its setup is:
>  stream       : CAPTURE
>   [...]
>  format       : S16_LE
>  [...]
>   channels     : 1
>  rate         : 8000
>  exact rate   : 8000 (8000/1)
>   [...]
>  period_size  : 160
>  [...]
>  avail_min    : 160
> ------------------------------------------------------------------------
>
> In the above output you can see that the format, number of channels, rate,
> period size and
> avail_min are indeed set to correct values.
>


you output did not show the values of buffer size

PCM format is signed, linear, LE with 16 bits
PCM rate 1 - 192000 Hz
PCM period size: 64 - 699051
PCM buffer size: 480 - 163840
calculated buffer size: 640
ALSA <-> PulseAudio PCM I/O Plugin
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 16
  buffer_size  : 640
  period_size  : 160
  period_time  : 20000
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 160
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 640
  silence_threshold: 0
  silence_size : 0
  boundary     : 1342177280
avail min: 160
start threshold: 160 frames
stop threshold: 320 frames
PCM format is signed, linear, LE with 16 bits
PCM rate 1 - 192000 Hz
PCM period size: 64 - 699051
PCM buffer size: 480 - 163840
calculated buffer size: 640
ALSA <-> PulseAudio PCM I/O Plugin
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 16
  buffer_size  : 640
  period_size  : 160
  period_time  : 20000
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 160
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 640
  silence_threshold: 0
  silence_size : 0
  boundary     : 1342177280
avail min: 160
start threshold: 160 frames
stop threshold: 320 frames
capture fds: 1, playback fds: 1
capture poll fd: 3, playback poll fd: 8
capture struct: fd: 3, events: POLLIN POLLERR , revents: 0
playback struct: fd: 8, events: POLLIN POLLERR , revents: 0
demangled poll:  on capture device
demangled poll: POLLOUT  on playback device
wrote 160 frames
demangled poll:  on capture device
demangled poll: POLLOUT  on playback device
wrote 160 frames
demangled poll:  on capture device
demangled poll: POLLOUT  on playback device
wrote 160 frames
demangled poll:  on capture device
demangled poll: POLLOUT  on playback device
wrote 160 frames
demangled poll: POLLIN  on capture device
read 160 frames
hexdump(): 320 bytes
0000    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0010    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0020    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030    00 00 02 00 04 00 ff ff ff ff fb ff f8 ff f9 ff
0040    f9 ff fe ff fc ff f9 ff f5 ff f8 ff 02 00 fe ff
0050    f7 ff ed ff f4 ff 01 00 fe ff ff ff f9 ff f4 ff
0060    f9 ff f6 ff f9 ff fb ff f6 ff fa ff fa ff fe ff
0070    00 00 fd ff fe ff fe ff fd ff fb ff fb ff fc ff
0080    fc ff fa ff fa ff f8 ff fd ff fe ff fa ff 00 00
0090    fa ff f6 ff fc ff fa ff fe ff 00 00 ff ff 00 00
00a0    fe ff fd ff fe ff fe ff 00 00 ff ff 01 00 fd ff
00b0    fb ff fd ff f8 ff fb ff 00 00 03 00 01 00 01 00
00c0    00 00 fa ff fb ff fe ff fb ff fc ff ff ff 00 00
00d0    04 00 05 00 02 00 01 00 fe ff 00 00 03 00 02 00
00e0    01 00 00 00 01 00 01 00 fe ff fc ff fc ff fc ff
00f0    fd ff fd ff 00 00 01 00 02 00 03 00 01 00 05 00
0100    fd ff f8 ff fb ff f8 ff fb ff fc ff f8 ff fd ff
0110    fd ff fe ff 02 00 01 00 00 00 00 00 fd ff 02 00
0120    03 00 01 00 ff ff fb ff 02 00 01 00 ff ff 04 00
0130    04 00 03 00 01 00 02 00 09 00 0f 00 0d 00 0c 00

demangled poll:  on playback device
demangled poll:  on capture device
demangled poll: POLLOUT  on playback device
wrote 160 frames
demangled poll: POLLIN  on capture device
read 160 frames
hexdump(): 320 bytes
0000    0a 00 07 00 06 00 07 00 0d 00 08 00 05 00 05 00
0010    05 00 07 00 09 00 0b 00 07 00 04 00 03 00 03 00
0020    02 00 01 00 07 00 0a 00 0a 00 06 00 00 00 fc ff
0030    fe ff 05 00 05 00 08 00 0a 00 05 00 05 00 06 00
0040    06 00 08 00 06 00 05 00 03 00 00 00 02 00 02 00
0050    fb ff f7 ff fa ff ff ff ff ff 00 00 fd ff f7 ff
0060    f5 ff f9 ff fb ff ff ff 01 00 03 00 01 00 fe ff
0070    fe ff ff ff 00 00 04 00 02 00 f7 ff fa ff ff ff
0080    02 00 04 00 01 00 04 00 07 00 00 00 fc ff ff ff
0090    fc ff fb ff f9 ff fd ff ff ff ff ff 03 00 fe ff
00a0    f7 ff f7 ff f7 ff f6 ff f8 ff f7 ff f7 ff f8 ff
00b0    f6 ff fe ff fe ff fc ff fc ff fa ff fc ff fc ff
00c0    fb ff f7 ff ff ff 00 00 01 00 05 00 fb ff f8 ff
00d0    f2 ff f7 ff fa ff fa ff fd ff f9 ff f8 ff f9 ff
00e0    fe ff 00 00 01 00 01 00 ff ff fd ff ff ff 04 00
00f0    00 00 fb ff f7 ff f4 ff fa ff fe ff 03 00 01 00
0100    00 00 ff ff fc ff 01 00 03 00 fe ff f9 ff f8 ff
0110    fa ff fd ff 03 00 03 00 02 00 fe ff f9 ff fd ff
0120    00 00 fa ff f7 ff fd ff fe ff fd ff 01 00 00 00
0130    fa ff f8 ff f7 ff f4 ff f6 ff fa ff f9 ff fa ff

demangled poll:  on playback device
demangled poll:  on capture device
demangled poll: POLLOUT  on playback device
wrote 160 frames
demangled poll: POLLIN  on capture device
read 160 frames
hexdump(): 320 bytes
0000    fd ff ff ff 03 00 01 00 fb ff fb ff fd ff fd ff
0010    f9 ff fb ff fd ff ff ff 02 00 00 00 fe ff fb ff
0020    fb ff fc ff 00 00 01 00 fe ff fe ff ff ff ff ff
0030    00 00 02 00 ff ff ff ff 00 00 fc ff fe ff ff ff
0040    fe ff fe ff fd ff ff ff fe ff ff ff 00 00 01 00
0050    04 00 06 00 02 00 fd ff 03 00 02 00 02 00 01 00
0060    fd ff fd ff ff ff 03 00 02 00 05 00 04 00 01 00
0070    00 00 fc ff 00 00 05 00 06 00 05 00 03 00 00 00
0080    fd ff 01 00 04 00 06 00 06 00 01 00 03 00 fd ff
0090    fa ff 05 00 06 00 04 00 00 00 fd ff fe ff fa ff
00a0    f8 ff 01 00 0a 00 08 00 08 00 05 00 ff ff fe ff
00b0    01 00 05 00 0a 00 09 00 03 00 01 00 01 00 04 00
00c0    01 00 04 00 07 00 06 00 09 00 06 00 03 00 00 00
00d0    fd ff fc ff 01 00 04 00 02 00 06 00 07 00 06 00
00e0    05 00 03 00 02 00 06 00 0a 00 09 00 02 00 fd ff
00f0    fb ff fa ff fd ff ff ff 01 00 ff ff f9 ff f5 ff
0100    f3 ff f7 ff fb ff f7 ff f6 ff fc ff fb ff fd ff
0110    fd ff f6 ff f7 ff fc ff f9 ff fb ff fc ff f5 ff
0120    f6 ff f7 ff f3 ff f6 ff f8 ff f7 ff f6 ff f9 ff
0130    fc ff f6 ff f4 ff f6 ff f4 ff fa ff f8 ff f2 ff

demangled poll:  on playback device
demangled poll:  on capture device
demangled poll: POLLOUT  on playback device
wrote 160 frames
demangled poll: POLLIN  on capture device
could not read from capture device: Resource temporarily unavailable



>
> cheers,
> stefan
>

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-23  7:45       ` Raymond Yau
@ 2010-04-23 11:16         ` Stefan Schoenleitner
  0 siblings, 0 replies; 19+ messages in thread
From: Stefan Schoenleitner @ 2010-04-23 11:16 UTC (permalink / raw)
  To: Raymond Yau; +Cc: ALSA Development Mailing List

Hi,

Raymond Yau wrote:
> you output did not show the values of buffer size
> [...]
> 00d0    fd ff fc ff 01 00 04 00 02 00 06 00 07 00 06 00
> 00e0    05 00 03 00 02 00 06 00 0a 00 09 00 02 00 fd ff
> 00f0    fb ff fa ff fd ff ff ff 01 00 ff ff f9 ff f5 ff
> 0100    f3 ff f7 ff fb ff f7 ff f6 ff fc ff fb ff fd ff
> 0110    fd ff f6 ff f7 ff fc ff f9 ff fb ff fc ff f5 ff
> 0120    f6 ff f7 ff f3 ff f6 ff f8 ff f7 ff f6 ff f9 ff
> 0130    fc ff f6 ff f4 ff f6 ff f4 ff fa ff f8 ff f2 ff
> 
> demangled poll:  on playback device
> demangled poll:  on capture device
> demangled poll: POLLOUT  on playback device
> wrote 160 frames
> demangled poll: POLLIN  on capture device
> could not read from capture device: Resource temporarily unavailable


thanks for posting the full output.
I added a call to snd_pcm_avail_update() in the code which shows how
many frames are available after poll() returns.

As you can see in the output below, although avail_min is set to 160
frames, the POLLIN event on the capture PCM is returned after only 11
frames are available for reading:

------------------------------------------------------------------------------
snd_pcm_avail_update(playback): 0
demangled poll:  on playback device
snd_pcm_avail_update(capture): 171
demangled poll: POLLIN  on capture device
read 160 frames
hexdump(): 320 bytes
0000	fc ff fc ff fc ff fc ff fc ff fc ff fc ff fe ff
0010	fc ff fd ff fb ff fc ff fc ff fc ff fd ff fc ff
0020	fc ff fc ff fd ff fc ff fc ff fc ff fd ff fd ff
0030	fc ff fc ff fc ff fc ff fc ff fb ff fc ff fc ff
0040	fd ff fc ff fc ff fc ff fc ff fc ff fd ff fc ff
0050	fd ff fc ff fc ff fc ff fd ff fc ff fc ff fa ff
0060	fc ff fc ff fc ff fb ff fc ff fd ff fc ff fd ff
0070	fc ff fc ff fd ff fc ff fc ff fc ff fc ff fc ff
0080	fb ff fd ff fc ff fc ff fc ff fc ff fc ff fc ff
0090	fb ff fd ff fc ff fd ff fb ff fd ff fc ff fc ff
00a0	fd ff fd ff fc ff fc ff fc ff fc ff fc ff fc ff
00b0	fc ff fc ff fb ff fc ff fc ff fc ff fc ff fd ff
00c0	fc ff fc ff fd ff fc ff fc ff fc ff fc ff fc ff
00d0	fc ff fc ff fc ff fc ff fc ff fd ff fc ff fc ff
00e0	fd ff fc ff fc ff fc ff fd ff fd ff fc ff fc ff
00f0	fc ff fb ff fc ff fd ff fd ff fc ff fc ff fc ff
0100	fc ff fc ff fc ff fc ff fc ff fc ff fc ff fc ff
0110	fc ff fc ff fc ff fc ff fc ff fc ff fc ff fc ff
0120	fc ff fc ff fc ff fc ff fd ff fc ff fc ff fc ff
0130	fc ff fc ff fc ff fc ff fc ff fc ff fc ff fc ff

snd_pcm_avail_update(playback): 0
demangled poll:  on playback device
snd_pcm_avail_update(capture): 11
demangled poll: POLLIN  on capture device
could not read from capture device: Resource temporarily unavailable
ALSA <-> PulseAudio PCM I/O Plugin
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 16
  buffer_size  : 640
  period_size  : 160
  period_time  : 20000
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 160
  period_event : 0
  start_threshold  : 160
  stop_threshold   : 320
  silence_threshold: 0
  silence_size : 0
  boundary     : 5764607523034234880
------------------------------------------------------------------------------

In one of your previous posts you also said that the pulseaudio log
would be helpful.
You can see it below.
In order to keep it brief, I included only the logs between pulseaudio
startup and the end of the audio application.

------------------------------------------------------------------------------
$ pulseaudio -vvv
I: caps.c: Limited capabilities successfully to CAP_SYS_NICE.
I: caps.c: Dropping root privileges.
I: caps.c: Limited capabilities successfully to CAP_SYS_NICE.
D: main.c: Started as real root: no, suid root: yes
I: main.c: We're in the group 'pulse-rt', allowing high-priority scheduling.
I: main.c: setrlimit(RLIMIT_NICE, (31, 31)) failed: Operation not permitted
I: main.c: setrlimit(RLIMIT_RTPRIO, (9, 9)) failed: Operation not permitted
I: core-util.c: Successfully gained nice level -11.
D: main.c: Can realtime: yes, can high-priority: yes
I: main.c: Giving up CAP_NICE
D: main.c: Can realtime: no, can high-priority: no
I: main.c: This is PulseAudio 0.9.14
D: main.c: Compilation host: x86_64-pc-linux-gnu
D: main.c: Compilation CFLAGS: -g -O2 -g -Wall -O3 -Wall -W -Wextra
-pedantic -pipe -Wno-long-long -Wvla -Wno-overlength-strings
-Wconversion -Wundef -Wformat -Wlogical-op -Wpacked -Wformat-security
-Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition
-Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations
-Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls
-Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wcast-align
-Wwrite-strings -Wno-unused-parameter -ffast-math
D: main.c: Running on host: Linux x86_64 2.6.28-18-generic #59-Ubuntu
SMP Thu Jan 28 01:40:19 UTC 2010
I: main.c: Page size is 4096 bytes
D: main.c: Compiled with Valgrind support: no
D: main.c: Running in valgrind mode: no
D: main.c: Optimized build: yes
I: main.c: Machine ID is d05a505180ca4c5382d620fc498da356.
I: main.c: Using runtime directory
/home/mne/.pulse/d05a505180ca4c5382d620fc498da356:runtime.
I: main.c: Using state directory /home/mne/.pulse.
I: main.c: Running in system mode: no
I: main.c: Fresh high-resolution timers available! Bon appetit!
D: memblock.c: Using shared memory pool with 1024 slots of size 64.0 KiB
each, total size is 64.0 MiB, maximum usable slot size is 65472
D: cli-command.c: Checking for existance of
'/usr/lib/pulse-0.9/modules/module-gconf.so': success
D: module-gconf.c: Loading module 'module-combine' with args '' due to
GConf configuration.
I: sink.c: Created sink 0 "combined" with sample spec s16le 2ch 44100Hz
and channel map front-left,front-right
I: source.c: Created source 0 "combined.monitor" with sample spec s16le
2ch 44100Hz and channel map front-left,front-right
D: module-combine.c: Thread starting up
D: rtpoll.c: Acquired POSIX realtime signal SIGRTMIN+29
I: module.c: Loaded "module-combine" (index: #0; argument: "").
I: module.c: Loaded "module-gconf" (index: #1; argument: "").
D: module-suspend-on-idle.c: Sink combined becomes idle.
D: module-suspend-on-idle.c: Source combined.monitor becomes idle.
I: module.c: Loaded "module-suspend-on-idle" (index: #2; argument: "").
I: module-device-restore.c: Sucessfully opened database file
'/home/mne/.pulse/d05a505180ca4c5382d620fc498da356:device-volumes.x86_64-pc-linux-gnu.gdbm'.
I: module.c: Loaded "module-device-restore" (index: #3; argument: "").
I: module-stream-restore.c: Sucessfully opened database file
'/home/mne/.pulse/d05a505180ca4c5382d620fc498da356:stream-volumes.x86_64-pc-linux-gnu.gdbm'.
I: module.c: Loaded "module-stream-restore" (index: #4; argument: "").
D: cli-command.c: Checking for existance of
'/usr/lib/pulse-0.9/modules/module-hal-detect.so': success
I: module-hal-detect.c: Trying capability alsa
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/computer_alsa_timer
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/computer_alsa_sequencer
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_playback_4
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_midi_3
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_playback_2
D: module-hal-detect.c: Loading module-alsa-source with arguments
'device_id=0
source_name=alsa_input.pci_1102_4_sound_card_0_alsa_capture_0 tsched=0'
D: alsa-util.c: Trying front:0 with SND_PCM_NO_AUTO_FORMAT ...
I: module-alsa-source.c: Successfully opened device front:0.
I: module-alsa-source.c: Successfully enabled mmap() mode.
I: (alsa-lib)control.c: Invalid CTL front:0
I: alsa-util.c: Unable to attach to mixer front:0: No such file or directory
I: alsa-util.c: Successfully attached to mixer 'hw:0'
I: alsa-util.c: Cannot find mixer control "Capture" or mixer control is
no combination of switch/volume.
I: alsa-util.c: Using mixer control "Mic".
I: module-device-restore.c: Restoring volume for source
alsa_input.pci_1102_4_sound_card_0_alsa_capture_0.
I: module-device-restore.c: Restoring mute state for source
alsa_input.pci_1102_4_sound_card_0_alsa_capture_0.
I: source.c: Created source 1
"alsa_input.pci_1102_4_sound_card_0_alsa_capture_0" with sample spec
s16le 2ch 44100Hz and channel map front-left,front-right
I: module-alsa-source.c: Using 2 fragments of size 7168 bytes, buffer
time is 81.27ms
D: module-alsa-source.c: hwbuf_unused=0
D: module-alsa-source.c: setting avail_min=1
I: module-alsa-source.c: Volume ranges from 0 to 31.
I: module-alsa-source.c: Volume ranges from -34.50 dB to 12.00 dB.
I: alsa-util.c: ALSA device lacks independant volume controls for each
channel.
I: module-alsa-source.c: Using hardware volume control. Hardware dB
scale supported.
D: alsa-util.c: snd_pcm_dump():
D: alsa-util.c: Hooks PCM
D: alsa-util.c: Its setup is:
D: alsa-util.c:   stream       : CAPTURE
D: alsa-util.c:   access       : MMAP_INTERLEAVED
D: alsa-util.c:   format       : S16_LE
D: alsa-util.c:   subformat    : STD
D: alsa-util.c:   channels     : 2
D: alsa-util.c:   rate         : 44100
D: alsa-util.c:   exact rate   : 44100 (44100/1)
D: alsa-util.c:   msbits       : 16
D: alsa-util.c:   buffer_size  : 3584
D: alsa-util.c:   period_size  : 1792
D: alsa-util.c:   period_time  : 40634
D: alsa-util.c:   tstamp_mode  : ENABLE
D: alsa-util.c:   period_step  : 1
D: alsa-util.c:   avail_min    : 1792
D: alsa-util.c:   period_event : 0
D: alsa-util.c:   start_threshold  : -1
D: alsa-util.c:   stop_threshold   : 8070450532247928832
D: alsa-util.c:   silence_threshold: 0
D: alsa-util.c:   silence_size : 0
D: alsa-util.c:   boundary     : 8070450532247928832
D: alsa-util.c: Slave: Hardware PCM card 0 'Audigy 2 [SB0240]' device 0
subdevice 0
D: alsa-util.c: Its setup is:
D: alsa-util.c:   stream       : CAPTURE
D: alsa-util.c:   access       : MMAP_INTERLEAVED
D: alsa-util.c:   format       : S16_LE
D: alsa-util.c:   subformat    : STD
D: alsa-util.c:   channels     : 2
D: alsa-util.c:   rate         : 44100
D: alsa-util.c:   exact rate   : 44100 (44100/1)
D: alsa-util.c:   msbits       : 16
D: alsa-util.c:   buffer_size  : 3584
D: alsa-util.c:   period_size  : 1792
D: alsa-util.c:   period_time  : 40634
D: alsa-util.c:   tstamp_mode  : ENABLE
D: alsa-util.c:   period_step  : 1
D: alsa-util.c:   avail_min    : 1792
D: alsa-util.c:   period_event : 0
D: alsa-util.c:   start_threshold  : -1
D: alsa-util.c:   stop_threshold   : 807045053224
D: module-alsa-source.c: Thread starting up
D: module-alsa-source.c: Requested volume: 0: 100% 1: 100%
D: rtpoll.c: Acquired POSIX realtime signal SIGRTMIN+28
D: module-alsa-source.c: Got hardware volume: 0: 100% 1: 100%
D: module-alsa-source.c: Calculated software volume: 0: 100% 1: 100%
D: module-suspend-on-idle.c: Source
alsa_input.pci_1102_4_sound_card_0_alsa_capture_0 becomes idle.
I: module.c: Loaded "module-alsa-source" (index: #5; argument:
"device_id=0
source_name=alsa_input.pci_1102_4_sound_card_0_alsa_capture_0 tsched=0").
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_capture_4
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_playback_3
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_capture_2
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_midi_2
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_capture_1
D: module-hal-detect.c: Loading module-alsa-sink with arguments
'device_id=0
sink_name=alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 tsched=0'
D: alsa-util.c: Trying front:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying front:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:front:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:front:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
I: alsa-util.c: PCM device plug:front:0 refused our hw parameters:
Device or resource busy
D: alsa-util.c: Trying surround40:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying surround40:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround40:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround40:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
I: alsa-util.c: PCM device plug:surround40:0 refused our hw parameters:
Device or resource busy
D: alsa-util.c: Trying surround41:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying surround41:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround41:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround41:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
I: alsa-util.c: PCM device plug:surround41:0 refused our hw parameters:
Device or resource busy
D: alsa-util.c: Trying surround50:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying surround50:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround50:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround50:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
I: alsa-util.c: PCM device plug:surround50:0 refused our hw parameters:
Device or resource busy
D: alsa-util.c: Trying surround51:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying surround51:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround51:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround51:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
I: alsa-util.c: PCM device plug:surround51:0 refused our hw parameters:
Device or resource busy
D: alsa-util.c: Trying surround71:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying surround71:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround71:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround71:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
I: alsa-util.c: PCM device plug:surround71:0 refused our hw parameters:
Device or resource busy
D: alsa-util.c: Trying hw:0 as last resort...
D: alsa-util.c: Trying hw:0 with SND_PCM_NO_AUTO_FORMAT ...
I: module-alsa-sink.c: Successfully opened device hw:0.
I: module-alsa-sink.c: Successfully enabled mmap() mode.
I: alsa-util.c: Successfully attached to mixer 'hw:0'
I: alsa-util.c: Cannot find mixer control "Master" or mixer control is
no combination of switch/volume.
W: alsa-util.c: Cannot find fallback mixer control "PCM" or mixer
control is no combination of switch/volume.
I: alsa-util.c: Using mixer control "PCM".
I: module-device-restore.c: Restoring volume for sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0.
I: module-device-restore.c: Restoring mute state for sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0.
I: sink.c: Created sink 1
"alsa_output.pci_1102_4_sound_card_0_alsa_playback_0" with sample spec
s16le 2ch 44100Hz and channel map front-left,front-right
I: module-device-restore.c: Restoring volume for source
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0.monitor.
I: module-device-restore.c: Restoring mute state for source
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0.monitor.
I: source.c: Created source 2
"alsa_output.pci_1102_4_sound_card_0_alsa_playback_0.monitor" with
sample spec s16le 2ch 44100Hz and channel map front-left,front-right
I: module-alsa-sink.c: Using 8 fragments of size 1764 bytes, buffer time
is 80.00ms
D: module-alsa-sink.c: hwbuf_unused=0
D: module-alsa-sink.c: setting avail_min=1
I: module-alsa-sink.c: Volume ranges from 0 to 100.
I: module-alsa-sink.c: Volume ranges from -40.00 dB to 0.00 dB.
I: alsa-util.c: ALSA device lacks independant volume controls for each
channel.
I: module-alsa-sink.c: Using hardware volume control. Hardware dB scale
supported.
I: module-alsa-sink.c: Using software mute control.
D: alsa-util.c: snd_pcm_dump():
D: alsa-util.c: Hardware PCM card 0 'Audigy 2 [SB0240]' device 0 subdevice 0
D: alsa-util.c: Its setup is:
D: alsa-util.c:   stream       : PLAYBACK
D: alsa-util.c:   access       : MMAP_INTERLEAVED
D: alsa-util.c:   format       : S16_LE
D: alsa-util.c:   subformat    : STD
D: alsa-util.c:   channels     : 2
D: alsa-util.c:   rate         : 44100
D: alsa-util.c:   exact rate   : 44100 (44100/1)
D: alsa-util.c:   msbits       : 16
D: alsa-util.c:   buffer_size  : 3528
D: alsa-util.c:   period_size  : 441
D: alsa-util.c:   period_time  : 10000
D: alsa-util.c:   tstamp_mode  : ENABLE
D: alsa-util.c:   period_step  : 1
D: alsa-util.c:   avail_min    : 441
D: alsa-util.c:   period_event : 0
D: alsa-util.c:   start_threshold  : -1
D: alsa-util.c:   stop_threshold   : 7944349742681554944
D: alsa-util.c:   silence_threshold: 0
D: alsa-util.c:   silence_size : 0
D: alsa-util.c:   boundary     : 7944349742681554944
D: module-alsa-sink.c: Thread starting up
D: module-alsa-sink.c: Requested volume: 0:  77% 1:  77%
D: rtpoll.c: Acquired POSIX realtime signal SIGRTMIN+27
D: module-alsa-sink.c: Got hardware volume: 0:  77% 1:  77%
D: module-alsa-sink.c: Calculated software volume: 0: 100% 1: 100%
I: module-alsa-sink.c: Starting playback.
D: module-suspend-on-idle.c: Source
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0.monitor becomes idle.
D: module-suspend-on-idle.c: Sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 becomes idle.
I: module-combine.c: Configuring new sink:
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0
D: memblockq.c: memblockq requested: maxlength=16777216,
tlength=16777216, base=4, prebuf=1, minreq=0 maxrewind=0
D: memblockq.c: memblockq sanitized: maxlength=16777216,
tlength=16777216, base=4, prebuf=4, minreq=4 maxrewind=0
I: module-stream-restore.c: Not restore device for stream
sink-input-by-media-role:filter, because already set.
I: module-stream-restore.c: Restoring volume for sink input
sink-input-by-media-role:filter.
I: module-stream-restore.c: Restoring mute state for sink input
sink-input-by-media-role:filter.
D: module-suspend-on-idle.c: Sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 becomes busy.
I: resampler.c: Using resampler 'trivial'
I: resampler.c: Using s16le as working format.
D: memblockq.c: memblockq requested: maxlength=33554432, tlength=0,
base=4, prebuf=0, minreq=1 maxrewind=0
D: memblockq.c: memblockq sanitized: maxlength=33554432,
tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
I: sink-input.c: Created input 0 "Simultaneous output on Audigy 2
[SB0240] - ADC Capture/Standard PCM Playback" on
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 with sample spec
s16le 2ch 44100Hz and channel map front-left,front-right
D: module-alsa-sink.c: hwbuf_unused=0
D: module-alsa-sink.c: setting avail_min=1
I: module.c: Loaded "module-alsa-sink" (index: #6; argument:
"device_id=0
sink_name=alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 tsched=0").
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_midi_1
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_midi_0
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_hw_specific_2
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_hw_specific_0
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_control__1
I: module-hal-detect.c: Loaded 2 modules.
I: module.c: Loaded "module-hal-detect" (index: #7; argument: "tsched=0").
D: cli-command.c: Checking for existance of
'/usr/lib/pulse-0.9/modules/module-esound-protocol-unix.so': success
I: module.c: Loaded "module-esound-protocol-unix" (index: #8; argument: "").
I: module.c: Loaded "module-native-protocol-unix" (index: #9; argument: "").
I: module-default-device-restore.c: Restored default sink
'alsa_output.pci_1102_4_sound_card_0_alsa_playback_0'.
D: core-subscribe.c: Dropped redundant event due to change event.
I: module-default-device-restore.c: Restored default source
'alsa_input.pci_1102_4_sound_card_0_alsa_capture_0'.
I: module.c: Loaded "module-default-device-restore" (index: #10;
argument: "").
I: module.c: Loaded "module-rescue-streams" (index: #11; argument: "").
I: module.c: Loaded "module-always-sink" (index: #12; argument: "").
I: client.c: Created 0 "ConsoleKit Session
/org/freedesktop/ConsoleKit/Session3"
D: module-console-kit.c: Added new session
/org/freedesktop/ConsoleKit/Session3
I: module.c: Loaded "module-console-kit" (index: #13; argument: "").
I: module.c: Loaded "module-position-event-sounds" (index: #14;
argument: "").
I: main.c: Daemon startup complete.
D: module-hal-detect.c: dbus: interface=org.freedesktop.DBus,
path=/org/freedesktop/DBus, member=NameAcquired
D: module-console-kit.c: dbus: interface=org.freedesktop.DBus,
path=/org/freedesktop/DBus, member=NameAcquired
D: module-hal-detect.c: dbus: interface=org.freedesktop.ConsoleKit.Seat,
path=/org/freedesktop/ConsoleKit/Seat1, member=SessionAdded
D: module-console-kit.c: dbus:
interface=org.freedesktop.ConsoleKit.Seat,
path=/org/freedesktop/ConsoleKit/Seat1, member=SessionAdded
D: module-hal-detect.c: dbus: interface=org.freedesktop.ConsoleKit.Seat,
path=/org/freedesktop/ConsoleKit/Seat1, member=SessionRemoved
D: module-console-kit.c: dbus:
interface=org.freedesktop.ConsoleKit.Seat,
path=/org/freedesktop/ConsoleKit/Seat1, member=SessionRemoved
^CI: main.c: Got signal SIGINT.
I: main.c: Exiting.
I: main.c: Daemon shutdown initiated.
I: module.c: Unloading "module-combine" (index: #0).
D: module-alsa-sink.c: hwbuf_unused=0
D: module-alsa-sink.c: setting avail_min=1
D: module-suspend-on-idle.c: Sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 becomes idle.
D: module-suspend-on-idle.c: Sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 becomes idle.
I: sink-input.c: Freeing input 0 "Simultaneous output on Audigy 2
[SB0240] - ADC Capture/Standard PCM Playback"
D: module-rescue-streams.c: No sink inputs to move away.
D: module-rescue-streams.c: No source outputs to move away.
D: core-subscribe.c: Dropped redundant event due to remove event.
D: core-subscribe.c: Dropped redundant event due to remove event.
D: module-combine.c: Thread shutting down
I: sink.c: Freeing sink 0 "combined"
I: source.c: Freeing source 0 "combined.monitor"
I: module.c: Unloaded "module-combine" (index: #0).
I: module.c: Unloading "module-gconf" (index: #1).
D: module-gconf.c: Unloading module #0
I: module.c: Unloaded "module-gconf" (index: #1).
I: module.c: Unloading "module-suspend-on-idle" (index: #2).
I: module.c: Unloaded "module-suspend-on-idle" (index: #2).
I: module.c: Unloading "module-device-restore" (index: #3).
I: module.c: Unloaded "module-device-restore" (index: #3).
I: module.c: Unloading "module-stream-restore" (index: #4).
I: module.c: Unloaded "module-stream-restore" (index: #4).
I: module.c: Unloading "module-alsa-source" (index: #5).
D: module-rescue-streams.c: No source outputs to move away.
D: module-alsa-source.c: Thread shutting down
I: source.c: Freeing source 1
"alsa_input.pci_1102_4_sound_card_0_alsa_capture_0"
I: module.c: Unloaded "module-alsa-source" (index: #5).
I: module.c: Unloading "module-alsa-sink" (index: #6).
D: module-always-sink.c: Autoloading null-sink as no other sinks detected.
I: sink.c: Created sink 2 "auto_null" with sample spec s16le 2ch 44100Hz
and channel map front-left,front-right
I: source.c: Created source 3 "auto_null.monitor" with sample spec s16le
2ch 44100Hz and channel map front-left,front-right
D: module-null-sink.c: Thread starting up
D: rtpoll.c: Acquired POSIX realtime signal SIGRTMIN+29
I: module.c: Loaded "module-null-sink" (index: #15; argument:
"sink_name=auto_null").
D: module-rescue-streams.c: No sink inputs to move away.
D: module-rescue-streams.c: No source outputs to move away.
D: module-alsa-sink.c: Thread shutting down
I: sink.c: Freeing sink 1
"alsa_output.pci_1102_4_sound_card_0_alsa_playback_0"
I: source.c: Freeing source 2
"alsa_output.pci_1102_4_sound_card_0_alsa_playback_0.monitor"
I: module.c: Unloaded "module-alsa-sink" (index: #6).
I: module.c: Unloading "module-hal-detect" (index: #7).
I: module.c: Unloaded "module-hal-detect" (index: #7).
I: module.c: Unloading "module-esound-protocol-unix" (index: #8).
I: module.c: Unloaded "module-esound-protocol-unix" (index: #8).
I: module.c: Unloading "module-native-protocol-unix" (index: #9).
I: module.c: Unloaded "module-native-protocol-unix" (index: #9).
I: module.c: Unloading "module-default-device-restore" (index: #10).
I: module.c: Unloaded "module-default-device-restore" (index: #10).
I: module.c: Unloading "module-rescue-streams" (index: #11).
I: module.c: Unloaded "module-rescue-streams" (index: #11).
I: module.c: Unloading "module-always-sink" (index: #12).
I: module.c: Unloaded "module-always-sink" (index: #12).
I: module.c: Unloading "module-console-kit" (index: #13).
D: module-console-kit.c: Removing session
/org/freedesktop/ConsoleKit/Session3
I: client.c: Freed 0 "ConsoleKit Session
/org/freedesktop/ConsoleKit/Session3"
I: module.c: Unloaded "module-console-kit" (index: #13).
I: module.c: Unloading "module-position-event-sounds" (index: #14).
I: module.c: Unloaded "module-position-event-sounds" (index: #14).
I: module.c: Unloading "module-null-sink" (index: #15).
D: core-subscribe.c: Dropped redundant event due to remove event.
D: core-subscribe.c: Dropped redundant event due to remove event.
D: module-null-sink.c: Thread shutting down
I: sink.c: Freeing sink 2 "auto_null"
I: source.c: Freeing source 3 "auto_null.monitor"
I: module.c: Unloaded "module-null-sink" (index: #15).
D: core-subscribe.c: Dropped redundant event due to remove event.
I: main.c: Daemon terminated.
mne@nanoflex:~$ pulseaudio -vvv
I: caps.c: Limited capabilities successfully to CAP_SYS_NICE.
I: caps.c: Dropping root privileges.
I: caps.c: Limited capabilities successfully to CAP_SYS_NICE.
D: main.c: Started as real root: no, suid root: yes
I: main.c: We're in the group 'pulse-rt', allowing high-priority scheduling.
I: main.c: setrlimit(RLIMIT_NICE, (31, 31)) failed: Operation not permitted
I: main.c: setrlimit(RLIMIT_RTPRIO, (9, 9)) failed: Operation not permitted
I: core-util.c: Successfully gained nice level -11.
D: main.c: Can realtime: yes, can high-priority: yes
I: main.c: Giving up CAP_NICE
D: main.c: Can realtime: no, can high-priority: no
I: main.c: This is PulseAudio 0.9.14
D: main.c: Compilation host: x86_64-pc-linux-gnu
D: main.c: Compilation CFLAGS: -g -O2 -g -Wall -O3 -Wall -W -Wextra
-pedantic -pipe -Wno-long-long -Wvla -Wno-overlength-strings
-Wconversion -Wundef -Wformat -Wlogical-op -Wpacked -Wformat-security
-Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition
-Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations
-Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls
-Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wcast-align
-Wwrite-strings -Wno-unused-parameter -ffast-math
D: main.c: Running on host: Linux x86_64 2.6.28-18-generic #59-Ubuntu
SMP Thu Jan 28 01:40:19 UTC 2010
I: main.c: Page size is 4096 bytes
D: main.c: Compiled with Valgrind support: no
D: main.c: Running in valgrind mode: no
D: main.c: Optimized build: yes
I: main.c: Machine ID is d05a505180ca4c5382d620fc498da356.
I: main.c: Using runtime directory
/home/mne/.pulse/d05a505180ca4c5382d620fc498da356:runtime.
I: main.c: Using state directory /home/mne/.pulse.
I: main.c: Running in system mode: no
I: main.c: Fresh high-resolution timers available! Bon appetit!
D: memblock.c: Using shared memory pool with 1024 slots of size 64.0 KiB
each, total size is 64.0 MiB, maximum usable slot size is 65472
D: cli-command.c: Checking for existance of
'/usr/lib/pulse-0.9/modules/module-gconf.so': success
D: module-gconf.c: Loading module 'module-combine' with args '' due to
GConf configuration.
I: sink.c: Created sink 0 "combined" with sample spec s16le 2ch 44100Hz
and channel map front-left,front-right
I: source.c: Created source 0 "combined.monitor" with sample spec s16le
2ch 44100Hz and channel map front-left,front-right
D: module-combine.c: Thread starting up
D: rtpoll.c: Acquired POSIX realtime signal SIGRTMIN+29
I: module.c: Loaded "module-combine" (index: #0; argument: "").
I: module.c: Loaded "module-gconf" (index: #1; argument: "").
D: module-suspend-on-idle.c: Sink combined becomes idle.
D: module-suspend-on-idle.c: Source combined.monitor becomes idle.
I: module.c: Loaded "module-suspend-on-idle" (index: #2; argument: "").
I: module-device-restore.c: Sucessfully opened database file
'/home/mne/.pulse/d05a505180ca4c5382d620fc498da356:device-volumes.x86_64-pc-linux-gnu.gdbm'.
I: module.c: Loaded "module-device-restore" (index: #3; argument: "").
I: module-stream-restore.c: Sucessfully opened database file
'/home/mne/.pulse/d05a505180ca4c5382d620fc498da356:stream-volumes.x86_64-pc-linux-gnu.gdbm'.
I: module.c: Loaded "module-stream-restore" (index: #4; argument: "").
D: cli-command.c: Checking for existance of
'/usr/lib/pulse-0.9/modules/module-hal-detect.so': success
I: module-hal-detect.c: Trying capability alsa
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/computer_alsa_timer
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/computer_alsa_sequencer
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_playback_4
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_midi_3
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_playback_2
D: module-hal-detect.c: Loading module-alsa-source with arguments
'device_id=0
source_name=alsa_input.pci_1102_4_sound_card_0_alsa_capture_0 tsched=0'
D: alsa-util.c: Trying front:0 with SND_PCM_NO_AUTO_FORMAT ...
I: module-alsa-source.c: Successfully opened device front:0.
I: module-alsa-source.c: Successfully enabled mmap() mode.
I: (alsa-lib)control.c: Invalid CTL front:0
I: alsa-util.c: Unable to attach to mixer front:0: No such file or directory
I: alsa-util.c: Successfully attached to mixer 'hw:0'
I: alsa-util.c: Cannot find mixer control "Capture" or mixer control is
no combination of switch/volume.
I: alsa-util.c: Using mixer control "Mic".
I: module-device-restore.c: Restoring volume for source
alsa_input.pci_1102_4_sound_card_0_alsa_capture_0.
I: module-device-restore.c: Restoring mute state for source
alsa_input.pci_1102_4_sound_card_0_alsa_capture_0.
I: source.c: Created source 1
"alsa_input.pci_1102_4_sound_card_0_alsa_capture_0" with sample spec
s16le 2ch 44100Hz and channel map front-left,front-right
I: module-alsa-source.c: Using 2 fragments of size 7168 bytes, buffer
time is 81.27ms
D: module-alsa-source.c: hwbuf_unused=0
D: module-alsa-source.c: setting avail_min=1
I: module-alsa-source.c: Volume ranges from 0 to 31.
I: module-alsa-source.c: Volume ranges from -34.50 dB to 12.00 dB.
I: alsa-util.c: ALSA device lacks independant volume controls for each
channel.
I: module-alsa-source.c: Using hardware volume control. Hardware dB
scale supported.
D: alsa-util.c: snd_pcm_dump():
D: alsa-util.c: Hooks PCM
D: alsa-util.c: Its setup is:
D: alsa-util.c:   stream       : CAPTURE
D: alsa-util.c:   access       : MMAP_INTERLEAVED
D: alsa-util.c:   format       : S16_LE
D: alsa-util.c:   subformat    : STD
D: alsa-util.c:   channels     : 2
D: alsa-util.c:   rate         : 44100
D: alsa-util.c:   exact rate   : 44100 (44100/1)
D: alsa-util.c:   msbits       : 16
D: alsa-util.c:   buffer_size  : 3584
D: alsa-util.c:   period_size  : 1792
D: alsa-util.c:   period_time  : 40634
D: alsa-util.c:   tstamp_mode  : ENABLE
D: alsa-util.c:   period_step  : 1
D: alsa-util.c:   avail_min    : 1792
D: alsa-util.c:   period_event : 0
D: alsa-util.c:   start_threshold  : -1
D: alsa-util.c:   stop_threshold   : 8070450532247928832
D: alsa-util.c:   silence_threshold: 0
D: alsa-util.c:   silence_size : 0
D: alsa-util.c:   boundary     : 8070450532247928832
D: alsa-util.c: Slave: Hardware PCM card 0 'Audigy 2 [SB0240]' device 0
subdevice 0
D: alsa-util.c: Its setup is:
D: alsa-util.c:   stream       : CAPTURE
D: alsa-util.c:   access       : MMAP_INTERLEAVED
D: alsa-util.c:   format       : S16_LE
D: alsa-util.c:   subformat    : STD
D: alsa-util.c:   channels     : 2
D: alsa-util.c:   rate         : 44100
D: alsa-util.c:   exact rate   : 44100 (44100/1)
D: alsa-util.c:   msbits       : 16
D: alsa-util.c:   buffer_size  : 3584
D: alsa-util.c:   period_size  : 1792
D: alsa-util.c:   period_time  : 40634
D: alsa-util.c:   tstamp_mode  : ENABLE
D: alsa-util.c:   period_step  : 1
D: alsa-util.c:   avail_min    : 1792
D: alsa-util.c:   period_event : 0
D: alsa-util.c:   start_threshold  : -1
D: alsa-util.c:   stop_threshold   : 807045053224
D: module-alsa-source.c: Thread starting up
D: module-alsa-source.c: Requested volume: 0: 100% 1: 100%
D: rtpoll.c: Acquired POSIX realtime signal SIGRTMIN+28
D: module-alsa-source.c: Got hardware volume: 0: 100% 1: 100%
D: module-alsa-source.c: Calculated software volume: 0: 100% 1: 100%
D: module-suspend-on-idle.c: Source
alsa_input.pci_1102_4_sound_card_0_alsa_capture_0 becomes idle.
I: module.c: Loaded "module-alsa-source" (index: #5; argument:
"device_id=0
source_name=alsa_input.pci_1102_4_sound_card_0_alsa_capture_0 tsched=0").
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_capture_4
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_playback_3
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_capture_2
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_midi_2
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_capture_1
D: module-hal-detect.c: Loading module-alsa-sink with arguments
'device_id=0
sink_name=alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 tsched=0'
D: alsa-util.c: Trying front:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying front:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:front:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:front:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
I: alsa-util.c: PCM device plug:front:0 refused our hw parameters:
Device or resource busy
D: alsa-util.c: Trying surround40:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying surround40:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround40:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround40:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
I: alsa-util.c: PCM device plug:surround40:0 refused our hw parameters:
Device or resource busy
D: alsa-util.c: Trying surround41:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying surround41:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround41:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround41:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
I: alsa-util.c: PCM device plug:surround41:0 refused our hw parameters:
Device or resource busy
D: alsa-util.c: Trying surround50:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying surround50:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround50:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround50:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
I: alsa-util.c: PCM device plug:surround50:0 refused our hw parameters:
Device or resource busy
D: alsa-util.c: Trying surround51:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying surround51:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround51:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround51:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
I: alsa-util.c: PCM device plug:surround51:0 refused our hw parameters:
Device or resource busy
D: alsa-util.c: Trying surround71:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying surround71:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround71:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:surround71:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
I: alsa-util.c: PCM device plug:surround71:0 refused our hw parameters:
Device or resource busy
D: alsa-util.c: Trying hw:0 as last resort...
D: alsa-util.c: Trying hw:0 with SND_PCM_NO_AUTO_FORMAT ...
I: module-alsa-sink.c: Successfully opened device hw:0.
I: module-alsa-sink.c: Successfully enabled mmap() mode.
I: alsa-util.c: Successfully attached to mixer 'hw:0'
I: alsa-util.c: Cannot find mixer control "Master" or mixer control is
no combination of switch/volume.
W: alsa-util.c: Cannot find fallback mixer control "PCM" or mixer
control is no combination of switch/volume.
I: alsa-util.c: Using mixer control "PCM".
I: module-device-restore.c: Restoring volume for sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0.
I: module-device-restore.c: Restoring mute state for sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0.
I: sink.c: Created sink 1
"alsa_output.pci_1102_4_sound_card_0_alsa_playback_0" with sample spec
s16le 2ch 44100Hz and channel map front-left,front-right
I: module-device-restore.c: Restoring volume for source
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0.monitor.
I: module-device-restore.c: Restoring mute state for source
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0.monitor.
I: source.c: Created source 2
"alsa_output.pci_1102_4_sound_card_0_alsa_playback_0.monitor" with
sample spec s16le 2ch 44100Hz and channel map front-left,front-right
I: module-alsa-sink.c: Using 8 fragments of size 1764 bytes, buffer time
is 80.00ms
D: module-alsa-sink.c: hwbuf_unused=0
D: module-alsa-sink.c: setting avail_min=1
I: module-alsa-sink.c: Volume ranges from 0 to 100.
I: module-alsa-sink.c: Volume ranges from -40.00 dB to 0.00 dB.
I: alsa-util.c: ALSA device lacks independant volume controls for each
channel.
I: module-alsa-sink.c: Using hardware volume control. Hardware dB scale
supported.
I: module-alsa-sink.c: Using software mute control.
D: alsa-util.c: snd_pcm_dump():
D: alsa-util.c: Hardware PCM card 0 'Audigy 2 [SB0240]' device 0 subdevice 0
D: alsa-util.c: Its setup is:
D: alsa-util.c:   stream       : PLAYBACK
D: alsa-util.c:   access       : MMAP_INTERLEAVED
D: alsa-util.c:   format       : S16_LE
D: alsa-util.c:   subformat    : STD
D: alsa-util.c:   channels     : 2
D: alsa-util.c:   rate         : 44100
D: alsa-util.c:   exact rate   : 44100 (44100/1)
D: alsa-util.c:   msbits       : 16
D: alsa-util.c:   buffer_size  : 3528
D: alsa-util.c:   period_size  : 441
D: alsa-util.c:   period_time  : 10000
D: alsa-util.c:   tstamp_mode  : ENABLE
D: alsa-util.c:   period_step  : 1
D: alsa-util.c:   avail_min    : 441
D: alsa-util.c:   period_event : 0
D: alsa-util.c:   start_threshold  : -1
D: alsa-util.c:   stop_threshold   : 7944349742681554944
D: alsa-util.c:   silence_threshold: 0
D: alsa-util.c:   silence_size : 0
D: alsa-util.c:   boundary     : 7944349742681554944
D: module-alsa-sink.c: Thread starting up
D: module-alsa-sink.c: Requested volume: 0:  77% 1:  77%
D: rtpoll.c: Acquired POSIX realtime signal SIGRTMIN+27
D: module-alsa-sink.c: Got hardware volume: 0:  77% 1:  77%
D: module-alsa-sink.c: Calculated software volume: 0: 100% 1: 100%
I: module-alsa-sink.c: Starting playback.
D: module-suspend-on-idle.c: Source
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0.monitor becomes idle.
D: module-suspend-on-idle.c: Sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 becomes idle.
I: module-combine.c: Configuring new sink:
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0
D: memblockq.c: memblockq requested: maxlength=16777216,
tlength=16777216, base=4, prebuf=1, minreq=0 maxrewind=0
D: memblockq.c: memblockq sanitized: maxlength=16777216,
tlength=16777216, base=4, prebuf=4, minreq=4 maxrewind=0
I: module-stream-restore.c: Not restore device for stream
sink-input-by-media-role:filter, because already set.
I: module-stream-restore.c: Restoring volume for sink input
sink-input-by-media-role:filter.
I: module-stream-restore.c: Restoring mute state for sink input
sink-input-by-media-role:filter.
D: module-suspend-on-idle.c: Sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 becomes busy.
I: resampler.c: Using resampler 'trivial'
I: resampler.c: Using s16le as working format.
D: memblockq.c: memblockq requested: maxlength=33554432, tlength=0,
base=4, prebuf=0, minreq=1 maxrewind=0
D: memblockq.c: memblockq sanitized: maxlength=33554432,
tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
I: sink-input.c: Created input 0 "Simultaneous output on Audigy 2
[SB0240] - ADC Capture/Standard PCM Playback" on
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 with sample spec
s16le 2ch 44100Hz and channel map front-left,front-right
D: module-alsa-sink.c: hwbuf_unused=0
D: module-alsa-sink.c: setting avail_min=1
I: module.c: Loaded "module-alsa-sink" (index: #6; argument:
"device_id=0
sink_name=alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 tsched=0").
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_midi_1
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_midi_0
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_hw_specific_2
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_hw_specific_0
D: module-hal-detect.c: Not loaded device
/org/freedesktop/Hal/devices/pci_1102_4_sound_card_0_alsa_control__1
I: module-hal-detect.c: Loaded 2 modules.
I: module.c: Loaded "module-hal-detect" (index: #7; argument: "tsched=0").
D: cli-command.c: Checking for existance of
'/usr/lib/pulse-0.9/modules/module-esound-protocol-unix.so': success
I: module.c: Loaded "module-esound-protocol-unix" (index: #8; argument: "").
I: module.c: Loaded "module-native-protocol-unix" (index: #9; argument: "").
I: module-default-device-restore.c: Restored default sink
'alsa_output.pci_1102_4_sound_card_0_alsa_playback_0'.
D: core-subscribe.c: Dropped redundant event due to change event.
I: module-default-device-restore.c: Restored default source
'alsa_input.pci_1102_4_sound_card_0_alsa_capture_0'.
I: module.c: Loaded "module-default-device-restore" (index: #10;
argument: "").
I: module.c: Loaded "module-rescue-streams" (index: #11; argument: "").
I: module.c: Loaded "module-always-sink" (index: #12; argument: "").
I: client.c: Created 0 "ConsoleKit Session
/org/freedesktop/ConsoleKit/Session3"
D: module-console-kit.c: Added new session
/org/freedesktop/ConsoleKit/Session3
I: module.c: Loaded "module-console-kit" (index: #13; argument: "").
I: module.c: Loaded "module-position-event-sounds" (index: #14;
argument: "").
I: main.c: Daemon startup complete.
D: module-hal-detect.c: dbus: interface=org.freedesktop.DBus,
path=/org/freedesktop/DBus, member=NameAcquired
D: module-console-kit.c: dbus: interface=org.freedesktop.DBus,
path=/org/freedesktop/DBus, member=NameAcquired
I: module-suspend-on-idle.c: Source combined.monitor idle for too long,
suspending ...
I: module-suspend-on-idle.c: Sink combined idle for too long, suspending ...
D: module-alsa-sink.c: hwbuf_unused=0
D: module-alsa-sink.c: setting avail_min=1
D: module-suspend-on-idle.c: Sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 becomes idle.
D: module-suspend-on-idle.c: Sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 becomes idle.
I: sink-input.c: Freeing input 0 "Simultaneous output on Audigy 2
[SB0240] - ADC Capture/Standard PCM Playback"
I: module-combine.c: Device suspended...
I: module-suspend-on-idle.c: Source
alsa_input.pci_1102_4_sound_card_0_alsa_capture_0 idle for too long,
suspending ...
I: module-alsa-source.c: Device suspended...
I: module-suspend-on-idle.c: Source
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0.monitor idle for too
long, suspending ...
I: client.c: Created 1 "Native client (UNIX socket client)"
I: client.c: Freed 1 "Native client (UNIX socket client)"
I: protocol-native.c: Connection died.
I: client.c: Created 2 "Native client (UNIX socket client)"
D: protocol-native.c: Protocol version: remote 14, local 14
I: protocol-native.c: Got credentials: uid=1000 gid=1000 success=1
D: protocol-native.c: SHM possible: yes
D: protocol-native.c: Negotiated SHM: yes
I: module-stream-restore.c: Restoring device for stream
source-output-by-application-name:ALSA plug-in [duplex].
I: module-alsa-source.c: Trying resume...
D: module-alsa-source.c: hwbuf_unused=0
D: module-alsa-source.c: setting avail_min=1
I: module-alsa-source.c: Resumed successfully...
D: module-suspend-on-idle.c: Source
alsa_input.pci_1102_4_sound_card_0_alsa_capture_0 becomes idle.
D: module-suspend-on-idle.c: Source
alsa_input.pci_1102_4_sound_card_0_alsa_capture_0 becomes busy.
D: resampler.c: Channel matrix:
D: resampler.c:        I00   I01
D: resampler.c:     +------------
D: resampler.c: O00 | 1.000 1.000
I: resampler.c: Using resampler 'src-linear'
I: resampler.c: Using float32le as working format.
D: memblockq.c: memblockq requested: maxlength=33554432, tlength=0,
base=4, prebuf=0, minreq=1 maxrewind=0
D: memblockq.c: memblockq sanitized: maxlength=33554432,
tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
I: source-output.c: Created output 0 "ALSA Capture" on
alsa_input.pci_1102_4_sound_card_0_alsa_capture_0 with sample spec s16le
1ch 8000Hz and channel map mono
D: memblockq.c: memblockq requested: maxlength=4194304, tlength=0,
base=2, prebuf=1, minreq=0 maxrewind=0
D: memblockq.c: memblockq sanitized: maxlength=4194304, tlength=4194304,
base=2, prebuf=2, minreq=2 maxrewind=0
I: protocol-native.c: Final latency 40.00 ms = 20.00 ms + 20.00 ms
D: module-alsa-source.c: hwbuf_unused=0
D: module-alsa-source.c: setting avail_min=1
D: module-alsa-source.c: hwbuf_unused=0
D: module-alsa-source.c: setting avail_min=1
I: client.c: Created 3 "Native client (UNIX socket client)"
D: protocol-native.c: Protocol version: remote 14, local 14
I: protocol-native.c: Got credentials: uid=1000 gid=1000 success=1
D: protocol-native.c: SHM possible: yes
D: protocol-native.c: Negotiated SHM: yes
I: module-stream-restore.c: Restoring device for stream
sink-input-by-application-name:ALSA plug-in [duplex].
I: module-stream-restore.c: Restoring volume for sink input
sink-input-by-application-name:ALSA plug-in [duplex].
D: module-stream-restore.c: Not restoring mute state for sink input
sink-input-by-application-name:ALSA plug-in [duplex], because already set.
D: module-suspend-on-idle.c: Sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 becomes busy.
D: resampler.c: Channel matrix:
D: resampler.c:        I00
D: resampler.c:     +------
D: resampler.c: O00 | 1.000
D: resampler.c: O01 | 1.000
I: resampler.c: Using resampler 'src-linear'
I: resampler.c: Using float32le as working format.
D: memblockq.c: memblockq requested: maxlength=33554432, tlength=0,
base=4, prebuf=0, minreq=1 maxrewind=0
D: memblockq.c: memblockq sanitized: maxlength=33554432,
tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
I: sink-input.c: Created input 1 "ALSA Playback" on
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 with sample spec
s16le 1ch 8000Hz and channel map mono
I: protocol-native.c: Requested tlength=80.00 ms, minreq=20.00 ms
D: protocol-native.c: Early requests mode enabled, configuring sink
latency to minreq.
D: memblockq.c: memblockq requested: maxlength=4194304, tlength=1280,
base=2, prebuf=960, minreq=320 maxrewind=0
D: memblockq.c: memblockq sanitized: maxlength=4194304, tlength=1280,
base=2, prebuf=960, minreq=320 maxrewind=0
I: protocol-native.c: Final latency 100.00 ms = 40.00 ms + 2*20.00 ms +
20.00 ms
D: module-alsa-sink.c: hwbuf_unused=0
D: module-alsa-sink.c: setting avail_min=1
D: module-alsa-source.c: hwbuf_unused=0
D: module-alsa-source.c: setting avail_min=1
D: module-suspend-on-idle.c: Source
alsa_input.pci_1102_4_sound_card_0_alsa_capture_0 becomes idle.
D: module-suspend-on-idle.c: Source
alsa_input.pci_1102_4_sound_card_0_alsa_capture_0 becomes idle.
I: source-output.c: Freeing output 0 "ALSA Capture"
I: module-stream-restore.c: Restoring device for stream
source-output-by-application-name:ALSA plug-in [duplex].
D: module-suspend-on-idle.c: Source
alsa_input.pci_1102_4_sound_card_0_alsa_capture_0 becomes busy.
D: resampler.c: Channel matrix:
D: resampler.c:        I00   I01
D: resampler.c:     +------------
D: resampler.c: O00 | 1.000 1.000
I: resampler.c: Using resampler 'src-linear'
I: resampler.c: Using float32le as working format.
D: memblockq.c: memblockq requested: maxlength=33554432, tlength=0,
base=4, prebuf=0, minreq=1 maxrewind=0
D: memblockq.c: memblockq sanitized: maxlength=33554432,
tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
I: source-output.c: Created output 1 "ALSA Capture" on
alsa_input.pci_1102_4_sound_card_0_alsa_capture_0 with sample spec s16le
1ch 8000Hz and channel map mono
D: memblockq.c: memblockq requested: maxlength=4194304, tlength=0,
base=2, prebuf=1, minreq=0 maxrewind=0
D: memblockq.c: memblockq sanitized: maxlength=4194304, tlength=4194304,
base=2, prebuf=2, minreq=2 maxrewind=0
I: protocol-native.c: Final latency 40.00 ms = 20.00 ms + 20.00 ms
D: module-alsa-source.c: hwbuf_unused=0
D: module-alsa-source.c: setting avail_min=1
D: module-alsa-source.c: hwbuf_unused=0
D: module-alsa-source.c: setting avail_min=1
D: module-alsa-sink.c: hwbuf_unused=0
D: module-alsa-sink.c: setting avail_min=1
D: module-suspend-on-idle.c: Sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 becomes idle.
D: module-suspend-on-idle.c: Sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 becomes idle.
I: sink-input.c: Freeing input 1 "ALSA Playback"
I: module-stream-restore.c: Restoring device for stream
sink-input-by-application-name:ALSA plug-in [duplex].
I: module-stream-restore.c: Restoring volume for sink input
sink-input-by-application-name:ALSA plug-in [duplex].
D: module-stream-restore.c: Not restoring mute state for sink input
sink-input-by-application-name:ALSA plug-in [duplex], because already set.
D: module-suspend-on-idle.c: Sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 becomes busy.
D: resampler.c: Channel matrix:
D: resampler.c:        I00
D: resampler.c:     +------
D: resampler.c: O00 | 1.000
D: resampler.c: O01 | 1.000
I: resampler.c: Using resampler 'src-linear'
I: resampler.c: Using float32le as working format.
D: memblockq.c: memblockq requested: maxlength=33554432, tlength=0,
base=4, prebuf=0, minreq=1 maxrewind=0
D: memblockq.c: memblockq sanitized: maxlength=33554432,
tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
I: sink-input.c: Created input 2 "ALSA Playback" on
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 with sample spec
s16le 1ch 8000Hz and channel map mono
I: protocol-native.c: Requested tlength=80.00 ms, minreq=20.00 ms
D: protocol-native.c: Early requests mode enabled, configuring sink
latency to minreq.
D: memblockq.c: memblockq requested: maxlength=4194304, tlength=1280,
base=2, prebuf=960, minreq=320 maxrewind=0
D: memblockq.c: memblockq sanitized: maxlength=4194304, tlength=1280,
base=2, prebuf=960, minreq=320 maxrewind=0
I: protocol-native.c: Final latency 100.00 ms = 40.00 ms + 2*20.00 ms +
20.00 ms
D: module-alsa-sink.c: hwbuf_unused=0
D: module-alsa-sink.c: setting avail_min=1
D: protocol-native.c: Requesting rewind due to end of underrun.
D: module-alsa-sink.c: hwbuf_unused=0
D: module-alsa-sink.c: setting avail_min=1
D: module-suspend-on-idle.c: Sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 becomes idle.
D: module-suspend-on-idle.c: Sink
alsa_output.pci_1102_4_sound_card_0_alsa_playback_0 becomes idle.
I: sink-input.c: Freeing input 2 "ALSA Playback"
I: client.c: Freed 3 "ALSA plug-in [duplex]"
I: protocol-native.c: Connection died.
D: module-alsa-source.c: hwbuf_unused=0
D: module-alsa-source.c: setting avail_min=1
D: module-suspend-on-idle.c: Source
alsa_input.pci_1102_4_sound_card_0_alsa_capture_0 becomes idle.
D: module-suspend-on-idle.c: Source
alsa_input.pci_1102_4_sound_card_0_alsa_capture_0 becomes idle.
I: source-output.c: Freeing output 1 "ALSA Capture"
I: client.c: Freed 2 "ALSA plug-in [duplex]"
I: protocol-native.c: Connection died.
------------------------------------------------------------------------------

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-22 10:09     ` Stefan Schoenleitner
  2010-04-23  4:10       ` Raymond Yau
@ 2010-04-24  1:32       ` Raymond Yau
  2010-04-24 14:38         ` Stefan Schoenleitner
  1 sibling, 1 reply; 19+ messages in thread
From: Raymond Yau @ 2010-04-24  1:32 UTC (permalink / raw)
  To: ALSA Development Mailing List

2010/4/22 Stefan Schoenleitner <dev.c0debabe@gmail.com>

>
> For testing purposes I increased the period size to 320 so that the
> program works on my hardware sound card "hw".
> It turned out that the program is working fine there and the poll()
> behavior is as it should be.
>
> cheers,
> stefan
>
>
Is it possible to post the output of your program when using your sound card
"hw" since your program failed with XRUN (broken pipe) on my two sound cards
?

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-24  1:32       ` Raymond Yau
@ 2010-04-24 14:38         ` Stefan Schoenleitner
  2010-04-24 23:43           ` Raymond Yau
  2010-04-26  1:46           ` Raymond Yau
  0 siblings, 2 replies; 19+ messages in thread
From: Stefan Schoenleitner @ 2010-04-24 14:38 UTC (permalink / raw)
  To: Raymond Yau; +Cc: ALSA Development Mailing List

Raymond Yau wrote:
>>
>>
> Is it possible to post the output of your program when using your sound card
> "hw" since your program failed with XRUN (broken pipe) on my two sound cards
> ?


Sure, no problem.

However, I had to change 2 settings to get it working on my soundcard:

* change period size from 160 to 320, as my soundcard does not support a
period size of 160 frames

* change buffer size from 2 periods (1280 bytes) to 1 period (640
bytes), as my soundcard only supports a buffersize being equal to one period


After that the program works fine and runs forever (see below).

I'm looking forward to test it on my embedded target as well (with the
original settings).
If required I can post the output of that as well.

cheers,
stefan

-------------------------------------------------------------------------------
$ ./duplex hw
could not sched_setscheduler: Operation not permitted
PCM format is signed, linear, LE with 16 bits
PCM rate 8000 - 48000 Hz
PCM period size: 192 - 16384
PCM buffer size: 640 - 640
calculated buffer size: 640
avail min: 320
avail min after setup: 320
start threshold: 320 frames
stop threshold: 640 frames
PCM format is signed, linear, LE with 16 bits
PCM rate 4000 - 96000 Hz
PCM period size: 32 - 32768
PCM buffer size: 320 - 32640
calculated buffer size: 640
avail min: 320
avail min after setup: 320
start threshold: 320 frames
stop threshold: 640 frames
capture fds: 1, playback fds: 1
capture poll fd: 4, playback poll fd: 5
capture struct: fd: 4, events: POLLIN POLLERR , revents: 0
playback struct: fd: 5, events: POLLOUT POLLERR , revents: 0
capture avail min: 320
playback avail min: 320
snd_pcm_avail_update(capture): 0
demangled poll:  on capture device
snd_pcm_avail_update(playback): 640
demangled poll: POLLOUT  on playback device
wrote 320 frames
snd_pcm_avail_update(capture): 0
demangled poll:  on capture device
snd_pcm_avail_update(playback): 320
demangled poll: POLLOUT  on playback device
wrote 320 frames
snd_pcm_avail_update(capture): 320
demangled poll: POLLIN  on capture device
read 320 frames
hexdump(): 640 bytes
0000	fe ff fe ff fe ff fe ff ff ff fe ff fe ff ff ff
0010	fe ff ff ff ff ff ff ff fe ff fe ff fe ff ff ff
0020	ff ff fe ff fe ff ff ff ff ff ff ff ff ff ff ff
0030	ff ff fe ff fe ff ff ff ff ff fe ff ff ff fe ff
0040	fe ff fe ff fe ff ff ff ff ff fe ff fe ff ff ff
0050	ff ff ff ff fe ff fe ff fe ff ff ff ff ff fe ff
0060	fe ff ff ff ff ff fe ff fe ff ff ff ff ff fe ff
0070	ff ff fe ff fe ff ff ff fe ff fe ff ff ff fe ff
0080	fe ff ff ff ff ff ff ff fe ff fe ff fe ff ff ff
0090	ff ff fe ff ff ff ff ff fe ff fe ff ff ff fe ff
00a0	ff ff ff ff fe ff fe ff ff ff fe ff fe ff ff ff
00b0	ff ff fe ff fe ff ff ff ff ff ff ff ff ff ff ff
00c0	ff ff ff ff ff ff ff ff ff ff ff ff ff ff fe ff
00d0	ff ff ff ff fe ff fe ff fe ff ff ff ff ff fe ff
00e0	fe ff fe ff ff ff ff ff fe ff fe ff ff ff fe ff
00f0	ff ff ff ff ff ff ff ff ff ff fe ff ff ff ff ff
0100	fe ff fe ff fe ff fe ff fe ff ff ff ff ff fe ff
0110	ff ff ff ff fe ff fe ff ff ff ff ff fe ff fe ff
0120	ff ff ff ff fe ff fe ff ff ff ff ff fe ff fe ff
0130	fe ff ff ff fe ff ff ff fe ff fe ff fe ff fe ff
0140	ff ff fe ff fe ff ff ff ff ff fe ff fe ff ff ff
0150	fe ff fe ff fe ff fe ff ff ff fe ff ff ff ff ff
0160	fe ff fe ff ff ff fe ff fe ff ff ff ff ff fe ff
0170	ff ff ff ff ff ff ff ff fe ff ff ff ff ff fe ff
0180	fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0190	ff ff fe ff fe ff ff ff ff ff ff ff ff ff ff ff
01a0	ff ff ff ff fe ff fe ff fe ff ff ff ff ff fe ff
01b0	fe ff fe ff ff ff fe ff fe ff ff ff ff ff ff ff
01c0	ff ff ff ff ff ff ff ff ff ff ff ff fe ff fe ff
01d0	fe ff fe ff fe ff ff ff ff ff fe ff fe ff fe ff
01e0	fe ff ff ff ff ff ff ff fe ff fe ff ff ff ff ff
01f0	fe ff fe ff ff ff ff ff ff ff ff ff ff ff fe ff
0200	fe ff ff ff ff ff ff ff ff ff ff ff ff ff fe ff
0210	ff ff ff ff fe ff fe ff ff ff ff ff ff ff ff ff
0220	ff ff fe ff fe ff ff ff ff ff ff ff fe ff ff ff
0230	ff ff ff ff fe ff ff ff ff ff ff ff ff ff ff ff
0240	ff ff ff ff ff ff ff ff ff ff fe ff fe ff ff ff
0250	ff ff fe ff ff ff ff ff ff ff ff ff ff ff fe ff
0260	fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0270	fe ff ff ff ff ff fe ff fe ff ff ff ff ff ff ff

snd_pcm_avail_update(playback): 320
demangled poll:  on playback device
snd_pcm_avail_update(capture): 0
demangled poll:  on capture device
snd_pcm_avail_update(playback): 320
demangled poll: POLLOUT  on playback device
wrote 320 frames
snd_pcm_avail_update(capture): 320
demangled poll: POLLIN  on capture device
read 320 frames
hexdump(): 640 bytes
0000	ff ff ff ff fe ff ff ff ff ff ff ff ff ff ff ff
0010	fe ff fe ff ff ff ff ff fe ff ff ff ff ff ff ff
0020	ff ff ff ff fe ff ff ff ff ff fe ff ff ff ff ff
0030	fe ff fe ff ff ff fe ff fe ff ff ff ff ff fe ff
0040	fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0050	ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0060	ff ff fe ff fe ff ff ff ff ff ff ff ff ff ff ff
0070	ff ff fe ff fe ff fe ff ff ff ff ff ff ff fe ff
0080	fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0090	ff ff ff ff ff ff ff ff fe ff fe ff ff ff fe ff
00a0	ff ff fe ff fe ff ff ff ff ff ff ff ff ff fe ff
00b0	fe ff fe ff fe ff fe ff fe ff fe ff ff ff ff ff
00c0	ff ff ff ff ff ff fe ff ff ff ff ff ff ff fe ff
00d0	fe ff ff ff fe ff fe ff ff ff ff ff fe ff fe ff
00e0	fe ff ff ff fe ff fe ff ff ff ff ff ff ff ff ff
00f0	ff ff ff ff fe ff ff ff ff ff ff ff ff ff ff ff
0100	ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0110	ff ff ff ff fe ff ff ff ff ff ff ff ff ff fe ff
0120	ff ff ff ff fe ff ff ff ff ff fe ff fe ff ff ff
0130	ff ff ff ff ff ff ff ff ff ff fe ff fe ff ff ff
0140	fe ff ff ff ff ff fe ff ff ff ff ff fe ff fe ff
0150	fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0160	ff ff ff ff ff ff fe ff fe ff fe ff ff ff ff ff
0170	ff ff ff ff ff ff ff ff ff ff ff ff fe ff fe ff
0180	ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0190	ff ff ff ff ff ff ff ff ff ff fe ff fe ff ff ff
01a0	ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
01b0	ff ff ff ff ff ff ff ff fe ff fe ff ff ff ff ff
01c0	ff ff ff ff ff ff ff ff ff ff ff ff ff ff fe ff
01d0	ff ff ff ff ff ff ff ff fe ff ff ff ff ff ff ff
01e0	ff ff fe ff fe ff ff ff ff ff ff ff ff ff ff ff
01f0	ff ff ff ff ff ff fe ff fe ff fe ff fe ff fe ff
0200	fe ff fe ff fe ff ff ff fe ff ff ff ff ff fe ff
0210	fe ff ff ff ff ff ff ff ff ff ff ff fe ff fe ff
0220	ff ff ff ff ff ff ff ff ff ff fe ff ff ff ff ff
0230	ff ff ff ff ff ff ff ff ff ff ff ff fe ff fe ff
0240	fe ff ff ff ff ff ff ff ff ff ff ff ff ff fe ff
0250	fe ff fe ff ff ff ff ff ff ff ff ff ff ff ff ff
0260	fe ff ff ff ff ff ff ff fe ff ff ff ff ff ff ff
0270	ff ff ff ff fe ff ff ff ff ff ff ff ff ff ff ff

snd_pcm_avail_update(playback): 320
demangled poll:  on playback device
snd_pcm_avail_update(capture): 0
demangled poll:  on capture device
snd_pcm_avail_update(playback): 320
demangled poll: POLLOUT  on playback device
wrote 320 frames
snd_pcm_avail_update(capture): 320
demangled poll: POLLIN  on capture device
read 320 frames
hexdump(): 640 bytes
0000	ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0010	ff ff ff ff ff ff ff ff ff ff fe ff fe ff ff ff
0020	ff ff fe ff fe ff ff ff fe ff fe ff ff ff fe ff
0030	fe ff ff ff ff ff ff ff ff ff fe ff ff ff ff ff
0040	fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
0050	fe ff fe ff ff ff fe ff fe ff fe ff ff ff ff ff
0060	ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0070	ff ff ff ff fe ff fe ff ff ff ff ff fe ff fe ff
0080	ff ff ff ff ff ff ff ff ff ff ff ff ff ff fe ff
0090	fe ff ff ff fe ff fe ff ff ff fe ff ff ff ff ff
00a0	ff ff fe ff ff ff ff ff fe ff ff ff ff ff ff ff
00b0	ff ff ff ff fe ff fe ff fe ff ff ff fe ff fe ff
00c0	fe ff fe ff fe ff fe ff fe ff fe ff ff ff fe ff
00d0	fe ff fe ff ff ff fe ff fe ff fe ff fe ff ff ff
00e0	ff ff ff ff ff ff fe ff fe ff fe ff fe ff fe ff
00f0	ff ff fe ff fe ff ff ff ff ff ff ff ff ff ff ff
0100	fe ff fe ff fe ff fe ff fe ff fe ff fe ff fe ff
0110	fe ff ff ff fe ff fe ff ff ff ff ff fe ff fe ff
0120	fe ff fe ff fe ff ff ff ff ff ff ff fe ff fe ff
0130	fe ff fe ff ff ff ff ff ff ff fe ff fe ff fe ff
0140	ff ff ff ff fe ff fe ff fe ff fe ff fe ff ff ff
0150	fe ff fe ff ff ff ff ff ff ff fe ff fe ff fe ff
0160	fe ff fe ff fe ff ff ff ff ff ff ff ff ff ff ff
0170	ff ff ff ff ff ff ff ff fe ff ff ff ff ff ff ff
0180	fe ff fe ff ff ff ff ff fe ff ff ff fe ff fe ff
0190	fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
01a0	ff ff ff ff fe ff ff ff ff ff fe ff fe ff ff ff
01b0	ff ff ff ff ff ff ff ff ff ff ff ff fe ff fe ff
01c0	ff ff ff ff fe ff fe ff ff ff ff ff ff ff ff ff
01d0	ff ff fe ff fe ff ff ff ff ff ff ff ff ff ff ff
01e0	ff ff fe ff ff ff ff ff ff ff fe ff ff ff fe ff
01f0	fe ff ff ff ff ff fe ff fe ff ff ff fe ff fe ff
0200	ff ff ff ff ff ff ff ff ff ff fe ff fe ff fe ff
0210	fe ff fe ff fe ff ff ff ff ff fe ff fe ff ff ff
0220	ff ff ff ff ff ff ff ff ff ff fe ff fe ff fe ff
0230	ff ff ff ff ff ff ff ff ff ff ff ff fe ff fe ff
0240	fe ff fe ff fe ff ff ff fe ff fe ff fe ff fe ff
0250	fe ff ff ff ff ff ff ff ff ff ff ff ff ff fe ff
0260	fe ff ff ff fe ff fe ff fe ff fe ff fe ff fe ff
0270	ff ff ff ff fe ff fe ff fe ff fe ff ff ff ff ff

snd_pcm_avail_update(playback): 320
demangled poll: POLLOUT  on playback device
wrote 320 frames
snd_pcm_avail_update(capture): 320
demangled poll: POLLIN  on capture device
read 320 frames
hexdump(): 640 bytes
0000	ff ff fe ff ff ff ff ff ff ff ff ff fe ff fe ff
0010	ff ff ff ff ff ff ff ff fe ff fe ff fe ff fe ff
0020	fe ff fe ff fe ff fe ff ff ff ff ff ff ff ff ff
0030	ff ff ff ff ff ff ff ff ff ff ff ff ff ff fe ff
0040	ff ff ff ff fe ff fe ff ff ff fe ff ff ff fe ff
0050	fe ff ff ff ff ff fe ff ff ff ff ff ff ff ff ff
0060	fe ff fe ff fe ff ff ff ff ff ff ff fe ff ff ff
0070	ff ff ff ff fe ff fe ff fe ff ff ff ff ff fe ff
0080	fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0090	fe ff fe ff ff ff ff ff ff ff ff ff ff ff ff ff
00a0	fe ff ff ff fe ff ff ff fe ff fe ff ff ff fe ff
00b0	fe ff ff ff ff ff ff ff fe ff fe ff ff ff ff ff
00c0	fe ff fe ff ff ff ff ff fe ff ff ff ff ff fe ff
00d0	ff ff ff ff fe ff ff ff ff ff ff ff ff ff ff ff
00e0	ff ff ff ff ff ff ff ff fe ff ff ff ff ff fe ff
00f0	fe ff ff ff fe ff fe ff ff ff ff ff fe ff fe ff
0100	ff ff ff ff fe ff fe ff ff ff ff ff ff ff fe ff
0110	fe ff fe ff ff ff ff ff ff ff ff ff fe ff fe ff
0120	ff ff ff ff fe ff fe ff fe ff ff ff ff ff fe ff
0130	fe ff fe ff ff ff fe ff ff ff ff ff fe ff fe ff
0140	fe ff fe ff ff ff ff ff ff ff ff ff ff ff fe ff
0150	fe ff ff ff ff ff ff ff fe ff fe ff fe ff fe ff
0160	ff ff ff ff ff ff ff ff fe ff fe ff ff ff ff ff
0170	fe ff fe ff ff ff ff ff ff ff fe ff fe ff fe ff
0180	ff ff ff ff ff ff fe ff fe ff ff ff fe ff fe ff
0190	fe ff fe ff fe ff ff ff fe ff fe ff fe ff fe ff
01a0	fe ff ff ff fe ff fe ff fe ff fe ff ff ff fe ff
01b0	ff ff fe ff fe ff fe ff ff ff ff ff fe ff ff ff
01c0	ff ff fe ff fe ff fe ff ff ff fe ff fe ff fe ff
01d0	fe ff ff ff fe ff fe ff ff ff fe ff fe ff fe ff
01e0	fe ff fe ff fe ff fe ff ff ff ff ff ff ff ff ff
01f0	ff ff ff ff ff ff fe ff fe ff ff ff ff ff fe ff
0200	ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[...]
-------------------------------------------------------------------------------

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-24 14:38         ` Stefan Schoenleitner
@ 2010-04-24 23:43           ` Raymond Yau
  2010-04-26  7:52             ` Stefan Schoenleitner
  2010-04-26  1:46           ` Raymond Yau
  1 sibling, 1 reply; 19+ messages in thread
From: Raymond Yau @ 2010-04-24 23:43 UTC (permalink / raw)
  To: ALSA Development Mailing List

2010/4/24 Stefan Schoenleitner <dev.c0debabe@gmail.com>

> Raymond Yau wrote:
> >>
> >>
> > Is it possible to post the output of your program when using your sound
> card
> > "hw" since your program failed with XRUN (broken pipe) on my two sound
> cards
> > ?
>
>
> Sure, no problem.
>
> However, I had to change 2 settings to get it working on my soundcard:
>
> * change period size from 160 to 320, as my soundcard does not support a
> period size of 160 frames
>
> * change buffer size from 2 periods (1280 bytes) to 1 period (640
> bytes), as my soundcard only supports a buffersize being equal to one
> period
>
>
> After that the program works fine and runs forever (see below).
>
> I'm looking forward to test it on my embedded target as well (with the
> original settings).
> If required I can post the output of that as well.
>
> cheers,
> stefan
>
>
> -------------------------------------------------------------------------------
> $ ./duplex hw
> could not sched_setscheduler: Operation not permitted
> PCM format is signed, linear, LE with 16 bits
> PCM rate 8000 - 48000 Hz
> PCM period size: 192 - 16384
> PCM buffer size: 640 - 640
> calculated buffer size: 640
> avail min: 320
> avail min after setup: 320
> start threshold: 320 frames
> stop threshold: 640 frames
> PCM format is signed, linear, LE with 16 bits
> PCM rate 4000 - 96000 Hz
> PCM period size: 32 - 32768
> PCM buffer size: 320 - 32640
> calculated buffer size: 640
> avail min: 320
> avail min after setup: 320
> start threshold: 320 frames
> stop threshold: 640 frames
> capture fds: 1, playback fds: 1
> capture poll fd: 4, playback poll fd: 5
> capture struct: fd: 4, events: POLLIN POLLERR , revents: 0
> playback struct: fd: 5, events: POLLOUT POLLERR , revents: 0
> capture avail min: 320
> playback avail min: 320
> snd_pcm_avail_update(capture): 0
> demangled poll:  on capture device
> snd_pcm_avail_update(playback): 640
> demangled poll: POLLOUT  on playback device
> wrote 320 frames
> snd_pcm_avail_update(capture): 0
> demangled poll:  on capture device
> snd_pcm_avail_update(playback): 320
> demangled poll: POLLOUT  on playback device
> wrote 320 frames
> snd_pcm_avail_update(capture): 320
> demangled poll: POLLIN  on capture device
> read 320 frames
> hexdump(): 640 bytes
> 0000    fe ff fe ff fe ff fe ff ff ff fe ff fe ff ff ff
> 0010    fe ff ff ff ff ff ff ff fe ff fe ff fe ff ff ff
> 0020    ff ff fe ff fe ff ff ff ff ff ff ff ff ff ff ff
> 0030    ff ff fe ff fe ff ff ff ff ff fe ff ff ff fe ff
> 0040    fe ff fe ff fe ff ff ff ff ff fe ff fe ff ff ff
> 0050    ff ff ff ff fe ff fe ff fe ff ff ff ff ff fe ff
> 0060    fe ff ff ff ff ff fe ff fe ff ff ff ff ff fe ff
> 0070    ff ff fe ff fe ff ff ff fe ff fe ff ff ff fe ff
> 0080    fe ff ff ff ff ff ff ff fe ff fe ff fe ff ff ff
> 0090    ff ff fe ff ff ff ff ff fe ff fe ff ff ff fe ff
> 00a0    ff ff ff ff fe ff fe ff ff ff fe ff fe ff ff ff
> 00b0    ff ff fe ff fe ff ff ff ff ff ff ff ff ff ff ff
> 00c0    ff ff ff ff ff ff ff ff ff ff ff ff ff ff fe ff
> 00d0    ff ff ff ff fe ff fe ff fe ff ff ff ff ff fe ff
> 00e0    fe ff fe ff ff ff ff ff fe ff fe ff ff ff fe ff
> 00f0    ff ff ff ff ff ff ff ff ff ff fe ff ff ff ff ff
> 0100    fe ff fe ff fe ff fe ff fe ff ff ff ff ff fe ff
> 0110    ff ff ff ff fe ff fe ff ff ff ff ff fe ff fe ff
> 0120    ff ff ff ff fe ff fe ff ff ff ff ff fe ff fe ff
> 0130    fe ff ff ff fe ff ff ff fe ff fe ff fe ff fe ff
> 0140    ff ff fe ff fe ff ff ff ff ff fe ff fe ff ff ff
> 0150    fe ff fe ff fe ff fe ff ff ff fe ff ff ff ff ff
> 0160    fe ff fe ff ff ff fe ff fe ff ff ff ff ff fe ff
> 0170    ff ff ff ff ff ff ff ff fe ff ff ff ff ff fe ff
> 0180    fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> 0190    ff ff fe ff fe ff ff ff ff ff ff ff ff ff ff ff
> 01a0    ff ff ff ff fe ff fe ff fe ff ff ff ff ff fe ff
> 01b0    fe ff fe ff ff ff fe ff fe ff ff ff ff ff ff ff
> 01c0    ff ff ff ff ff ff ff ff ff ff ff ff fe ff fe ff
> 01d0    fe ff fe ff fe ff ff ff ff ff fe ff fe ff fe ff
> 01e0    fe ff ff ff ff ff ff ff fe ff fe ff ff ff ff ff
> 01f0    fe ff fe ff ff ff ff ff ff ff ff ff ff ff fe ff
> 0200    fe ff ff ff ff ff ff ff ff ff ff ff ff ff fe ff
> 0210    ff ff ff ff fe ff fe ff ff ff ff ff ff ff ff ff
> 0220    ff ff fe ff fe ff ff ff ff ff ff ff fe ff ff ff
> 0230    ff ff ff ff fe ff ff ff ff ff ff ff ff ff ff ff
> 0240    ff ff ff ff ff ff ff ff ff ff fe ff fe ff ff ff
> 0250    ff ff fe ff ff ff ff ff ff ff ff ff ff ff fe ff
> 0260    fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> 0270    fe ff ff ff ff ff fe ff fe ff ff ff ff ff ff ff
>
> snd_pcm_avail_update(playback): 320
> demangled poll:  on playback device
> snd_pcm_avail_update(capture): 0
> demangled poll:  on capture device
> snd_pcm_avail_update(playback): 320
> demangled poll: POLLOUT  on playback device
> wrote 320 frames
> snd_pcm_avail_update(capture): 320
> demangled poll: POLLIN  on capture device
> read 320 frames
> hexdump(): 640 bytes
> 0000    ff ff ff ff fe ff ff ff ff ff ff ff ff ff ff ff
> 0010    fe ff fe ff ff ff ff ff fe ff ff ff ff ff ff ff
> 0020    ff ff ff ff fe ff ff ff ff ff fe ff ff ff ff ff
> 0030    fe ff fe ff ff ff fe ff fe ff ff ff ff ff fe ff
> 0040    fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> 0050    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> 0060    ff ff fe ff fe ff ff ff ff ff ff ff ff ff ff ff
> 0070    ff ff fe ff fe ff fe ff ff ff ff ff ff ff fe ff
> 0080    fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> 0090    ff ff ff ff ff ff ff ff fe ff fe ff ff ff fe ff
> 00a0    ff ff fe ff fe ff ff ff ff ff ff ff ff ff fe ff
> 00b0    fe ff fe ff fe ff fe ff fe ff fe ff ff ff ff ff
> 00c0    ff ff ff ff ff ff fe ff ff ff ff ff ff ff fe ff
> 00d0    fe ff ff ff fe ff fe ff ff ff ff ff fe ff fe ff
> 00e0    fe ff ff ff fe ff fe ff ff ff ff ff ff ff ff ff
> 00f0    ff ff ff ff fe ff ff ff ff ff ff ff ff ff ff ff
> 0100    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> 0110    ff ff ff ff fe ff ff ff ff ff ff ff ff ff fe ff
> 0120    ff ff ff ff fe ff ff ff ff ff fe ff fe ff ff ff
> 0130    ff ff ff ff ff ff ff ff ff ff fe ff fe ff ff ff
> 0140    fe ff ff ff ff ff fe ff ff ff ff ff fe ff fe ff
> 0150    fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> 0160    ff ff ff ff ff ff fe ff fe ff fe ff ff ff ff ff
> 0170    ff ff ff ff ff ff ff ff ff ff ff ff fe ff fe ff
> 0180    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> 0190    ff ff ff ff ff ff ff ff ff ff fe ff fe ff ff ff
> 01a0    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> 01b0    ff ff ff ff ff ff ff ff fe ff fe ff ff ff ff ff
> 01c0    ff ff ff ff ff ff ff ff ff ff ff ff ff ff fe ff
> 01d0    ff ff ff ff ff ff ff ff fe ff ff ff ff ff ff ff
> 01e0    ff ff fe ff fe ff ff ff ff ff ff ff ff ff ff ff
> 01f0    ff ff ff ff ff ff fe ff fe ff fe ff fe ff fe ff
> 0200    fe ff fe ff fe ff ff ff fe ff ff ff ff ff fe ff
> 0210    fe ff ff ff ff ff ff ff ff ff ff ff fe ff fe ff
> 0220    ff ff ff ff ff ff ff ff ff ff fe ff ff ff ff ff
> 0230    ff ff ff ff ff ff ff ff ff ff ff ff fe ff fe ff
> 0240    fe ff ff ff ff ff ff ff ff ff ff ff ff ff fe ff
> 0250    fe ff fe ff ff ff ff ff ff ff ff ff ff ff ff ff
> 0260    fe ff ff ff ff ff ff ff fe ff ff ff ff ff ff ff
> 0270    ff ff ff ff fe ff ff ff ff ff ff ff ff ff ff ff
>
>
How about the qualtity of the playback ?
did you speak to the mic and hear the result ?

Refer to your pulseaudio log , PA use "front" device for playback/capture
but your test use "hw"

D: alsa-util.c: Trying front:0 with SND_PCM_NO_AUTO_FORMAT ...
I: module-alsa-source.c: Successfully opened device front:0.
I: module-alsa-source.c: Successfully enabled mmap() mode.
I: (alsa-lib)control.c: Invalid CTL front:0
I: alsa-util.c: Unable to attach to mixer front:0: No such file or directory
I: alsa-util.c: Successfully attached to mixer 'hw:0'
I: alsa-util.c: Cannot find mixer control "Capture" or mixer control is
no combination of switch/volume.
I: alsa-util.c: Using mixer control "Mic"

...


sink_name=alsa_output.pci_
1102_4_sound_card_0_alsa_playback_0 tsched=0'
D: alsa-util.c: Trying front:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying front:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:front:0 with SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
D: alsa-util.c: Trying plug:front:0 without SND_PCM_NO_AUTO_FORMAT ...
I: (alsa-lib)setup.c: Cannot lock ctl elem
I: alsa-util.c: PCM device plug:front:0 refused our hw parameters:
Device or resource busy
...
D: alsa-util.c: Trying hw:0 as last resort...
D: alsa-util.c: Trying hw:0 with SND_PCM_NO_AUTO_FORMAT ...
I: module-alsa-sink.c: Successfully opened device hw:0.
I: module-alsa-sink.c: Successfully enabled mmap() mode.
I: alsa-util.c: Successfully attached to mixer 'hw:0'
I: alsa-util.c: Cannot find mixer control "Master" or mixer control is
no combination of switch/volume.
W: alsa-util.c: Cannot find fallback mixer control "PCM" or mixer
control is no combination of switch/volume.
I: alsa-util.c: Using mixer control "PCM".




Do you mean that you suspect the problem is related to alsa-pulse plugin or
PA server ?

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-24 14:38         ` Stefan Schoenleitner
  2010-04-24 23:43           ` Raymond Yau
@ 2010-04-26  1:46           ` Raymond Yau
  2010-04-26  8:19             ` Stefan Schoenleitner
  1 sibling, 1 reply; 19+ messages in thread
From: Raymond Yau @ 2010-04-26  1:46 UTC (permalink / raw)
  To: ALSA Development Mailing List

2010/4/24 Stefan Schoenleitner <dev.c0debabe@gmail.com>

> Raymond Yau wrote:
> >>
> >>
> > Is it possible to post the output of your program when using your sound
> card
> > "hw" since your program failed with XRUN (broken pipe) on my two sound
> cards
> > ?
>
>
> Sure, no problem.
>
> However, I had to change 2 settings to get it working on my soundcard:
>
> * change period size from 160 to 320, as my soundcard does not support a
> period size of 160 frames
>
> * change buffer size from 2 periods (1280 bytes) to 1 period (640
> bytes), as my soundcard only supports a buffersize being equal to one
> period
>
>
> After that the program works fine and runs forever (see below).
>
> I'm looking forward to test it on my embedded target as well (with the
> original settings).
> If required I can post the output of that as well.
>
> cheers,
> stefan
>

Are you sure that you really need pulseaudio since your request latency is
quite low ?

You have to ask PA developer whether PA support such low latecny ?

PA (tsched=0 ) configure your sound card 1792 frames per period but your
application request for 160 frames per period

You will need the PA expert to answer how PA server capture 1792 frames from
sound card and send it to your application

: module-alsa-source.c: Using 2 fragments of size 7168 bytes, buffer
time is 81.27ms

D: alsa-util.c: Its setup is:
D: alsa-util.c:   stream       : CAPTURE
D: alsa-util.c:   access       : MMAP_INTERLEAVED
D: alsa-util.c:   format       : S16_LE
D: alsa-util.c:   subformat    : STD
D: alsa-util.c:   channels     : 2
D: alsa-util.c:   rate         : 44100
D: alsa-util.c:   exact rate   : 44100 (44100/1)
D: alsa-util.c:   msbits       : 16
D: alsa-util.c:   buffer_size  : 3584
D: alsa-util.c:   period_size  : 1792
D: alsa-util.c:   period_time  : 40634
D: alsa-util.c:   tstamp_mode  : ENABLE
D: alsa-util.c:   period_step  : 1
D: alsa-util.c:   avail_min    : 1792
D: alsa-util.c:   period_event : 0
D: alsa-util.c:   start_threshold  : -1
D: alsa-util.c:   stop_threshold   : 8070450532247928832
D: alsa-util.c:   silence_threshold: 0
D: alsa-util.c:   silence_size : 0
D: alsa-util.c:   boundary     : 8070450532247928832



>
>
>
>
>

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-24 23:43           ` Raymond Yau
@ 2010-04-26  7:52             ` Stefan Schoenleitner
  2010-04-27  0:35               ` Raymond Yau
  0 siblings, 1 reply; 19+ messages in thread
From: Stefan Schoenleitner @ 2010-04-26  7:52 UTC (permalink / raw)
  To: Raymond Yau; +Cc: ALSA Development Mailing List

Raymond Yau wrote:
> How about the qualtity of the playback ?
> did you speak to the mic and hear the result ?

Yes, when speaking into the mike I can hear the output on the speakers.
The sound quality is reasonable for 8kHz S16_LE and there are no sound
errors (e.g. no clicks or similar).

> Refer to your pulseaudio log , PA use "front" device for playback/capture

> I: module-alsa-sink.c: Successfully opened device hw:0.
> I: alsa-util.c: Successfully attached to mixer 'hw:0'
> I: alsa-util.c: Using mixer control "PCM".

Here you can see that PA uses the "hw" device.
(It just tries to use the "front" device in the beginning which fails.
The "hw" device is opened successfully after that (see log above).)

> but your test use "hw"

In my tests I first used the "default" device which uses the PA plugin.
The test clearly showed that poll() returns with POLLIN even though far
less than avail_min frames are available for reading.
Hence I suspect that there is a *bug* somewhere in the pulseaudio code
(either the plugin or the daemon).

In order to show that my code is working fine and the erroneous poll
behavior does not occur when PA is not used, I also tested with the "hw"
device.
The result, as mentioned, it that the POLLIN event is correctly returned
after at least avail_min frames are available.

In short:

* test with "default" uses PA: erroneus poll() behavior, BUG
* test with "hw" does *not* use PA: everything works fine


> Do you mean that you suspect the problem is related to alsa-pulse plugin or
> PA server ?

Yes.

cheers,
Stefan

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-26  1:46           ` Raymond Yau
@ 2010-04-26  8:19             ` Stefan Schoenleitner
  2010-04-26 11:10               ` Raymond Yau
  0 siblings, 1 reply; 19+ messages in thread
From: Stefan Schoenleitner @ 2010-04-26  8:19 UTC (permalink / raw)
  To: Raymond Yau; +Cc: ALSA Development Mailing List

Raymond Yau wrote:
> Are you sure that you really need pulseaudio since your request latency is
> quite low ?

You mean the small period_size of 160 frames or rather the buffer size
of 2*period_size?

In fact at 8kHz sampling rate a period_size of 160 equals a full 20ms of
sound:

duration of one frame: 1000ms / 8000Hz = 0.125ms = 125 us
160 frames * 125us = 20000us = 20ms

This is by far more than a large period size holds at a higher sampling
rate (e.g. 44.1 kHz).

To the question whether pulseaudio is needed:
On the embedded target PA will not be used, but since development takes
place on a PC, I need a soundcard that supports the mentioned audio
format contraints.
And at the moment this is pulseaudio which is the reason why I really
need it for application development.


However, we should try to not drift away from the actual problem which
is that *poll() returns an event even if far less than avail_min frames
are available*.


> You have to ask PA developer whether PA support such low latecny ?
> 
> PA (tsched=0 ) configure your sound card 1792 frames per period but your
> application request for 160 frames per period
> 
> You will need the PA expert to answer how PA server capture 1792 frames from
> sound card and send it to your application
> 
> : module-alsa-source.c: Using 2 fragments of size 7168 bytes, buffer
> time is 81.27ms
> 
> D: alsa-util.c: Its setup is:
> D: alsa-util.c:   stream       : CAPTURE
> D: alsa-util.c:   access       : MMAP_INTERLEAVED
> D: alsa-util.c:   format       : S16_LE
> D: alsa-util.c:   subformat    : STD
> D: alsa-util.c:   channels     : 2
> D: alsa-util.c:   rate         : 44100
> D: alsa-util.c:   exact rate   : 44100 (44100/1)
> D: alsa-util.c:   msbits       : 16
> D: alsa-util.c:   buffer_size  : 3584
> D: alsa-util.c:   period_size  : 1792
> D: alsa-util.c:   period_time  : 40634
> D: alsa-util.c:   tstamp_mode  : ENABLE
> D: alsa-util.c:   period_step  : 1
> D: alsa-util.c:   avail_min    : 1792
> D: alsa-util.c:   period_event : 0
> D: alsa-util.c:   start_threshold  : -1
> D: alsa-util.c:   stop_threshold   : 8070450532247928832
> D: alsa-util.c:   silence_threshold: 0
> D: alsa-util.c:   silence_size : 0
> D: alsa-util.c:   boundary     : 8070450532247928832

This is how pulseaudio works *internally*.
Hence it opens my hardware sound card "hw" with the above format.
If sound it recorded/played back at a different sampling rate, PA
converts it.
If you play a prerecorded audio file that has been recorded at a
different sampling rate, you can see that behavior.

What happens is:

[sound application (e.g.. aplay)] ---(audio format of sound file)---> [
PA plugin] --> [PA daemon] ---(audio format of PA)--> [soundcard]

cheers,
stefan

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-26  8:19             ` Stefan Schoenleitner
@ 2010-04-26 11:10               ` Raymond Yau
  0 siblings, 0 replies; 19+ messages in thread
From: Raymond Yau @ 2010-04-26 11:10 UTC (permalink / raw)
  To: ALSA Development Mailing List

2010/4/26 Stefan Schoenleitner <dev.c0debabe@gmail.com>

> Raymond Yau wrote:
> > Are you sure that you really need pulseaudio since your request latency
> is
> > quite low ?
>
> You mean the small period_size of 160 frames or rather the buffer size
> of 2*period_size?
>
> In fact at 8kHz sampling rate a period_size of 160 equals a full 20ms of
> sound:
>
> duration of one frame: 1000ms / 8000Hz = 0.125ms = 125 us
> 160 frames * 125us = 20000us = 20ms
>
> This is by far more than a large period size holds at a higher sampling
> rate (e.g. 44.1 kHz).
>

But the period time of your sound card is 40.634ms which is more than double
of your requested 20ms

D: alsa-util.c:   rate         : 44100
D: alsa-util.c:   exact rate   : 44100 (44100/1)
D: alsa-util.c:   msbits       : 16
D: alsa-util.c:   buffer_size  : 3584
D: alsa-util.c:   period_size  : 1792
D: alsa-util.c:   period_time  : 40634


>
> To the question whether pulseaudio is needed:
> On the embedded target PA will not be used, but since development takes
> place on a PC, I need a soundcard that supports the mentioned audio
> format contraints.
> And at the moment this is pulseaudio which is the reason why I really
> need it for application development.
>
>
> However, we should try to not drift away from the actual problem which
> is that *poll() returns an event even if far less than avail_min frames
> are available*.
>
>
> > You have to ask PA developer whether PA support such low latecny ?
> >
> > PA (tsched=0 ) configure your sound card 1792 frames per period but your
> > application request for 160 frames per period
> >
> > You will need the PA expert to answer how PA server capture 1792 frames
> from
> > sound card and send it to your application
> >
> > : module-alsa-source.c: Using 2 fragments of size 7168 bytes, buffer
> > time is 81.27ms
> >
> > D: alsa-util.c: Its setup is:
> > D: alsa-util.c:   stream       : CAPTURE
> > D: alsa-util.c:   access       : MMAP_INTERLEAVED
> > D: alsa-util.c:   format       : S16_LE
> > D: alsa-util.c:   subformat    : STD
> > D: alsa-util.c:   channels     : 2
> > D: alsa-util.c:   rate         : 44100
> > D: alsa-util.c:   exact rate   : 44100 (44100/1)
> > D: alsa-util.c:   msbits       : 16
> > D: alsa-util.c:   buffer_size  : 3584
> > D: alsa-util.c:   period_size  : 1792
> > D: alsa-util.c:   period_time  : 40634
> > D: alsa-util.c:   tstamp_mode  : ENABLE
> > D: alsa-util.c:   period_step  : 1
> > D: alsa-util.c:   avail_min    : 1792
> > D: alsa-util.c:   period_event : 0
> > D: alsa-util.c:   start_threshold  : -1
> > D: alsa-util.c:   stop_threshold   : 8070450532247928832
> > D: alsa-util.c:   silence_threshold: 0
> > D: alsa-util.c:   silence_size : 0
> > D: alsa-util.c:   boundary     : 8070450532247928832
>
> This is how pulseaudio works *internally*.
> Hence it opens my hardware sound card "hw" with the above format.
> If sound it recorded/played back at a different sampling rate, PA
> converts it.
> If you play a prerecorded audio file that has been recorded at a
> different sampling rate, you can see that behavior.
>

After the sound driver capture  40.634 ms of audio , PA have to convert the
44100Hz stereo to 8000Hz mono

seem just add left + right to mono without halve the sum , you may hear
clipping if you are using line in instead of mic or PA clamp the output

D: resampler.c: Channel matrix:
D: resampler.c:        I00   I01
D: resampler.c:     +------------
D: resampler.c: O00 | 1.000 1.000



> What happens is:
>
> [sound application (e.g.. aplay)] ---(audio format of sound file)---> [
> PA plugin] --> [PA daemon] ---(audio format of PA)--> [soundcard]
>
> cheers,
> stefan
>

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

* Re: "Resource temporarily unavailable" while reading although poll returns POLLIN event
  2010-04-26  7:52             ` Stefan Schoenleitner
@ 2010-04-27  0:35               ` Raymond Yau
  0 siblings, 0 replies; 19+ messages in thread
From: Raymond Yau @ 2010-04-27  0:35 UTC (permalink / raw)
  To: ALSA Development Mailing List

2010/4/26 Stefan Schoenleitner <dev.c0debabe@gmail.com>

> :
>
> In my tests I first used the "default" device which uses the PA plugin.
>
The test clearly showed that poll() returns with POLLIN even though far
>
less than avail_min frames are available for reading.
> Hence I suspect that there is a *bug* somewhere in the pulseaudio code
> (either the plugin or the daemon).
>
> In order to show that my code is working fine and the erroneous poll
> behavior does not occur when PA is not used, I also tested with the "hw"
> device.
> The result, as mentioned, it that the POLLIN event is correctly returned
> after at least avail_min frames are available.
>
> In short:
>
> * test with "default" uses PA: erroneus poll() behavior, BUG
> * test with "hw" does *not* use PA: everything works fine
>
>
http://0pointer.de/blog/projects/guide-to-sound-apis.html

Most likely , the PA developer will tell you

Do *not* touch buffering/period metrics unless you have specific latency
needs. Develop defensively, handling correctly the case when the backend
cannot fulfill your buffering metrics requests. Be aware that the buffering
metrics of the playback buffer only indirectly influence the overall latency
in many cases. i.e. setting the buffer size to a fixed value might actually
result in practical latencies that are much higher.

Do *not* assume that the time when a PCM stream can receive new data is
strictly dependant on the sampling and buffering parameters and the
resulting average throughput. Always make sure to supply new audio data to
the device when it asks for it by signalling "writability" on the fd. (And
similarly for capturing)



>
> > Do you mean that you suspect the problem is related to alsa-pulse plugin
> or
> > PA server ?
>
> Yes.
>
> cheers,
> Stefan
>

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

end of thread, other threads:[~2010-04-27  0:35 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-21 11:28 "Resource temporarily unavailable" while reading although poll returns POLLIN event Stefan Schoenleitner
2010-04-21 16:15 ` Stefan Schoenleitner
2010-04-21 17:18   ` Jaroslav Kysela
2010-04-22 10:09     ` Stefan Schoenleitner
2010-04-23  4:10       ` Raymond Yau
2010-04-24  1:32       ` Raymond Yau
2010-04-24 14:38         ` Stefan Schoenleitner
2010-04-24 23:43           ` Raymond Yau
2010-04-26  7:52             ` Stefan Schoenleitner
2010-04-27  0:35               ` Raymond Yau
2010-04-26  1:46           ` Raymond Yau
2010-04-26  8:19             ` Stefan Schoenleitner
2010-04-26 11:10               ` Raymond Yau
2010-04-22  4:28   ` Raymond Yau
2010-04-22 10:49     ` Stefan Schoenleitner
2010-04-23  7:45       ` Raymond Yau
2010-04-23 11:16         ` Stefan Schoenleitner
2010-04-22  2:41 ` Raymond Yau
2010-04-22 10:15   ` Stefan Schoenleitner

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.