Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capture.cpp aborting libv4l2 JPEG header error #9

Closed
mrazjava opened this issue Dec 26, 2012 · 5 comments
Closed

capture.cpp aborting libv4l2 JPEG header error #9

mrazjava opened this issue Dec 26, 2012 · 5 comments
Assignees
Milestone

Comments

@mrazjava
Copy link

This issue is more directly OpenIMAJ but you might want to consider fixing capture.cpp to gracefully handle a common linux v4l error. With my Dell inspiron 1545, Ubuntu 10.04, OpenIMAJGrabber aborts causing program shutdown when libv4l encounters the folliowing:

libv4l2: error converting / decoding frame data: v4l-convert: error parsing JPEG header: Not a JPG file ?

This is a common linux issue with some webcams, but capture.cpp is falling through into error exit rather than ignoring the error:

    case IO_METHOD_MMAP:
            CLEAR (buf);

            buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
            buf.memory = V4L2_MEMORY_MMAP;

            if (-1 == xioctl (grabber->fd, VIDIOC_DQBUF, &buf)) {

                    switch (errno) {
                    case EAGAIN:
                            return 0;

                    case EIO:
                            /* Could ignore EIO, see spec. */
                            /* fall through */

                    default:
                            errno_exit ("VIDIOC_DQBUF");
                    }
            }

I fixed it by recompiling native lib (for linux only) with simple return 0 under case EIO:

                    case EIO:
                            /* Could ignore EIO, see spec. */
            return 0;
                            /* fall through */

This took care of the problem. Again, not affecting me directly since I've rebuilt mine but to save other linux user a headache you might want to recompile with return 0.

@sarxos
Copy link
Owner

sarxos commented Dec 26, 2012

Yeah, those are the most nasty bugs ;] Thank you for finding it! I will probably fork OpenIMAJ native code and take a look on it, but in the meantime, could you also, if that's not a problem, open a ticket in OpenIMAJ project? Their JIRA can be found here.

Just for my memory I'm putting a link to the capture.cpp file here.

@sarxos
Copy link
Owner

sarxos commented Jan 8, 2013

OpenIMAJ issue OP-41 is fixed. Waiting for OP-44.

@sarxos
Copy link
Owner

sarxos commented Jan 14, 2013

Issue OP-44 will be integrated in separate commit.

@He-Pin
Copy link

He-Pin commented Jan 14, 2013

wow~~!nice
i am handling the udt android porting ...

@ghost ghost assigned sarxos Jan 14, 2013
@sarxos
Copy link
Owner

sarxos commented Jan 14, 2013

Those files will be integrated into 0.3.7:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants