Try the next frame if MJPEGtoRGB888() fails to decode the frame
Add a timeout so we don't hang if the webcam doesn't return any data

Abort after getting EAGAIN 20 times (up to 20 seconds) when reading the
webcam device file.
Make MJPEG code path more robust

Check that the frame we get starts with 0xff 0xd8. Also, the JFIF header
is not needed, so remove it.

To sum up, to make a valid JPEG file from a webcam MPEG frame (so that
libjpeg can decompress it), simply insert the fixed huffman table right
after the start-of-image (SOI) marker (0xff 0xd8).