On Sun, Feb 18, 2024 at 02:24:33AM +0000, Klemens Nanni wrote:
> Playback-only (default) works, record-only crashes:
>       $ pulseaudio --dameonize=false -n --load='module-sndio playback=false 
> record=true'
>       W: [(null)] pid.c: Stale PID file, overwriting.
>       Segmentation fault
> 
>       0x000000129050312f in pa_bytes_to_usec () from 
> /usr/local/lib/pulseaudio/libpulsecommon-17.0.so
>       #0  0x000000129050312f in pa_bytes_to_usec () from 
> /usr/local/lib/pulseaudio/libpulsecommon-17.0.so
>       #1  0x00000012ee794dd9 in module_sndio_LTX_pa__init () from 
> /usr/local/lib/pulseaudio/modules/module-sndio.so
>       #2  0x00000012c4ad7c27 in pa_module_load () from 
> /usr/local/lib/pulseaudio/libpulsecore-17.0.so
>       #3  0x00000012c4ac031d in ?? () from 
> /usr/local/lib/pulseaudio/libpulsecore-17.0.so
>       #4  0x00000012c4abdf9d in pa_cli_command_execute_line_stateful () from 
> /usr/local/lib/pulseaudio/libpulsecore-17.0.so
>       #5  0x00000012c4abe9a4 in pa_cli_command_execute () from 
> /usr/local/lib/pulseaudio/libpulsecore-17.0.so
>       #6  0x0000001078ec27e8 in main ()
> 
> Ship debug symbols so the trace yields line numbers
>       #1  0x00000eda1c858dd9 in module_sndio_LTX_pa__init (m=0xed9bc2da0c0) 
> at ../pulseaudio-17.0/src/modules/module-sndio.c:768
> 
> and move the offending debug log into `if (mode & PLAYBACK) {' which sets up
> u->ink so it doesn't get accessed in record-only mode.
> 
> Then pulseaudio starts, burns too many CPU cycles and I haven't figured out
> yet how to record from or otherwise verify that PulseAudio actually gets a
> mic from sndio, but that's better than crashing...
> 
> Feedback? OK?

OK for me.
Cc'ing eric@ who came up with the initial implementation.


> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/audio/pulseaudio/Makefile,v
> diff -u -p -r1.130 Makefile
> --- Makefile  15 Jan 2024 09:38:46 -0000      1.130
> +++ Makefile  18 Feb 2024 02:05:28 -0000
> @@ -5,6 +5,7 @@ COMMENT=              cross-platform networked sound
>  VERSION=             17.0
>  DISTNAME=            pulseaudio-${VERSION}
>  EXTRACT_SUFX=                .tar.xz
> +REVISION=            0
>  
>  SHARED_LIBS += pulse                     7.2 # 0.24.3
>  SHARED_LIBS += pulse-simple              1.2 # 0.1.1
> @@ -96,6 +97,8 @@ CONFIGURE_ARGS=             -Ddoxygen=false \
>  # Recommended when using GNOME.
>  # See https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/832'
>  CONFIGURE_ARGS +=    -Dstream-restore-clear-old-devices=false
> +
> +DEBUG_PACKAGES=              ${BUILD_PACKAGES}
>  
>  post-extract:
>       cp ${FILESDIR}/module-sndio*.{c,h} ${WRKSRC}/src/modules/
> Index: files/module-sndio.c
> ===================================================================
> RCS file: /cvs/ports/audio/pulseaudio/files/module-sndio.c,v
> diff -u -p -r1.14 module-sndio.c
> --- files/module-sndio.c      11 Mar 2022 18:20:27 -0000      1.14
> +++ files/module-sndio.c      18 Feb 2024 01:59:18 -0000
> @@ -708,6 +708,9 @@ pa__init(pa_module *m)
>               pa_sink_set_get_volume_callback(u->sink, sndio_get_volume);
>               pa_sink_set_set_volume_callback(u->sink, sndio_set_volume);
>               u->sink->n_volume_steps = SIO_MAXVOL + 1;
> +
> +             pa_log_debug("buffer: frame=%u bytes=%zu msec=%u", u->par.bufsz,
> +                 u->bufsz, (unsigned int) pa_bytes_to_usec(u->bufsz, 
> &u->sink->sample_spec));
>       }
>  
>       if (mode & SIO_REC) {
> @@ -764,9 +767,6 @@ pa__init(pa_module *m)
>                   pa_bytes_to_usec(u->in_hwbuf_size, 
> &u->source->sample_spec));
>  */
>       }
> -
> -     pa_log_debug("buffer: frame=%u bytes=%zu msec=%u", u->par.bufsz,
> -         u->bufsz, (unsigned int) pa_bytes_to_usec(u->bufsz, 
> &u->sink->sample_spec));
>  
>       pa_memchunk_reset(&u->memchunk);
>  
> 

-- 
Antoine

Reply via email to