diff mbox series

[FFmpeg-devel] avcodec/v4l2_context: always log POLLERR when buffers are uninitialized

Message ID 20230703211510.255629-1-mailingradian@gmail.com
State New
Headers show
Series [FFmpeg-devel] avcodec/v4l2_context: always log POLLERR when buffers are uninitialized | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Richard Acayan July 3, 2023, 9:15 p.m. UTC
The error handler for POLLERRs assumes that the timeout is only zero
when v4l2_dequeue_v4l2buf is called by v4l2_getfree_v4l2buf. This
assumption is incorrect, as ff_v4l2_context_dequeue_frame also calls
this function with a timeout of zero. Do not check for unavailable
buffers if the buffers are uninitialized.

See https://trac.ffmpeg.org/ticket/9957 for the original bug report.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
---
 libavcodec/v4l2_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index a40be94690..69ddf80723 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -327,7 +327,7 @@  start:
     if (pfd.revents & POLLERR) {
         /* if we are trying to get free buffers but none have been queued yet
            no need to raise a warning */
-        if (timeout == 0) {
+        if (timeout == 0 && ctx->buffers) {
             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);