From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 479C946FD0 for ; Mon, 24 Jul 2023 22:00:11 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E319568C7E0; Tue, 25 Jul 2023 01:00:09 +0300 (EEST) Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CF5C968C752 for ; Tue, 25 Jul 2023 01:00:03 +0300 (EEST) Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-4039f0d140eso41845811cf.1 for ; Mon, 24 Jul 2023 15:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690236002; x=1690840802; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=LETQ+PNIjvhiFotvbHxFb4HZ3B1gfK+LyzGPrt808Go=; b=ZIxzGXJkzpTbkCaTwr/aWffJY7nm43LBCDsAKKLvSWKvPgDB/YXvP3KKssswfukiep mhqd++16TqzxU+1MX5tJ0/Z67Ag8Z+028QG4FNjaaZTUWqjV8Gf0l645GRqtLngXvFcR QSiNoUkn8IJatADqo1h6IpyFtEWCf3h+DEl6e7KN679MtEsncY1jczs7otixlzdv3EZU ApDwL39Lg5mQpvoI2a+1eVFokGOZte1eBt1WQzkLvxAkDPaGebUnPXd2f1BaeEnPvD6B /Mc8mRKqB2/nAGbEarssWRw3Wlzej9N0Im/yswinCC9QSXAqBHfk2sDHNq7+g19INiog iTow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690236002; x=1690840802; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=LETQ+PNIjvhiFotvbHxFb4HZ3B1gfK+LyzGPrt808Go=; b=BYVbA2fpXzq2c4lieJAKqCDeMFE4QbQyY9aWE4YI+a1DX9g2qFXSMsKOTSBk6lpWpy 4ihA5Ah1Bsf/KyN/rPazST4FTfLvBm2sjsGMmuXJ0Rz9q9psfSvWberJmEDWA4g0bKgP BuXHYS5CaQ8qLiiJ5LpGOAKelRfc9qYfov213vouYmnGpmYm0h7raPq3a1GbszzbTsPl Zvd0o6WlDaJp8cEDahW4S+ta2WE8PAQJGTcLfWzv9/E5Tem+x6TFjVxvfJc/Iv7thwGb IdaqjOoTJSAZD2nGnSByT+bAIjkSSPE49XH7BArKazlp4vEapwApF3/t6ceqGHM6LZCp GH5A== X-Gm-Message-State: ABy/qLZPc9Nm8yHCbiuwWhRZykqnPfoR6RjDKJv5xueiFL3hHvwaF1ss U4bLGtae3T0L7RZsgnraqrw= X-Google-Smtp-Source: APBJJlF7Lon5Ziawibh7CMEXo/gYhz45yFxlAPJsltoWZYs5am+L3ltSJNH+dU8ZH68G/XMX4Suxmw== X-Received: by 2002:a05:622a:58f:b0:400:8580:1025 with SMTP id c15-20020a05622a058f00b0040085801025mr1057088qtb.2.1690236002370; Mon, 24 Jul 2023 15:00:02 -0700 (PDT) Received: from localhost ([2607:fea8:529e:7800::3cbb]) by smtp.gmail.com with ESMTPSA id bw14-20020a05622a098e00b00404e686bcd1sm3626558qtb.72.2023.07.24.15.00.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 15:00:01 -0700 (PDT) Date: Mon, 24 Jul 2023 18:00:00 -0400 From: Richard Acayan To: Marton Balint Message-ID: References: <20230718220017.3336-1-mailingradian@gmail.com> <87aa211d-9bc3-451a-748f-c119a548fc73@passwd.hu> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87aa211d-9bc3-451a-748f-c119a548fc73@passwd.hu> Subject: Re: [FFmpeg-devel] [RESEND PATCH] avcodec/v4l2_context: always log 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: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Sun, Jul 23, 2023 at 10:15:50AM +0200, Marton Balint wrote: > > > On Fri, 21 Jul 2023, Richard Acayan wrote: > >> Will this patch be applied or receive any comments? I have been waiting >> more than 2 weeks since the original submission >> (https://ffmpeg.org/pipermail/ffmpeg-devel/2023-July/311580.html) and >> have not received a response since. >> >> I am trying to get mpv to work again with the v4l2_m2m codec, as it >> started emitting segmentation faults. This is partly due to some >> incorrect usage of libavcodec in mpv, and partly due to the >> error/warning handling in libavcodec. An mpv maintainer dismissed this >> as a bug in ffmpeg, and this change is simpler than what mpv would need >> for a fix, so I am hoping that this patch goes in. >> >> I don't have write access so I can't apply it myself, even if there are >> no objections. >> >> On Tue, Jul 18, 2023 at 06:00:17PM -0400, Richard Acayan wrote: >>> 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 >>> --- >>> libavcodec/v4l2_context.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> 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) { > > This would warn if no buffers are allocated yet, but this is not a warning > condition as far as I understand the issue, simply a different API usage > pattern. I assumed that the usage was "incorrect" because the V4L2 API didn't like it. > So maybe it is better to simply do a > > if (!ctx->buffers) > return NULL; > > in the beginning of the if (timeout == 0) block. The sequence in mpv seems to be supported by libavcodec though, so I will do this in v2. > > Thanks, > Marton > >>> 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); >>> -- >>> 2.41.0 >>> _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".