Android v4l2src device node issue

Nicolas Dufresne nicolas.dufresne at collabora.com
Tue Jun 24 08:29:51 PDT 2014


Hi Lee,

Le mardi 24 juin 2014 à 16:16 +0200, Lee Matthews a écrit :
> Hi,
> 
> I have some gstreamer code that accesses an external webcam attached to an Android mobile device.
> 
> The webcam normally gets mounted on /dev/video3. I then access the webcam using the v4l2src element. The problems appears if the webcam is unplugged whilst reading video data.
> 
> When the device is unplugged, I detect an error and close all the resources, ie set the pipeline to NULL and then unreference the pipeline.

It is likely there is a bug in this error handling. One would have to
check, I think you can check this by monitoring the process opened FD
(see if it increase, see /proc/$PID/fd). If it leaks, please report on
bugs.gnome.org, mention the GStreamer version you are running.

> 
> If I plug the device back in, it is mounted as /dev/video4. If I repeat the above process, it is mounted as /dev/video5 and so on.

Even without leaks, it is not guarantied that the device number will be
the same. In current dev tree, we have introduced the device monitor,
that let you watch devices as they appear and disappear.

> 
> It is as though the device node is not being closed properly and Android is allocating the next free one. Apart from closing the resources (as I'm already doing) is there any other way to close the associated webcam device node ?
> 
> I have even tried closing it through Java, but I'm not having any luck there either.
> 
> Can anyone help?
> 
> Thanks
> Lee
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




More information about the gstreamer-devel mailing list