[alsa-devel] Fixing snd_pcm_indirect_playback_transfer to support rewinds?

Floris Bos bos at je-eigen-domein.nl
Tue Jan 2 13:10:14 CET 2018


Hi,


I am been having problems using Pulse Audio on the Raspberry Pi for 
quite a while, in which audio stops playing if two programs want to play 
through Pulse simultaneously.

Or if one program already has finished playing, but you start the second 
within 5 seconds.

Thinking that was a problem in the snd_bcm2835 module, I created an 
issue in the github repo that houses the Raspberry Pi kernel fork about 
it in 2014: https://github.com/raspberrypi/linux/issues/688


However I now have the impression the problem is not in their module 
specific code, but that snd_pcm_indirect_playback_transfer() which the 
module uses, doesn't deal with rewinds correctly, which Pulse uses 
extensively.

Is there any effort being done to fix this?


I came across the "ALSA: pcm: Fix negative appl_ptr handling in 
pcm-indirect helpers" patch in this mailing list, so apparently the 
problem does is known to you guys.

However looking at this fragment of the patch:

==

+static inline int
  snd_pcm_indirect_playback_transfer(struct snd_pcm_substream *substream,
                     struct snd_pcm_indirect *rec,
                     snd_pcm_indirect_copy_t copy)
@@ -56,6 +56,8 @@ snd_pcm_indirect_playback_transfer(struct 
snd_pcm_substream *substream,
      if (diff) {
          if (diff < -(snd_pcm_sframes_t) (runtime->boundary / 2))
              diff += runtime->boundary;
+        if (diff < 0)
+            return -EINVAL;
==

It seems it is simply denying rewinds instead of making them work?
Isn't there any way to make them work, instead of disabling 
functionality userspace seems to be expecting to have?


Yours sincerely,

Floris Bos



More information about the Alsa-devel mailing list