Hi guys,

I'm trying to use gscam with the two embedded webcam I have on a N900 phone. I have sometimes troubles running gscam as it crashes with a nasty segmentation fault.

In order to use gscam, I've configured GSCAM_CONFIG="v4l2src device=/dev/video1 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! identity name=ros ! ffmpegcolorspace ! jpegenc ! fakesink". Running "gst-launch $GSCAM_CONFIG" works as expected, no segfault. Running this pipeline using "rosrun gscam gscam" (in gscam/bin directory) produces erratic segfaults.

I've tried to track down this error, and gscam fails in processData() at:

    memcpy(buffer,gBuffer->data,sizeof(unsigned char)*width*height*3);

gBuffer->data appears to be 153600, while sizeof(unsigned char)*width*height*3 is 230400, thus troubles allocating memory ?

I can't find where the problem comes from... Shouldn't there be some sanity check with these buffer sizes ?

Using with this line seems to fix the consequence, but not the cause... (and images appears with a black rectangle, missing data)

    memcpy(buffer,gBuffer->data,GST_BUFFER_SIZE(gBuffer));


I guess I have some problems with my pipeline definition... Any idea ? Is it because it's YUV and not RGB ? (webcam doesn't seem to support RGB with video/x-raw-rgb pipeline element).


Thanks
Cheers,
Seb


--
Sébastien Lelong
http://www.sirloon.net
http://sirbot.org