]> git.sesse.net Git - ffmpeg/commitdiff
avcodec: v4l2_m2m: context: fix raising warning on POLLERR
authorJorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Tue, 9 Jan 2018 22:56:43 +0000 (23:56 +0100)
committerMark Thompson <sw@jkqxz.net>
Sun, 21 Jan 2018 00:37:35 +0000 (00:37 +0000)
During the initialization stage, the codec attempts to get free
buffers from the driver before any have been queued (this is to keep
the code simple and generic)

When the kernel driver detects this situation, it returns POLLERR in
revents and ffmpeg therefore raises a warning.

This commit disables the warning since no buffers were queued to the
driver yet.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
libavcodec/v4l2_context.c

index dde97d0d1fd5e2dc27663116af990e91c26761ac..e0431b1b3e35983befb1e11d741c4f433f580682 100644 (file)
@@ -290,7 +290,17 @@ start:
 
     /* 0. handle errors */
     if (pfd.revents & POLLERR) {
-        av_log(logger(ctx), AV_LOG_WARNING, "%s POLLERR\n", ctx->name);
+        /* if we are trying to get free buffers but none have been queued yet
+           no need to raise a warning */
+        if (timeout == 0) {
+            for (i = 0; i < ctx->num_buffers; i++) {
+                if (ctx->buffers[i].status != V4L2BUF_AVAILABLE)
+                    av_log(logger(ctx), AV_LOG_WARNING, "%s POLLERR\n", ctx->name);
+            }
+        }
+        else
+            av_log(logger(ctx), AV_LOG_WARNING, "%s POLLERR\n", ctx->name);
+
         return NULL;
     }