[vlc-devel] [PATCH 1/2] V4L2: Open devices only once.
thierry.reding at avionic-design.de
Thu Aug 4 12:58:47 CEST 2011
* Rémi Denis-Courmont wrote:
> On Thu, 4 Aug 2011 09:53:51 +0200, Thierry Reding
> <thierry.reding at avionic-design.de> wrote:
> > Instead of opening the device once for probing purposes and opening it
> > again when it has been determined suitable, this commit takes the file
> > descriptor obtained during probing and passes it to the initialization
> > function.
> You really should keep the file descriptor in a local variable. With your
> patch, the compiler will load the file descriptor from memory again and
> again as (v4l2_)ioctl() acts a memory barrier.
Okay, so I'll follow up with a patch.
> > if( i_fd >= 0 ) v4l2_close( i_fd );
> > - return false;
> > + return VLC_EGENERIC;
> You really should use -1 for this.
-1 is defined as VLC_ENOMEM. It's kind of a moot point because the return
value from InitVideoDev() is not used anyway.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: not available
More information about the vlc-devel