[alsa-devel] snd_pcm_writei 0 frames

Giuliano Zannetti - ART S.p.A. giuliano.zannetti at artgroup-spa.com
Mon Mar 25 15:16:17 CET 2019


Hi,

I've the following configuration in my asound.conf:

|-----| - - > |-----| - - > |-----| - - > |-----| - - > |-----| - - > |----------|
|plug |       |     | - - > |     | - - > |     | - - > |     | - - > | (output) |
|-----| - - > |     | - - > |     | - - > |     | - - > |     | - - > |    hw    |
              |     | - - > |     | - - > |     | - - > |     | - - > |          |
              |     |       |     |       |route| - - > |dmix | - - > |          |
              |     |       |     |       |     | - - > |     | - - > |          |
              |     |       |     |       |     | - - > |     | - - > |          |
              |     |       |     |       |-----| - - > |-----| - - > |----------|
              |route|       |multi|
              |     | - - > |     |
              |     | - - > |     | - - > |----| - - > |----| - - > |----------|
              |     | - - > |     | - - > |    | - - > |    | - - > |(loopback)|
              |-----| - - > |     | - - > |plug| - - > |dmix| - - > |    hw    |
                            |-----| - - > |----| - - > |----| - - > |----------|

As you can see I'm using a loopback interface.
I open the pcm plug in the block mode to write.

writtenFrames = snd_pcm_writei(handle, bufferToWrite, bufferToWriteSize);

Using the configuration above I have several "writes" with 0 written frames.
It seems like the snd_pcm_writei does not hold until data will be written.

In general, 0 written frames sounds weird to me, because snd_pcm_writei should block itself if no space is available in the circular buffer right?

So, my questions are two:

  1.  Writing 0 frames is an expected behaviour (regardless of my configuration in the asound.conf)? In what scenarios can I have that?
  2.  How my configuration could trigger this behaviour?

Best Regards
Giuliano Zannetti


More information about the Alsa-devel mailing list