[alsa-devel] PCM usage / seg fault in pcm_params.c

Borg Onion borg.onion at gmail.com
Thu Nov 24 11:20:05 CET 2011


Program terminated with signal 11, Segmentation fault.
#0  0x00534502 in snd_pcm_hw_refine (pcm=0x94b36f0, params=0x94b36f0) at
2291            res = pcm->ops->hw_refine(pcm->op_arg, params);
(gdb) bt
#0  0x00534502 in snd_pcm_hw_refine (pcm=0x94b36f0, params=0x94b36f0) at
#1  0x0052a1e2 in snd_pcm_hw_params_any (pcm=0x94b36f0, params=0x94b36f0)
at pcm.c:3178
#2  0x080497a7 in print_pcm_hw_params (pcm=0x94b36f0) at list.c:109
#3  0x080499ef in print_pcm_devices (handle=0x94af638) at list.c:147
#4  0x08049362 in main (argc=1, argv=0xbfcf66b4) at list.c:227
(gdb) print pcm->ops
$1 = (const snd_pcm_ops_t *) 0x0

Source code at http://pastebin.com/rqBCDza7

Sound card is opened, PCM device is opened, hw params were just allocated,
and now I'm calling snd_pcm_hw_params_any().  Trying to populate the empty
params struct so as to interrogate it and find out the card's capabilities.

I'm sure I'm mis-using alsa-lib, but also shouldn't this have an assert()
on pcm->ops ?  What's the right call sequence to get capabilities of this
PCM channel (sample rates, bit depths, etc)?

Thanks for any help!


More information about the Alsa-devel mailing list