I wrote some additional improvements for the V4L2 plugin. First, it fixes an issue, when the camera is opened the first time and DQBUF blocks for about 3 seconds. It uses select() to trigger the camera if there are new images in the Q.
Second, it fixes the issue with the stopMutex by Alexander Sbitnev. If the mutex is only used in Stop(), another thread may access GetFrameDataNoDelay while the cam was closed before for instance to change the resolution. So, the mutex must be kept alive as long as the other thread try to set up the cam and re-opens the device for reading. Additionally, it will speed up the hole cam process a lot.
Third, I added the TRY_FMT function before actually setting the format in SetFrameSize. As this may cause the cam to close and reopen, TRY_FMT tries to check the capabilities first and if it is not possible, it will work anyway.
Log in to post a comment.