I am using alsa
in arm linux 3.10. There are 3 wireless devices: two capture and send pcm using snd_pcm_readi
and sendmsg
and one as receiver, playback what was received using snd_pcm_writei
.
Here is procedure:
programs works fine while 1 sender and 1 receiver. But when I stop first sender and start the second sender, receiver side has underrun error. For each sender, receiver has a unique pcm handle to deal with data. And all sides are using the same configuration except sender handle open with name default[snd_pcm_open(pcm_handle, "default", stream,0)]
and receiver handle are using plug:dmix
.[snd_pcm_open(pcm_handle, "plug:dmix", stream,0)]
while(1)
{
recv_from();
if sender one or two's first packet
alsa init handle1 or handle2
int err = snd_pcm_writei(handle1 or 2, buffer, 224);
if(err == -EPIPE)
{
fprintf(stderr, "underrun occurred\n");
snd_pcm_prepare(handle);
continue;
}
}
The purpose is to make the receiver be able to play mixed sound for both senders. Can anyone help me with this, I am new to alsa
programming. Thanks in advance!