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

Samuli Valo samuli.valo at picturall.com
Wed Aug 10 16:09:58 CEST 2011

On 08/10/2011 03:57 PM, Nicolas George wrote:
> Le tridi 23 thermidor, an CCXIX, Samuli Valo a écrit :
> Attached patch adds poll() call before DQBUF to wait until filled
> buffers become available as suggested on v4l2 specs.
> This does not seem correct. The documentation says:
> # By default<constant>VIDIOC_DQBUF</constant>  blocks when no buffer is in
> # the outgoing queue. When the<constant>O_NONBLOCK</constant>  flag was
> # given to the&func-open; function,<constant>VIDIOC_DQBUF</constant>
> # returns immediately with an&EAGAIN; when no buffer is available.
> And the code surrounding the call to VIDIOC_DQBUF in libavdevice seems
> correct regarding the handling of EAGAIN.
Hi Nicolas,

Missed that part and got mislead by "Filled buffers are
dequeued from the outgoing queue with the |VIDIOC_DQBUF| 
<http://v4l2spec.bytesex.org/spec-single/v4l2.html#VIDIOC-QBUF> ioctl. To
wait until filled buffers become available this function, |select()| 
<http://v4l2spec.bytesex.org/spec-single/v4l2.html#FUNC-SELECT> or
|poll()| <http://v4l2spec.bytesex.org/spec-single/v4l2.html#FUNC-POLL> 
can be used."

> Did you investigate further? When you get incomplete frames, did ioctl
> return successfully? If so, it could be a kernel bug rather than a ffmpeg
> bug.
Yes, ioctl returned successfully.

So this seems to be driver problem. At least that poll() patch fixes our
problem until driver is fixed...

With best regards,

* 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