From patchwork Tue Jul 25 21:38:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Acayan X-Patchwork-Id: 42980 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:7528:b0:130:ccc6:6c4b with SMTP id r40csp122785pzd; Tue, 25 Jul 2023 14:41:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlEE0Ebr7umv3AKz2Eaz8879H8HMj4pOzRFPS+CbAgKuVJ13lhD2WLhYq949ioANoSsewcf9 X-Received: by 2002:a17:906:2012:b0:94f:29f0:edc0 with SMTP id 18-20020a170906201200b0094f29f0edc0mr74382ejo.44.1690321291293; Tue, 25 Jul 2023 14:41:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690321291; cv=none; d=google.com; s=arc-20160816; b=v6NltPQWz+DENV4SUi5x0gF50r3qY2YPgrrlhepmjFAPhXRWRkXBan4lnRB4ZjMCd2 rqPEvpjl0OoKIWFIb6coGuBTVYujW5vHx7l1Eb2GeFBbMr8zQyqD6mbqxLDH66g3/2U7 dQq7VKO7s8ieRvF4siGktqUEsVX2QgPUqztCk63hPMDW1fZRLdngwOGM6dypUSH5dEqV om5Tgr4ztLxo1MaHwrgN5Ew/wdgdLH+Y030iVwQ2crfCU+anFcYdzshbeoqnocpvXiSM yttdKRmAUxZ7u/d5y+td+UFN8ufVargfTiHTIUvt2YMWs3epRP8kukcREGmHXqfRq7em 3gYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=qxcr+MIamOhftP4nonDjyvYgru7vz55GWjSTIC6B8NE=; fh=1lPpQFWct10pizSeEZJMJdO8Z5N+GM4rXBxyJNbfiM0=; b=U1IWu8nnQoUszV+Iv10FKKkonniWaK20m5Ao9oDIRD1+cVi9fQYN4q82SDay5nl0Jp 6GYrrzZX0ZiVISiFfPquNJ5FRQd657QWHR+jWYPWW0lpUys2GQDTzekjnjIJyGYgLwGY xsIE/Wlo+U/SNJurmVbZP1mp/DfiaTowIgyQbs7DUGDUF8dsnZMBqoJeLaxsKownpXH9 4uvnKGEiJjZXpr1cnjDT21NQtN7UfIx33VNVmBkp7+0Qw2uo83bzxH2t06t+jH2ajsCu r3ggz1Bq+u41gAx/N7CQPhpNR0TlHoo0ZLRVp6TPcSmBqhoMRlEDzYFy0hZ6X4ee1R4I ZJ9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20221208 header.b=LTsTZtF+; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d22-20020a17090694d600b0099351214a88si8942392ejy.637.2023.07.25.14.41.30; Tue, 25 Jul 2023 14:41:31 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20221208 header.b=LTsTZtF+; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0002168C85D; Wed, 26 Jul 2023 00:41:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9B04668C6CF for ; Wed, 26 Jul 2023 00:41:20 +0300 (EEST) Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-403af7dfa3aso51600271cf.0 for ; Tue, 25 Jul 2023 14:41:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690321279; x=1690926079; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=s1zGEL8CKFLAbTGRsJZZ0ZhtLR9Gx2MX8DFUdJgOzeM=; b=LTsTZtF+SJ3r3XMGd3sXNt/WhuXK7qJE+NxDsCRBJnVtZftELO5Cuh9D+nKP0t265y qQJGNBvpUZr6E7kJwhNRFd/alJpvUii5FcBxnCQufagTYUx85Q9pRpa+swvRAek6y+yE an9poPQztdDJWUEtE/opUZE/TcjE1aM1+5GH4IggN9ePLGgjuC0NTaT5Gdfbe5FnaoSh 0B38LQKyWULELcilG093IiTsXrKssD/06HfUv79Ks4Q1NRV2/WT6fp1u77Xx6+loypkg wkmTRt5M66y0Vo/Dg3XpNAKMWR2rQISbxtEh1gVQ3JbE4TTAUFlC/zn0dYs05MRiLcLV C3Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690321279; x=1690926079; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=s1zGEL8CKFLAbTGRsJZZ0ZhtLR9Gx2MX8DFUdJgOzeM=; b=af3A6nwRb3g09ZDbzk0uB8dO7SXDtUGyuMA/uyDes4SRujB1xg7+k+pWjenmMjTDZY N03LgODkLuKJ5nE0ZSWUCj3UNdRhCrVptz0vI9pmbfeqpPbfaKNngpCZFuczLrz3Ot5r 0Wz5LgxSWOaLd1xxuLNTPlolQTAkvSdbZF2FNGwfOFW3bXfEuB1qSYnxGwTwJwu9tjsQ 4Emu2PGYwY3TvM/+lxpNsLDhKuYPrceGTZKDxOKLyhiY6CeM0da5BfoPgnrpFvvM9GEP LjFECE9/y8/8+Z+hrhLBjqX6tMSw2S0+yJJGxiCu+uMXUrPwLC3XpDiC/I1AIT56p+Qp Otmw== X-Gm-Message-State: ABy/qLa5OR/J+HNqZOtS3OcpnDVwk0BY8x6Q/eKczp31hWxR5uJKg1dp 6etRzBwypanajAHagZ1hzzrjpstQvI0+2w== X-Received: by 2002:ac8:5f8c:0:b0:403:b88d:1e60 with SMTP id j12-20020ac85f8c000000b00403b88d1e60mr248435qta.51.1690321278732; Tue, 25 Jul 2023 14:41:18 -0700 (PDT) Received: from localhost ([2607:fea8:529e:7800::7c90]) by smtp.gmail.com with ESMTPSA id j7-20020ac84c87000000b00401e04c66fesm4333953qtv.37.2023.07.25.14.41.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 14:41:18 -0700 (PDT) From: Richard Acayan To: FFmpeg development discussions and patches Date: Tue, 25 Jul 2023 17:38:39 -0400 Message-ID: <20230725213838.199190-2-mailingradian@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] avcodec/v4l2_context: suppress POLLERR when buffers are uninitialized X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Richard Acayan Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: R3ktLeQWq3YN A POLLERR occurs when libavcodec attempts to dequeue output buffers before enqueuing capture buffers. This could happen to an application deciding to send the first coded packet. Suppress these POLLERRs when the buffers are uninitialized. See https://trac.ffmpeg.org/ticket/9957 for the original bug report. Signed-off-by: Richard Acayan --- Changes since v1 (20230718220017.3336-1-mailingradian@gmail.com): - stopped emitting POLLERR logs for this case (thanks to feedback from Marton Balint) libavcodec/v4l2_context.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c index a40be94690..f20f713e1d 100644 --- a/libavcodec/v4l2_context.c +++ b/libavcodec/v4l2_context.c @@ -325,9 +325,13 @@ start: /* 0. handle errors */ 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 we are trying to get free buffers but none have been queued yet, + * or if no buffers have been allocated yet, no need to raise a warning + */ if (timeout == 0) { + if (!ctx->buffers) + return NULL; + 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);