gscam segfaults

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

gscam segfaults

Sebastien Lelong
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


_______________________________________________
ros-users mailing list
[hidden email]
https://code.ros.org/mailman/listinfo/ros-users
Reply | Threaded
Open this post in threaded view
|

Re: gscam segfaults

Trevor Jay
On Tue, Aug 17, 2010 at 10:15 AM, Sebastien Lelong
<[hidden email]> wrote:
> 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).
>

It definitely looks like a colorspace issue. gscam can only process
RGB triplets. I'd need a similar YUV camera to tell you the exact
$GSCAM_CONFIG to use, but you should be able to go from YUV->RGB
within the pipeline itself. You might simply need to move or repeat
the ffmpegcolorspace node closer to the color definition. Something
like:

GSCAM_CONFIG="v4l2src device=/dev/video1 ! videoscale !
ffmpegcolorspace ! video/x-raw-rgb ! identity name=ros ! jpegenc !
fakesink"
or
GSCAM_CONFIG="v4l2src device=/dev/video1 ! videoscale !
video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace !
video/x-raw-rgb ! identity name=ros ! jpegenc ! fakesink"

I've had to do something similar with a black and white camera. Let me
know if that works for you.

_Trevor
_______________________________________________
ros-users mailing list
[hidden email]
https://code.ros.org/mailman/listinfo/ros-users
Reply | Threaded
Open this post in threaded view
|

Re: gscam segfaults

Sebastien Lelong
Hi Trevor,

Using both of your GStreamer pipeline works ! I just needed to remove jpegenc element ("can't connect ros to jpegenc0" IIRC). On the other side (computer), running an image converter ROS node, I can now see more realistic images :) I wasn't able to convert in RGB, gstreamer remains cryptic for me...

Thanks for your help !

Cheers,
Seb