2009/12/3 Devin Heitmueller <dheitmueller@xxxxxxxxxxxxxx>: > I am working on a very basic application that reads a capture device > and outputs to a playback device. It's what you would traditionally > accomplish with something like the following: > > arecord -D hw:1,0 -r 48000 -c 2 -f S16_LE | aplay - > > However, in this case, since the final result will be part of a TV > watching application, I need to maintain less than 30ms of latency to > preserve lipsync. > > The application I ended up with essentially creates two PCM streams > (one for capture, one for playback), sets them up with the same > parameters in terms of rate, format, channels, etc., and then has a > loop of snd_pcm_readi() and snd_pcm_writei() calls. > > The application works, except I am getting a considerable amount of > underruns on the playback device. > > Given my relative inexperience with alsa-lib, I suspect that I have > misconfigured one of the parameters effecting buffering - buffer size, > buffer time, period size, period time. > > Can anyone offer any constructive suggestions or tips on what these > tuning parameters should be set to for a continuous 48000Khz, 2 > channel stream of audio? Also, should the buffering configuration > really be the same for both the capture and playback stream, or do I > need to play some games such that one requires more/less buffering > than the other? I don't have much experience myself, but in such a situation I would recommend either increasing buffer size, or linking capture and playback devices with snd_pcm_link(). _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel