On Fri, 25 Jan 2002, Matthew Fredrickson wrote: > Hey all, > > I'm working on writing a channel driver for a program called asterisk > (It's an open source PBX) that the driver will use alsa. > > It's been an interesting experience learning alsa, thanks to all who've > worked on it; It's API is pretty straightforward, though I haven't done > any sound programming before this. > > The circumstance is this: It's a full duplex application so to speak, but > I don't have control over what order it does reads/writes, etc. I'm only > basically writing plugin functions for the asterisk channel > interface. Writes and reads are done in mostly 160 byte (80 > sample, 16bit S-linear) chunks. Also, it's very possible that sometimes > writes and reads don't come in for extended periods of time (VoIP packeted > data), so it's not a situation where I know I'm going to get data > immediately, as opposed to if I was just reading a file or something like > that. > > The first thing I came up with sounded really bad. XRUNs all over the > place, etc. > > I started playing around with various parameters, buffer size, start > threshold, stuff like that, and it's improved a little bit, but I'm not > exactly sure why playing around with them has improved it. > > The Problem: > Now I'm at a point where it sounds really good for a few minutes, a > couple of XRUNS every now and then, and then just about perfect for a > while. After it has done this, it gets to a point where I rapidly start > getting more and more XRUNS, and eventually that's about the only thing it > gets. Boom. No more audio. Arrghhh! :-D
It sound like a problems with bad restarting of a stream. Try to set start_threshold to buffer_size (it's maximum value). In the case, the stream is started when the whole ring buffer is filled. It causes a bit worse latency but a good xrun protection. Jaroslav ----- Jaroslav Kysela <[EMAIL PROTECTED]> SuSE Linux http://www.suse.com ALSA Project http://www.alsa-project.org _______________________________________________ Alsa-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-devel