All of lore.kernel.org
 help / color / mirror / Atom feed
* PCM usage / seg fault in pcm_params.c
@ 2011-11-24 10:20 Borg Onion
  2011-11-24 13:38 ` Clemens Ladisch
  0 siblings, 1 reply; 3+ messages in thread
From: Borg Onion @ 2011-11-24 10:20 UTC (permalink / raw)
  To: alsa-devel

Hello,

Program terminated with signal 11, Segmentation fault.
#0  0x00534502 in snd_pcm_hw_refine (pcm=0x94b36f0, params=0x94b36f0) at
pcm_params.c:2291
2291            res = pcm->ops->hw_refine(pcm->op_arg, params);
(gdb) bt
#0  0x00534502 in snd_pcm_hw_refine (pcm=0x94b36f0, params=0x94b36f0) at
pcm_params.c:2291
#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!

--BO

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PCM usage / seg fault in pcm_params.c
  2011-11-24 10:20 PCM usage / seg fault in pcm_params.c Borg Onion
@ 2011-11-24 13:38 ` Clemens Ladisch
  2011-11-24 20:29   ` Borg Onion
  0 siblings, 1 reply; 3+ messages in thread
From: Clemens Ladisch @ 2011-11-24 13:38 UTC (permalink / raw)
  To: Borg Onion; +Cc: alsa-devel

Borg Onion wrote:
> Program terminated with signal 11, Segmentation fault.
>
> Sound card is opened, PCM device is opened,

Is it?

...
Found PCM device #1
Playback=no, Capture=yes, Full Duplex=no
Playback capabilities:
Segmentation fault


Regards,
Clemens

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PCM usage / seg fault in pcm_params.c
  2011-11-24 13:38 ` Clemens Ladisch
@ 2011-11-24 20:29   ` Borg Onion
  0 siblings, 0 replies; 3+ messages in thread
From: Borg Onion @ 2011-11-24 20:29 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

>
> > Program terminated with signal 11, Segmentation fault.
> >
> > Sound card is opened, PCM device is opened,
>
> Is it?
>
> ...
> Found PCM device #1
> Playback=no, Capture=yes, Full Duplex=no
> Playback capabilities:
> Segmentation fault
>

You're right, my bad.  Fixed now.  Still, an assert() in the lib wouldn't
hurt.  They seem to be thoroughly applied for everything else.  That same
function in the lib asserts already, so here's my proposal to modify the
assert call:

int snd_pcm_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
{
        int res;
#ifdef REFINE_DEBUG
        snd_output_t *log;
        snd_output_stdio_attach(&log, stderr, 0);
#endif
        assert(pcm && pcm->ops && params);
#ifdef REFINE_DEBUG
        snd_output_printf(log, "REFINE called:\n");
        snd_pcm_hw_params_dump(params, log);
#endif
        res = pcm->ops->hw_refine(pcm->op_arg, params);
#ifdef REFINE_DEBUG
        snd_output_printf(log, "refine done - result = %i\n", res);
        snd_pcm_hw_params_dump(params, log);
        snd_output_close(log);
#endif
        return res;
}


--BO

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-24 20:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-24 10:20 PCM usage / seg fault in pcm_params.c Borg Onion
2011-11-24 13:38 ` Clemens Ladisch
2011-11-24 20:29   ` Borg Onion

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.