(cc-ing to the PD list for those who may have encountered the same problem)
This pertains to pd 0.40.3 (in my case pd-extended) and latest pidip compiled from source (0.12.23).
Hi Yves,
First of all, many thanks for the pdp_v4l2, it is really a great addition to the PD on Linux!
I'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'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):
(Line 207)
// Timeout.
tv.tv_sec = 5; //was 2 now is 5
tv.tv_usec = 0;
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:
(Line 211)
ret = select (x->x_tvfd + 1, &fds, NULL, NULL, &tv);
if (-1 == ret) {
if (EINTR == errno) return;
post ( "pdp_v4l2 : select timeout : thread exiting");
exit (-1); //here
}
if (0 == ret)
{
post ( "pdp_v4l2 : select timeout : thread exiting");
exit (-1); //and here
}
FWIW after a quick look at the rest of the code makes me wonder if these should be replaced with "stop_capturing()" 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).
At any rate, hope this proves helpful.
Best wishes,
Ivica Ico Bukvic, D.M.A.
Composition, Music Technology
Director, DISIS Interactive Sound and Intermedia Studio
Assistant Co-Director, CCTAD
CHCI, CS, and Art (by courtesy)
Virginia Tech
Department of Music
Blacksburg, VA 24061-0240
(540) 231-6139
(540) 231-5034 (fax)
ico.bukvic.net