Crash in v4l2src when device is busy

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

Crash in v4l2src when device is busy

Alexey Chernov
Hello,

I've faced some strange behavior of v4l2src when capture device is
busy and I try to set it to READY state. The program crashes in some
of GStreamer routines with the following error message:

ERROR!  Error:  Device '/dev/video0' cannot capture at 640x480
DEBUG   Error:  gstv4l2object.c(1920): gst_v4l2_object_set_format ():
/GstPipeline:camera/GstV4l2Src:v4l2src0:
Call to S_FMT failed for YUYV @ 640x480: Device or resource busy

Backtrace is like this:

#1  0x02581e1e in gst_v4l2src_create (src=0x8353000, buf=0xb50fd1cc)
at gstv4l2src.c:914
#2  0x025c3765 in gst_push_src_create (bsrc=0x8353000,
offset=18446744073709551615, length=4096, ret=0xb50fd1cc) at
gstpushsrc.c:117
#3  0x025b0881 in gst_base_src_get_range (src=<value optimised out>,
offset=18446744073709551615, length=4096, buf=0xb50fd1cc) at
gstbasesrc.c:2081
#4  0x025b3327 in gst_base_src_loop (pad=0x8354010) at gstbasesrc.c:2334
#5  0x0024ed6b in gst_task_func (task=0x83bd0c0) at gsttask.c:238
#6  0x00250377 in default_func (tdata=0x809b7c0, pool=0x8076810) at
gsttaskpool.c:70

My code is just plain as in tutorial I think:

    GstElement *v4l2src, *deinterlace, *videoscale, *tee,
*ffmpegcolorspace, *queue, *xvideoscale, *ximagesink;

    GstBus* bus;

    GstCaps* caps = gst_caps_new_simple ("video/x-raw-yuv", "width",
G_TYPE_INT, 400,
                                                            "height",
G_TYPE_INT, 300, NULL);

    /* Create gstreamer elements */

    _pipeline      = gst_pipeline_new("camera");

    v4l2src      = gst_element_factory_make("v4l2src",  NULL);

    deinterlace = gst_element_factory_make("deinterlace",  NULL);

    videoscale  = gst_element_factory_make("videoscale",  NULL);

    tee      = gst_element_factory_make("tee",  NULL);

    queue   = gst_element_factory_make("queue", NULL);

    xvideoscale = gst_element_factory_make("videoscale",  NULL);

    ffmpegcolorspace = gst_element_factory_make("ffmpegcolorspace",  NULL);

    ximagesink   = gst_element_factory_make("ximagesink", NULL);

    if (!_pipeline || !v4l2src || !videoscale || !tee || !queue ||
!ffmpegcolorspace || !xvideoscale || !ximagesink)
    {
            qDebug()<<"Elements could not be created. Exiting.";
    }

    gst_bin_add_many (GST_BIN (_pipeline), v4l2src, deinterlace,
videoscale, tee, queue, ffmpegcolorspace, xvideoscale, ximagesink,
NULL);

    gst_element_link_many(v4l2src, deinterlace, videoscale, NULL);

    gst_element_link_filtered(videoscale, tee, caps);

    gst_caps_unref(caps);


    gst_element_link_many(tee, queue, ffmpegcolorspace, xvideoscale,
ximagesink, NULL);


    g_object_set(G_OBJECT (ximagesink), "force-aspect-ratio", true, NULL);

    g_object_set(G_OBJECT (deinterlace), "mode", 0, NULL);

    if (_winid)
    {
        gst_x_overlay_set_xwindow_id ((GstXOverlay*)ximagesink, _winid);
    }

    bus = gst_pipeline_get_bus (GST_PIPELINE (_pipeline));
    gst_bus_add_watch (bus, bus_call, this);
    gst_object_unref (bus);

    /* Set the pipeline to "playing" state*/
//    gst_element_set_state (_pipeline, GST_STATE_READY);

    /* Iterate */
    g_print ("Running...\n");

    g_object_set(G_OBJECT (_v4l2src), "device", str.c_str(), NULL);

    gst_element_set_state (_pipeline, GST_STATE_READY);

Is it a bug and so I should post it or perhaps I did something unsafe?

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Crash in v4l2src when device is busy

Stefan Sauer
On 27.08.2010 10:24, 4ernov wrote:

> Hello,
>
> I've faced some strange behavior of v4l2src when capture device is
> busy and I try to set it to READY state. The program crashes in some
> of GStreamer routines with the following error message:
>
> ERROR!  Error:  Device '/dev/video0' cannot capture at 640x480
> DEBUG   Error:  gstv4l2object.c(1920): gst_v4l2_object_set_format ():
> /GstPipeline:camera/GstV4l2Src:v4l2src0:
> Call to S_FMT failed for YUYV @ 640x480: Device or resource busy
>  

please file a bug with the backtrace and standalone test app attached.

thanks
Stefan

> Backtrace is like this:
>
> #1  0x02581e1e in gst_v4l2src_create (src=0x8353000, buf=0xb50fd1cc)
> at gstv4l2src.c:914
> #2  0x025c3765 in gst_push_src_create (bsrc=0x8353000,
> offset=18446744073709551615, length=4096, ret=0xb50fd1cc) at
> gstpushsrc.c:117
> #3  0x025b0881 in gst_base_src_get_range (src=<value optimised out>,
> offset=18446744073709551615, length=4096, buf=0xb50fd1cc) at
> gstbasesrc.c:2081
> #4  0x025b3327 in gst_base_src_loop (pad=0x8354010) at gstbasesrc.c:2334
> #5  0x0024ed6b in gst_task_func (task=0x83bd0c0) at gsttask.c:238
> #6  0x00250377 in default_func (tdata=0x809b7c0, pool=0x8076810) at
> gsttaskpool.c:70
>
> My code is just plain as in tutorial I think:
>
>     GstElement *v4l2src, *deinterlace, *videoscale, *tee,
> *ffmpegcolorspace, *queue, *xvideoscale, *ximagesink;
>
>     GstBus* bus;
>
>     GstCaps* caps = gst_caps_new_simple ("video/x-raw-yuv", "width",
> G_TYPE_INT, 400,
>                                                             "height",
> G_TYPE_INT, 300, NULL);
>
>     /* Create gstreamer elements */
>
>     _pipeline      = gst_pipeline_new("camera");
>
>     v4l2src      = gst_element_factory_make("v4l2src",  NULL);
>
>     deinterlace = gst_element_factory_make("deinterlace",  NULL);
>
>     videoscale  = gst_element_factory_make("videoscale",  NULL);
>
>     tee      = gst_element_factory_make("tee",  NULL);
>
>     queue   = gst_element_factory_make("queue", NULL);
>
>     xvideoscale = gst_element_factory_make("videoscale",  NULL);
>
>     ffmpegcolorspace = gst_element_factory_make("ffmpegcolorspace",  NULL);
>
>     ximagesink   = gst_element_factory_make("ximagesink", NULL);
>
>     if (!_pipeline || !v4l2src || !videoscale || !tee || !queue ||
> !ffmpegcolorspace || !xvideoscale || !ximagesink)
>     {
>             qDebug()<<"Elements could not be created. Exiting.";
>     }
>
>     gst_bin_add_many (GST_BIN (_pipeline), v4l2src, deinterlace,
> videoscale, tee, queue, ffmpegcolorspace, xvideoscale, ximagesink,
> NULL);
>
>     gst_element_link_many(v4l2src, deinterlace, videoscale, NULL);
>
>     gst_element_link_filtered(videoscale, tee, caps);
>
>     gst_caps_unref(caps);
>
>
>     gst_element_link_many(tee, queue, ffmpegcolorspace, xvideoscale,
> ximagesink, NULL);
>
>
>     g_object_set(G_OBJECT (ximagesink), "force-aspect-ratio", true, NULL);
>
>     g_object_set(G_OBJECT (deinterlace), "mode", 0, NULL);
>
>     if (_winid)
>     {
>         gst_x_overlay_set_xwindow_id ((GstXOverlay*)ximagesink, _winid);
>     }
>
>     bus = gst_pipeline_get_bus (GST_PIPELINE (_pipeline));
>     gst_bus_add_watch (bus, bus_call, this);
>     gst_object_unref (bus);
>
>     /* Set the pipeline to "playing" state*/
> //    gst_element_set_state (_pipeline, GST_STATE_READY);
>
>     /* Iterate */
>     g_print ("Running...\n");
>
>     g_object_set(G_OBJECT (_v4l2src), "device", str.c_str(), NULL);
>
>     gst_element_set_state (_pipeline, GST_STATE_READY);
>
> Is it a bug and so I should post it or perhaps I did something unsafe?
>
> ------------------------------------------------------------------------------
> Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
> Be part of this innovative community and reach millions of netbook users
> worldwide. Take advantage of special opportunities to increase revenue and
> speed time-to-market. Join now, and jumpstart your future.
> http://p.sf.net/sfu/intel-atom-d2d
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>  


------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Crash in v4l2src when device is busy

Alexey Chernov
Thanks for response and suggestion. Posted a bug here:
https://bugzilla.gnome.org/show_bug.cgi?id=628640

On Wednesday 01 September 2010 13:20:11 you wrote:

> On 27.08.2010 10:24, 4ernov wrote:
> > Hello,
> >
> > I've faced some strange behavior of v4l2src when capture device is
> > busy and I try to set it to READY state. The program crashes in some
> > of GStreamer routines with the following error message:
> >
> > ERROR!  Error:  Device '/dev/video0' cannot capture at 640x480
> > DEBUG   Error:  gstv4l2object.c(1920): gst_v4l2_object_set_format ():
> > /GstPipeline:camera/GstV4l2Src:v4l2src0:
> > Call to S_FMT failed for YUYV @ 640x480: Device or resource busy
>
> please file a bug with the backtrace and standalone test app attached.
>
> thanks
> Stefan
>
> > Backtrace is like this:
> >
> > #1  0x02581e1e in gst_v4l2src_create (src=0x8353000, buf=0xb50fd1cc)
> > at gstv4l2src.c:914
> > #2  0x025c3765 in gst_push_src_create (bsrc=0x8353000,
> > offset=18446744073709551615, length=4096, ret=0xb50fd1cc) at
> > gstpushsrc.c:117
> > #3  0x025b0881 in gst_base_src_get_range (src=<value optimised out>,
> > offset=18446744073709551615, length=4096, buf=0xb50fd1cc) at
> > gstbasesrc.c:2081
> > #4  0x025b3327 in gst_base_src_loop (pad=0x8354010) at gstbasesrc.c:2334
> > #5  0x0024ed6b in gst_task_func (task=0x83bd0c0) at gsttask.c:238
> > #6  0x00250377 in default_func (tdata=0x809b7c0, pool=0x8076810) at
> > gsttaskpool.c:70
> >
> > My code is just plain as in tutorial I think:
> >     GstElement *v4l2src, *deinterlace, *videoscale, *tee,
> >
> > *ffmpegcolorspace, *queue, *xvideoscale, *ximagesink;
> >
> >     GstBus* bus;
> >    
> >     GstCaps* caps = gst_caps_new_simple ("video/x-raw-yuv", "width",
> >
> > G_TYPE_INT, 400,
> >
> >                                                             "height",
> >
> > G_TYPE_INT, 300, NULL);
> >
> >     /* Create gstreamer elements */
> >    
> >     _pipeline      = gst_pipeline_new("camera");
> >    
> >     v4l2src      = gst_element_factory_make("v4l2src",  NULL);
> >    
> >     deinterlace = gst_element_factory_make("deinterlace",  NULL);
> >    
> >     videoscale  = gst_element_factory_make("videoscale",  NULL);
> >    
> >     tee      = gst_element_factory_make("tee",  NULL);
> >    
> >     queue   = gst_element_factory_make("queue", NULL);
> >    
> >     xvideoscale = gst_element_factory_make("videoscale",  NULL);
> >    
> >     ffmpegcolorspace = gst_element_factory_make("ffmpegcolorspace",
> >     NULL);
> >    
> >     ximagesink   = gst_element_factory_make("ximagesink", NULL);
> >    
> >     if (!_pipeline || !v4l2src || !videoscale || !tee || !queue ||
> >
> > !ffmpegcolorspace || !xvideoscale || !ximagesink)
> >
> >     {
> >    
> >             qDebug()<<"Elements could not be created. Exiting.";
> >    
> >     }
> >    
> >     gst_bin_add_many (GST_BIN (_pipeline), v4l2src, deinterlace,
> >
> > videoscale, tee, queue, ffmpegcolorspace, xvideoscale, ximagesink,
> > NULL);
> >
> >     gst_element_link_many(v4l2src, deinterlace, videoscale, NULL);
> >    
> >     gst_element_link_filtered(videoscale, tee, caps);
> >    
> >     gst_caps_unref(caps);
> >    
> >    
> >     gst_element_link_many(tee, queue, ffmpegcolorspace, xvideoscale,
> >
> > ximagesink, NULL);
> >
> >     g_object_set(G_OBJECT (ximagesink), "force-aspect-ratio", true,
> >     NULL);
> >    
> >     g_object_set(G_OBJECT (deinterlace), "mode", 0, NULL);
> >    
> >     if (_winid)
> >     {
> >    
> >         gst_x_overlay_set_xwindow_id ((GstXOverlay*)ximagesink, _winid);
> >    
> >     }
> >    
> >     bus = gst_pipeline_get_bus (GST_PIPELINE (_pipeline));
> >     gst_bus_add_watch (bus, bus_call, this);
> >     gst_object_unref (bus);
> >    
> >     /* Set the pipeline to "playing" state*/
> >
> > //    gst_element_set_state (_pipeline, GST_STATE_READY);
> >
> >     /* Iterate */
> >     g_print ("Running...\n");
> >    
> >     g_object_set(G_OBJECT (_v4l2src), "device", str.c_str(), NULL);
> >    
> >     gst_element_set_state (_pipeline, GST_STATE_READY);
> >
> > Is it a bug and so I should post it or perhaps I did something unsafe?
> >
> > -------------------------------------------------------------------------
> > ----- Sell apps to millions through the Intel(R) Atom(Tm) Developer
> > Program Be part of this innovative community and reach millions of
> > netbook users worldwide. Take advantage of special opportunities to
> > increase revenue and speed time-to-market. Join now, and jumpstart your
> > future.
> > http://p.sf.net/sfu/intel-atom-d2d
> > _______________________________________________
> > gstreamer-devel mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel