#354: Segfault in C code for RGB frames..
------------------------+---------------------------------------------------
Reporter: toots | Owner: admin
Type: Bugs | Status: new
Priority: 1 | Milestone: 1.0 beta
Component: Liquidsoap | Version: 0.9.2+svn
Keywords: | Mac: 1
Linux: 1 | Netbsd: 1
Other: 1 | Freebsd: 1
------------------------+---------------------------------------------------
It seems that the current way of handling C manipulations of frames
segfaults:
{{{
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe9dd1910 (LWP 30076)]
0x00000000006ee798 in fdset_to_fdlist ()
(gdb) thread apply all bt
Thread 5 (Thread 0x7fffe85ce910 (LWP 30079)):
#0 0x00000000006f460c in caml_rgb_add_off ()
}}}
The code is:
{{{
CAMLprim value caml_rgb_add_off(value _src, value _dst, value _dx, value
_dy)
{
frame src,dst;
frame_of_value(_src, &src);
frame_of_value(_dst, &dst);
int dx = Int_val(_dx),
dy = Int_val(_dy);
int i, j, c;
unsigned char sa;
int istart = max(0, dx),
iend = min(dst.width, src.width + dx),
jstart = max(0, dy),
jend = min(dst.height, src.height + dy);
caml_register_global_root(&_dst);
caml_register_global_root(&_src);
caml_enter_blocking_section();
for (j = jstart; j < jend; j++)
for (i = istart; i < iend; i++)
{
sa = Alpha(&src, (i-dx), (j-dy));
if (sa != 0)
{
if (sa == 0xff)
{
for (c = 0; c < Rgb_colors; c++)
Color(&dst, c, i, j) = Color(&src, c, (i-dx), (j-dy));
Alpha(&dst, i, j) = 0xff;
}
else
{
for (c = 0; c < Rgb_colors; c++)
Color(&dst, c, i, j) = CLIP(Color(&src, c, (i-dx), (j-dy)) *
sa / 0xff + Color(&dst, c, i, j) * (0xff - sa) / 0xff);
Alpha(&dst, i, j) = CLIP(sa + (0xff - sa) * Alpha(&dst, i, j));
}
}
}
caml_leave_blocking_section();
caml_remove_global_root(&_dst);
caml_remove_global_root(&_src);
return Val_unit;
}
}}}
It would be good to keep the current idea (global root), but I don't know
how to fix the segfault...
--
Ticket URL: <http://savonet.rastageeks.org/ticket/354>
Savonet <http://savonet.rastageeks.org/>
Let's program our stream !
------------------------------------------------------------------------------
_______________________________________________
Savonet-trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-trac