Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help Audio::Ao XS/C - Segfaults on i686

1 view
Skip to first unread message

agraham

unread,
May 29, 2012, 5:43:41 PM5/29/12
to per...@perl.org, agr...@g-b.net
Hi Guys,

I've been using Audio::Ao
(http://search.cpan.org/~dbp/Audio-Ao-0.01/Ao.pm) for some weeks and
it's great.

It's an interface to the libao library (http://xiph.org/ao/)

However, until today I have only used it on Linux x64 (Fedora 14), I
compiled it on i686 (Fedora 14) and it segfaults when I call the
open_live() function.

I created a clean F14 VM and get the same results as the i686 machine.

The other functions/methods appear to work and return the corrected data
from the library.

I do not understand C or XS and am incapable of fixing this issue myself
and was hoping someone could help resolve this problem as the Author is
AWAL :(

I'm pretty sure the bug is in the C/XS code:

Also: You are also supposed to be able to pass some optional parameters
to the open_live function, but if you pass anything other than an empty
hash ref (e.g. {}) it always segfaults :(, it would be nice to know why
that does not work as it should, but that is secondary.

To clarify, this works on x64, but _not_ on i686, but in both causes it
compiles fine.

The C/XS code is:

SV *open_live ( int id, int bits, int rate, int channels, int bform,
void *o)
{
ao_option *opstruct = NULL;
ao_sample_format format;
ao_device *device;
SV *hval;
HV *options;
char **hkey;
I32 *retlen;
int ops = 0;

if (o != NULL)
options = (HV *) o;
else
options = newHV();

hv_iterinit(options);
while ((hval = hv_iternextsv(options, hkey, retlen)) != NULL) {
ops = 1;
if (ao_append_option(&opstruct, *hkey, SvPV_nolen(hval)) != 1) {
perror("Bad value in options hash, aborting open_live");
return &PL_sv_undef;
}
}

format.bits = bits;
format.rate = rate;
format.channels = channels;
format.byte_format = bform;

if (ops > 0)
device = (ao_device *) ao_open_live(id, &format, opstruct);
else
device = (ao_device *) ao_open_live(id, &format, NULL);

ao_free_options(opstruct);

return newSViv((IV) device);
}


NOTE: The same issue exists with the open_file() function, so I assume
that is the same problem, as they are almost identical functions.

Thanks in advance

Albert

Xiao Yafeng

unread,
Jun 10, 2012, 9:39:15 AM6/10/12
to agr...@g-b.net, per...@perl.org
It appears to me this function open an ao_live and return a device no. maybe the c library is too new to fit this. I suggest you use ao 0.86 which was published on 2003. or you could post your request on perlmonks and see if someone want to take over this module.
0 new messages