(cc-ing to the PD list for those who may have encountered the same problem)<br>This pertains to pd 0.40.3 (in my case pd-extended) and latest pidip compiled from source (0.12.23).<br><br>Hi Yves,<br><br>First of all, many thanks for the pdp_v4l2, it is really a great addition to the PD on Linux!<br>
<br>I&#39;ve been testing latest pidip with a MSI Wind netbook and found out that pdp_v4l2 roughly 90% of the time crashes PD upon opening the video device due to its 2-second timeout for receiving frame after which it forcefully kills the thread, thus causing PD to crash. MSI Wind&#39;s webcam appears to need roughly 2-3 seconds to start (same behavior in Skype) which results in it working only in a small percentage of times. I simply changed the timeout to 5 seconds (see below) and recompiled the pidip library (this is the latest 0.12.23):<br>
<br>(Line 207)<br>&nbsp;&nbsp;&nbsp; // Timeout. <br>&nbsp;&nbsp;&nbsp; tv.tv_sec = 5; //was 2 now is 5<br>&nbsp;&nbsp;&nbsp; tv.tv_usec = 0;<br><br>So, this fixes it as far as MSI Wind is concerned, but I think the code may need a more graceful handling of the thread and failure to receive a frame within the timeout period. In other words, I am no expert on threads but I think in the section following the excerpt above, the exit(-1) calls might be killing the thread prematurely causing PD to crash:<br>
<br>(Line 211)<br>&nbsp;&nbsp;&nbsp; ret = select (x-&gt;x_tvfd + 1, &amp;fds, NULL, NULL, &amp;tv);<br><br>&nbsp;&nbsp;&nbsp; if (-1 == ret) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (EINTR == errno) return;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; post ( &quot;pdp_v4l2 : select timeout : thread exiting&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit (-1); //here<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; if (0 == ret) <br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; post ( &quot;pdp_v4l2 : select timeout : thread exiting&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit (-1); //and here<br>&nbsp;&nbsp;&nbsp; }<br><br>FWIW after a quick look at the rest of the code makes me wonder if these should be replaced with &quot;stop_capturing()&quot; call and perhaps a variable needs to be added to the main thread that is toggled false so that the main thread sleeps until start_capturing() is invoked which toggles the same variable back to true (or something along those lines).<br>
<br>At any rate, hope this proves helpful.<br><br>Best wishes,<br><br>Ivica Ico Bukvic, D.M.A.<br>Composition, Music Technology<br>Director, DISIS Interactive Sound and Intermedia Studio<br>Assistant Co-Director, CCTAD<br>
CHCI, CS, and Art (by courtesy)<br>Virginia Tech<br>Department of Music <br>Blacksburg, VA 24061-0240<br>(540) 231-6139<br>(540) 231-5034 (fax) <br><a href="http://ico.bukvic.net">ico.bukvic.net</a><br>