Hi, I just checked ubuntu was applied patch which you mentioned. > alsa-plugins (1.0.17-0ubuntu5) intrepid-proposed; urgency=low > > * debian/patches/pulse_recording_fix.patch: pa_stream_trigger() > returns > NULL for capture, so test for it first. Spotted by Takashi Iwai > and > acked by Lennart Poettering. > * LP: #282316 - erratic elapsed time count in "sound recorder" > https://bugs.launchpad.net/ubuntu/+bug/282316 > > -- Daniel T Chen <crimsun at ubuntu.com> Mon, 27 Oct 2008 00:14:00 > -0400 and I upgraded to 1.0.17-0ubuntu5, then -5 I/O error has gone. :-) but, still there is a problem, and it looks related with pulseaudio Before using pulseaudio my recording program works well... I know my source is not good code, but I want to know, what I have to pay attention when backend of sound system is pulseaudio? I use alsa lib to recording from input device, so I made linux_audio_capture() function. When I use snd_pcm_readi() function, the program is aborted or terminated cause of segmentation fault. > audio_linux_capture() > -> snd_pcm_readi() > -> ...(?)... > -> pulse_poll_activate() > -> write() <- crash! gdb tells... > (gdb) thread 6 > [Switching to thread 6 (Thread 0xb57e9b90 (LWP 11361))]#0 0xb7ff4430 in __kernel_vsyscall () > (gdb) bt > #0 0xb7ff4430 in __kernel_vsyscall () > #1 0xb77d53bb in write () from /lib/tls/i686/cmov/libc.so.6 > #2 0xb4f8d796 in pulse_poll_activate () from /usr/lib/alsa-lib/libasound_module_pcm_pulse.so > #3 0xb4f8be8f in ?? () from /usr/lib/alsa-lib/libasound_module_pcm_pulse.so > #4 0xb4f8c01d in ?? () from /usr/lib/alsa-lib/libasound_module_pcm_pulse.so > #5 0xb78f2201 in ?? () from /usr/lib/libasound.so.2 > #6 0xb78ae0d0 in ?? () from /usr/lib/libasound.so.2 > #7 0xb78f2465 in ?? () from /usr/lib/libasound.so.2 > #8 0xb78a8544 in snd_pcm_readi () from /usr/lib/libasound.so.2 > #9 0x0805e641 in audio_linux_capture (handle=0x979ee00) at audio_linux.c:720 > #10 0x0805c07c in audio_do_thread_work (data=0x97cd648, user_data=0xb57e933c) at audio.c:474 > #11 0x0805c1d0 in audio_thread_func (data=0x0) at audio.c:514 > #12 0xb799b02f in ?? () from /usr/lib/libglib-2.0.so.0 > #13 0xb75f350f in start_thread () from /lib/tls/i686/cmov/libpthread.so.0 > #14 0xb77e57ee in clone () from /lib/tls/i686/cmov/libc.so.6 > (gdb) my audio_linux_capture() function looks like: > static int > audio_linux_capture (void *handle) > { > AudioLinux *al = handle; > snd_pcm_uframes_t frames; > int err, worked; > > worked = 0; > > if (!al->first) > { > /* is it time for reading? */ > err = audio_linux_wait_poll (al); > if (err < 0) > { > if (snd_pcm_state (al->handle) == SND_PCM_STATE_XRUN || > snd_pcm_state (al->handle) == SND_PCM_STATE_SUSPENDED) > { > err = snd_pcm_state (al->handle) == SND_PCM_STATE_XRUN ? -EPIPE : -ESTRPIPE; > if (audio_linux_xrun_recovery (al, err) < 0) > { > log_warning (NULL, "write error: %s", snd_strerror (err)); > return worked; > } > al->first = 1; > } > else if (snd_pcm_state (al->handle) == SND_PCM_STATE_RUNNING) > { > /* nothing to do */ > } > else > { > log_debug (NULL, "failed to wait poll"); > return worked; > } > } > > /* nothing to do yet */ > if (!err) > return worked; > } > > al->frame->len = 0; > al->frame_offset = 0; > > capture_loop: > > /* read it now */ > if (0) log_debug (NULL, "bytes: %d", err * al->bytes_per_frame); > err = snd_pcm_readi (al->handle, al->frame->data, frames); > if (err < 0) > { > if (1) log_debug (NULL, "err: %d", err); > if (audio_linux_xrun_recovery (al, err) < 0) > { > if (err != -EAGAIN) > log_warning (NULL, "failed to read: %s", snd_strerror (err)); > } > al->first = 1; > return worked; > } > > if (snd_pcm_state (al->handle) == SND_PCM_STATE_RUNNING) > al->first = 0; > > if (!err) > return worked; > > al->frame->len = err * al->bytes_per_frame; > > if (al->capture_callback) > al->capture_callback (al->frame, al->capture_callback_data); > > ++worked; > > goto capture_loop; > } Thanks, -- Best Regards, Keedi Kim 2008/10/17 Colin Guthrie <gmane at colin.guthr.ie> > Keedi Kim wrote: > > Hi. > > > > I followed PerfectSetup of pulseaudio wiki, > > then aplay works well, but arecord doesn't. > > ALSA's arecord terminates with > > "pcm_read:1473: read error: Input/output error" message. > > > > Does anybody has idea? > > I know you've said that the package is using 1.0.17 but there is a > chacne that the Ubuntu package updated the pulse plugin to the latest > version in git (from the 1.0.18rc3 tree). > > If this is the case, then Takashi found a problem with recording via > alsa with these recently on the alsa Mailing list. > > Lennart has yet to ACK this and an earlier message on the Alsa mailing > list from a couple weeks back (unless he's done so privately to Takashi) > so I'm guessing he's a little behind on things right now. > > In lieu of an ACK from Lennart, it may be worth trying out the patch > from Takashi. > > http://thread.gmane.org/gmane.linux.alsa.devel/56875 > > I'd also like to know if it works (not had a moment to try yet) so I can > issue an update package for this. > > Col > > -- > > Colin Guthrie > gmane(at)colin.guthr.ie > http://colin.guthr.ie/ > > Day Job: > Tribalogic Limited [http://www.tribalogic.net/] > Open Source: > Mandriva Linux Contributor [http://www.mandriva.com/] > PulseAudio Hacker [http://www.pulseaudio.org/] > Trac Hacker [http://trac.edgewall.org/] > > _______________________________________________ > pulseaudio-discuss mailing list > pulseaudio-discuss at mail.0pointer.de > https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20081104/71f0b7ae/attachment.htm>