Skip to contentSkip to conversation

Playback in infinitely loop - bug in alsa-jack-plugins?

DISCUSSION Valentin Corfu 1 participant 1 message Jan 16, 2015

lore
Share & tools
lore
#0 lore raw

Hello guys,

Few days ago I have started to look over a new challenging issue with alsa..
The problem is that the sound entry in a loop infinitely and it seems that the last samples in the buffer are just repeated over and over again. This behaviour it happens when I have too less and only sporadically data ready to be playbacked on my embedded system configured with alsa jack pcm plugin.

To solve this issue, (I don't want to use snd_pcm_drain()), I see 2 ways:
1) to clear(or overwrite with silence) the "just played" frames
from the ring buffer
2) when I am in this situation, to gracefully stop/close the alsa
opened port

In both situations I have tried without success, _set_silence_threshold(), set_stop_threshold and other googled solutions..

More over, I also tested with "default" device and the result is as expected... the sound can be hear just once, then it's going into underrun state.

I also created a small test(based on pcm_min.c example), where I intentionally put a ~1s(can be more) delay after _writei() function, to see the issue reproduced. (http://pastebin.com/4KyUG0BA)

log with pcm jack plugin: http://pastebin.com/MtKQ4ASz
log with "default": http://pastebin.com/G0zq6fmJ

Now I'm suspecting one issue with the underrun, over alsa jack plugin...

(In case I'm not wrong with the test case or my assumption..)
- Isn't it implemented underrun detection over jack plugin or it is a
new bug here?

Best Regards,
Valentin Corfu