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

Nicolas George nicolas.george at normalesup.org
Wed Aug 10 14:57:55 CEST 2011

Le tridi 23 thermidor, an CCXIX, Samuli Valo a écrit :
> Current v4l2 implementation doesn't wait for new frames to be ready
> before calling VIDEOC_DQBUF. This resulted in reading incomplete
> frames or same frame multiple times with at least one v4l2 capture
> card (reading ~80fps from ~60fps source).
> 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.

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


  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/c5fa0624/attachment.asc>

More information about the ffmpeg-devel mailing list