[FFmpeg-devel] [PATCH] V4L2 wait for new frames

Nicolas George nicolas.george at normalesup.org
Wed Aug 10 16:28:33 CEST 2011


Le tridi 23 thermidor, an CCXIX, Samuli Valo a écrit :
> Yes, ioctl returned successfully.
> 
> So this seems to be driver problem.

It looks like it, although some more in depth examination would be required
to be sure. The best cours would probably be to build a minimalistic
stand-alone application exhibiting the problem.

>					At least that poll() patch fixes our
> problem until driver is fixed...

I am not against temporary workarounds, but the final decision is not mine
to take.

> +restart_poll:

I think a loop would be nicer.

> +    p.fd = s->fd;

This does not need to be in the loop (or pseudo-loop), poll does not reset
the structure members.

> +    p.events = POLLIN | POLLERR | POLLHUP;

POLLERR and POLLUP are not valid in the events field, only in the revents
field.

> +    if (poll(&p, 1, -1) < 0) {
> +        if (errno == EAGAIN || errno == EINTR)
> +            goto restart_poll;

If the device has the NONBLOCK flag, EAGAIN should be returned immediately.
Otherwise, you risk to get, for example, ALSA underruns while waiting for a
video frame.

> +        av_log(ctx, AV_LOG_ERROR, "Poll failed: %s\n", strerror(errno));
> +        return AVERROR(EIO);

Why not just return AVERROR(errno) and let the caller log what it wants?

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110810/99fe4055/attachment.asc>


More information about the ffmpeg-devel mailing list