[alsa-devel] noise and consume pcm faster
Hi, I found a strange issue that ALSA consume pcm data faster than normal. Does any one had come across it?
When I sychronize video frame against audio, the video thread will check how much pcm data has been written to ALSA API but has not been fetched by DMA. This query causes ALSA consume pcm data faster than normal, noise appears too. A stream that is 131 seconds will playback just 112 seconds. It only appears when audio is stereo and sampling rate is directly supported by hardware.
This bug can be reproduced with aplay. To reproduce it with aplay, you just need to add a thread and query the ALSA latency 20~30times every second.
My system: XSCALE PXA300/zylonite, Linux2.6.25, alsa-lib-1.0.13(I tried alsa-lib-1.0.17, bugs too), codec: wm9713. Linux2.6.14 has this issue too, but I did not find it in 2.6.21 and 2.6.24.
Does anyone has idea about it? Thanks!
Jun Nie
In addition, OSS API emulated by ALSA has not this issue.
2008/9/2 Nie Jun niej0001@gmail.com:
Hi, I found a strange issue that ALSA consume pcm data faster than normal. Does any one had come across it?
When I sychronize video frame against audio, the video thread will check how much pcm data has been written to ALSA API but has not been fetched by DMA. This query causes ALSA consume pcm data faster than normal, noise appears too. A stream that is 131 seconds will playback just 112 seconds. It only appears when audio is stereo and sampling rate is directly supported by hardware.
This bug can be reproduced with aplay. To reproduce it with aplay, you just need to add a thread and query the ALSA latency 20~30times every second.
My system: XSCALE PXA300/zylonite, Linux2.6.25, alsa-lib-1.0.13(I tried alsa-lib-1.0.17, bugs too), codec: wm9713. Linux2.6.14 has this issue too, but I did not find it in 2.6.21 and 2.6.24.
Does anyone has idea about it? Thanks!
Jun Nie
At Tue, 2 Sep 2008 17:40:01 +0800, Nie Jun wrote:
In addition, OSS API emulated by ALSA has not this issue.
If so, the possible reason is the mismatch of the PCM parameters. For example, unless specified, the driver allows unaligned size of periods in a buffer, i.e. the number of periods in a buffer doesn't have to be an interger. Such a constraint can be put additionally in the driver code if needed.
Check /proc/asound/card0/pcm0p/sub0/* files during playbacks on both ALSA and OSS apps and compare the parameters there.
Takashi
2008/9/2 Nie Jun niej0001@gmail.com:
Hi, I found a strange issue that ALSA consume pcm data faster than normal. Does any one had come across it?
When I sychronize video frame against audio, the video thread will check how much pcm data has been written to ALSA API but has not been fetched by DMA. This query causes ALSA consume pcm data faster than normal, noise appears too. A stream that is 131 seconds will playback just 112 seconds. It only appears when audio is stereo and sampling rate is directly supported by hardware.
This bug can be reproduced with aplay. To reproduce it with aplay, you just need to add a thread and query the ALSA latency 20~30times every second.
My system: XSCALE PXA300/zylonite, Linux2.6.25, alsa-lib-1.0.13(I tried alsa-lib-1.0.17, bugs too), codec: wm9713. Linux2.6.14 has this issue too, but I did not find it in 2.6.21 and 2.6.24.
Does anyone has idea about it? Thanks!
Jun Nie
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
participants (2)
-
Nie Jun
-
Takashi Iwai