[linux-audio-dev] XRuns and Low-Latency

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] XRuns and Low-Latency
From: René Rebe (rene.rebe_AT_gmx.net)
Date: Mon Aug 06 2001 - 14:55:21 EEST


Hi all.

I have a problem during 10 channel, full-duplex IO using ALSA 0.9-beta6 and a Midimann Delta 1010. (Linux 2.4.7-low-latency, AMD Athlon 600Mhz, 256MB RAM)

I use my own program (which BTW will be releases in a .01v in some weeks) which does this (+some other bits +the same for capture - C++ methos from my ALSA-wrapper ...):

Open (cname, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)
SetAccess (SND_PCM_ACCESS_RW_INTERLEAVED)
SetFormat (SND_PCM_FORMAT_S16_LE)
SetBufferTimeNear (400000)
SetPeriodTimeNear (400000 / 4)

Using the plug layer I get this setup:
min_ch: 10
max_ch: 10
min_rate: 44100
max_rate: 44100
period_size: 2730
buffer_size: 6553
periods: 2

Then I use normal ReadI / WriteI to pass the data to ALSA.

I works pretty well, except after 20-30 seconds I get many XRuns every 1 - 2 seconds. They happen everytime Linux decides to flush the data in the disc-cache. (I have a IBM 30gig IDE disk (yes in UDMA66 mode ...) with an ReiserFS on it.)

To check if this guess was right I used my NFS mounted Server (100MBit, K6-2 200, 32MB Ram, slower IDE drives ...) to store the data - and I nearly never got XRUns (even having a laptop logged in, GNOME 2x, Konqui 2x, XEmacs 2x and a GCC compiling) ... .

Also this hack reduces the XRUNs to zero:
while true; do echo "syncing ..."; sync; sleep 1; done

So: Has someone some advices what to do better (or even to set via sysctl) ...

I know that using hw:0 and SND_PCM_FORMAT_S32_LE would same some converting time ... . Are there some tipps using ALSA and or multi-channles cards better ?? (MMap wouldn't save much here, would it??)

And another question to ALSA:
Would it be possible to return better values for:

snd_pcm_hw_params_get_channels_min / max
snd_pcm_hw_params_get_rate_min / max

when the plug layer is used?:
min_ch: 1
max_ch: 1073741823
min_rate: 1
max_rate: -1

This way the users has to enter how many channels he want's to have. And I have no possibility to check the count or provide meaningfull defaults or selectable ranges for the card ... - and using the hw:x directly I have to provide all format convertions myself ...

Thanks a lot
René

-- 
René Rebe (Registered Linux user: #127875)

eMail: rene.rene_AT_gmx.net rene.rebe_AT_rocklinux.org

Homepage: http://www.rene.rebe.myokay.net/

Anyone sending unwanted advertising e-mail to this address will be charged $25 for network traffic and computing time. By extracting my address from this message or its header, you agree to these terms.


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Mon Aug 06 2001 - 14:57:13 EEST