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

Samuli Valo samuli.valo at picturall.com
Wed Aug 10 16:47:15 CEST 2011


On 08/10/2011 05:28 PM, Nicolas George wrote:
>
>> 					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.

Hi Nicolas,

It is also not a problem for us to keep our separate branch until
hardware provider fixes the drivers. They promised to look into it
and fix it if it is driver problem.

Your suggestions to the patch are good. The code is copied directly
from dv1394.c:163 so I think it would be good idea to fix those problems
there...

With best regards,
   Samuli

>> +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,
>
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


-- 
--
* Samuli Valo                samuli.valo at picturall.com
* Picturall Ltd.             gsm: +358 40 582 9016
* http://www.picturall.com




More information about the ffmpeg-devel mailing list