Re: [alsa-devel] Warning/error from ALSA’s pcm_min.c example. Possible problem?
On Sat, 30 Jan 2010, Louise Hoffman wrote:
Dear ALSA developers,
When I compile ALSA's pcm_min.c[0] example with
gcc -Wall -lasound pcm_min.c -o pcm_min
Everything is fine, but running it, I get the white noise as expected, but I also get this warning/error:
Short write (expected 16384, wrote 7616)
It was a bug in alsa-lib. I fixed it in patch bellow. Thank you for your report.
http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=2e48439ad93f6c8d9... http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=2e48439ad93f6c8d99a2d72928ac71285b5211bb
Add snd_pcm_dump() after call snd_pcm_set_params in pcm_min.c
The start threshold is equal to buffer size , so there should be a short write at the second write since 16384 + 7616 = 24000 ( start threshold )
your patch had changed the behaviour
./pcm_min ALSA <-> PulseAudio PCM I/O Plugin Its setup is: stream : PLAYBACK access : RW_INTERLEAVED format : U8 subformat : STD channels : 1 rate : 48000 exact rate : 48000 (48000/1) msbits : 8 buffer_size : 24000 period_size : 6000 period_time : 125000 tstamp_mode : NONE period_step : 1 avail_min : 6000 period_event : 0 start_threshold : 24000 stop_threshold : 24000 silence_threshold: 0 silence_size : 0 boundary : 1572864000 state = 2 write 16384 frames state = 2 write 16384 frames state = 3 write 16384 frames state = 3 write 16384 frames state = 3
On Fri, 29 Oct 2010, Raymond Yau wrote:
On Sat, 30 Jan 2010, Louise Hoffman wrote:
Dear ALSA developers,
When I compile ALSA's pcm_min.c[0] example with
gcc -Wall -lasound pcm_min.c -o pcm_min
Everything is fine, but running it, I get the white noise as expected, but I also get this warning/error:
Short write (expected 16384, wrote 7616)
It was a bug in alsa-lib. I fixed it in patch bellow. Thank you for your report.
http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=2e48439ad93f6c8d9... http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=2e48439ad93f6c8d99a2d72928ac71285b5211bb
Add snd_pcm_dump() after call snd_pcm_set_params in pcm_min.c
The start threshold is equal to buffer size , so there should be a short write at the second write since 16384 + 7616 = 24000 ( start threshold )
your patch had changed the behaviour
The pcm_min uses the blocked mode, so all layers tries to queue all given samples and wait for the ring buffer.
buffer_size : 24000 start_threshold : 24000
state = 2 write 16384 frames state = 2 write 16384 frames state = 3
This looks correct.
Jaroslav
----- Jaroslav Kysela perex@perex.cz Linux Kernel Sound Maintainer ALSA Project, Red Hat, Inc.
Dear ALSA developers, I'm trying to port ALSA to MIPS/Linux because I want my platform more compatible to the 3rd party's software which is beased on ALSA lib. Now I have 2 choices, 1. The board's SDK already have a complete interface of sound on user space, so I only need port alsa library beased on current SDK's interface. 2. porting both alsa library and alsa driver, and make current SDK's sound interface works in kernal space. If it's very easy to make current SDK's sound interface works in kernal space, which choice is better and which need less time to complete to a new alsa developer? I'm waiting for your reply. Best regards, Chen Jingyu
participants (3)
-
chenjingy@sohu.com
-
Jaroslav Kysela
-
Raymond Yau