[GEM-dev] Gem patches to fix DV4L bugs and crashes

Ivica Ico Bukvic ico.bukvic at gmail.com
Mon Feb 19 06:20:48 CET 2007


Here are some of the patches for the Gem tree for the videoDV4L devices. All
of the below are Linux-specific unless stated otherwise. Problems fixed
include:

*segfault when trying to change device while device is open
*segfault when trying to change driver while device is open
*fix misreporting error of the fd init error in the openDevice method which
prevented startTransfer from operating properly and consequently resulting
in previous 2 crashes
*fix proper disengagement of the capturing thread when a patch is forcefully
closed which resulted in DV device being busy  on subsequent "open" attempts
and/or crashes listed above. This fix may be applicable to opening of other
devices as well (definitely on Linux, possibly also on other OS's). However,
since I do not have any V4L devices handy, this fix was provided with the
most restrictive ifdef available (have DV4L) so as to prevent possible
regressions to other parts of the code.

Secondary fixes (meaning these are byproducts of the aforesaid fixes):

*Both Mode 0 and Mode 1passed to pix_texture now works with DV devices.

Here are relevant patches with verbose comments/explanations:

src/Pixes/pix_videoNEW.cpp:

59a60,69
> /*
> It appears that Gem fails to close video thread if a patch is closed
immediately after having been opened with loadbangs in place to set up
pix_video object. Same goes for patches which are opened, Gem window is
created and then closed before Gem window is destroyed.
>
> NB: It is very likely that it may be necessary for this method to exist
for other types of video devices, but since I was unable to test them, I've
put it under the most restrictive ifdef available.
>
> Ico Bukvic ico at vt.edu 2-18-07
> */
> #ifdef HAVE_LIBDV
>   if (m_videoHandle)m_videoHandle->stopTransfer();
> #endif /* DV4L */





src/Pixes/videoDV4L.cpp:

174c174,191
<   int fd = -1;
---
>   /*
>   If video feed is already open and "device <something>" message is passed
>   this will segfault Pd. Hence, we need to check if the device is already
open
>   before trying to open it again.
>
>   Ico Bukvic ico at vt.edu 2-18-07
>   */
>   if(m_haveVideo){
>     post("Stream already going on. Doing some clean-up...");
>     stopTransfer();
>   }
>   /*
>   All of the errors in this method return -1 anyhow, so fd should be 0 to
allow
>   successful open if everything goes ok.
>
>   Ico Bukvic ico at vt.edu 2-18-07
>   */
>   int fd = 0;
221a239,243
>   /*Extra verbosity never hurt anyone...
>
>   Ico Bukvic ico at vt.edu 2-18-07
>   */
>   post("DV4L: Successfully opened...");

After several hours of testing this on my machine, I am glad to report that
these patches fix aforesaid symptoms without any detectable regressions.

So, given that I do not have dev access, I was wondering if any of the users
with dev access would be so kind as to test and upload these to the Gem CVS.

Should you happen to have any additional questions and/or concerns, please
do not hesitate to contact me.

Best wishes,

*Ivica Ico Bukvic, D.M.A.
*Composition, Music Technology, CCTAD, CHCI
Virginia Tech
Department of Music
Blacksburg, VA 24061-240
(540) 231-1137
(540) 231-5034 (fax)
ico.bukvic.net <http://ico.bukvic.net/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/gem-dev/attachments/20070219/8bf2e379/attachment.htm>


More information about the GEM-dev mailing list