- Package:
- alsa-utils
- Source:
- alsa-utils
- Description:
- Utilities for configuring and using ALSA
- Submitter:
- "Jean-Michel Vourgère"
- Date:
- 2015-12-29 02:09:06 UTC
- Severity:
- minor
I'm using arecord|aplay to play audio from an usb device with that command: arecord --buffer-size=256 -r 44000 -D iec958:CARD=default,DEV=0 -f S16_LE | aplay --buffer-size=256 -D default:CARD=Intel I'm occasionnaly get errors like these: overrun!!! (at least 0.164 ms long) overrun!!! (at least 0.028 ms long) overrun!!! (at least 0.396 ms long) underrun!!! (at least 881192365.673 ms long) overrun!!! (at least 0.147 ms long) overrun!!! (at least 0.049 ms long) overrun!!! (at least 0.150 ms long) overrun!!! (at least 0.149 ms long) underrun!!! (at least 881195367.756 ms long) ... I'm filling this bug only about the underrun error message: I don't think I have a 24 hours buffer with just 256 bytes. There probably is an unsigned/signed error somewhere...
When I changed the output message to:
fprintf(stderr, "%s!!! (at least %.3f ms long)\n%ld %ld %ld %ld\n",
stream == SND_PCM_STREAM_PLAYBACK ? _("underrun") : _("overrun"),
diff.tv_sec * 1000 + diff.tv_nsec / 1000000.0,
now.tv_sec, now.tv_nsec,
tstamp.tv_sec, tstamp.tv_nsec);
I get
underrun!!! (at least -2060492640.061 ms long)
135594 763755290 1329340981 867816000
underrun!!! (at least -2060492647.179 ms long)
135594 856280045 1329340981 967459000
underrun!!! (at least -2060492639.984 ms long)
135594 955783710 1329340982 59768000
I have monotonic = 1 here.
We can see the 2 clocks are totally out of sync.
Why are we using clock_gettime(CLOCK_MONOTONIC, &now) while we have a nice
snd_pcm_status_get_htstamp function?
Attached is a patch.