alsa-lib icon indicating copy to clipboard operation
alsa-lib copied to clipboard

pcm: snd_pcm_readi - plugin type multi, the overun appears when read

Open ouwenchen opened this issue 4 years ago • 5 comments

After type route use type multi, merge the two input streams.There was PCM error due to insufficient readable data.Cause the underlying read pointer cannot be updated, and then it will be overrun.

ouwenchen avatar Nov 26 '20 13:11 ouwenchen

Could you elaborate a bit more what does not work? The snd_pcm_mmap_begin() also limits the number of frames.

perexg avatar Apr 13 '21 17:04 perexg

When I use plugin type multi. Like this: pcm.multi_plan_c0 { type multi slaves.a.pcm "hw:0,0" slaves.a.channels 2 slaves.b.pcm "hw:0,2" slaves.b.channels 8 bindings.0.slave b bindings.0.channel 0 bindings.1.slave b bindings.1.channel 1 bindings.2.slave b bindings.2.channel 7 bindings.3.slave b bindings.3.channel 3 bindings.4.slave b bindings.4.channel 2 bindings.5.slave b bindings.5.channel 4 bindings.6.slave b bindings.6.channel 5 bindings.7.slave a bindings.7.channel 0 } avail = snd_pcm_mmap_avail(pcm); //This is not the minimum avail value of the two HW PCM's snd_pcm_mmap_commit(); //Error due to lack of readable data. Causes the underlying read pointer to be unable to be updated, and then it will overrun.

ouwenchen avatar Apr 15 '21 09:04 ouwenchen

avail = snd_pcm_mmap_avail(pcm); //This is not the minimum avail value of the two HW PCM's

The hw_ptr in the pcm multi plugin should track the minimal hw_ptr updates from slave PCMs (see snd_pcm_multi_hwptr_update function). If snd_pcm_mmap_avail for the multi PCM is not returning the right values, this update failed somewhere.

perexg avatar Apr 15 '21 10:04 perexg

So it needs to be update snd_pcm_multi_hwptr_update function to solve this problem?

ouwenchen avatar Apr 16 '21 08:04 ouwenchen

Yes, I'd prefer a fix in pcm_multi.c .

perexg avatar Apr 16 '21 08:04 perexg