[alsa-devel] Warning/error from ALSA’s pcm_min.c example. Possible problem?
Raymond Yau
superquad.vortex2 at gmail.com
Fri Oct 29 05:49:29 CEST 2010
>> 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=2e48439ad93f6c8d99a2d72928ac71285b5211bb <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
More information about the Alsa-devel
mailing list