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 49B1E4035A for ; Thu, 24 Mar 2022 11:22:12 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1BCC968B165; Thu, 24 Mar 2022 13:22:10 +0200 (EET) Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B285D68ADF6 for ; Thu, 24 Mar 2022 13:22:03 +0200 (EET) Received: from w3.tutanota.de (unknown [192.168.1.164]) by w4.tutanota.de (Postfix) with ESMTP id 11EBF1060300 for ; Thu, 24 Mar 2022 11:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1648120922; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=6SdaX/aKTGt7qIl2657+J9mdVjQ1uziDLa4UDKIS61I=; b=S0gzbtQ1OUWEdIVm65Y8d7RTXDPADUsZmVNTLpXkMQ/WHWmOYt0rKXYIZUNLHnqJ P/v7aiZw5/rcCvdZLKZdCsodd72TkKbEWdqz96ivem7vqvQWE2aWabdlFZalTbmKfjO 1ijDQOMzntb8D1hVaaODYx5MiS4JgpBmihl6SPm4zbS7X9idhdmAF7uPflbZ3nTqTJC NYK7tMn3ZbijKk18xaxSD8MAza3gusH7tsOaqhi/GGpNRc3ddrITko07OOfntMqKEQN BSNhuJYztBbynBNzPOX2ZOuaDbryiLcX8OKGrVLd72wLn6MQVWQjgtPxi8A4WPUuGnq JyWx52N6Hw== Date: Thu, 24 Mar 2022 12:22:02 +0100 (CET) From: Lynne To: FFmpeg development discussions and patches Message-ID: In-Reply-To: References: MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 1/2] avcodec/v4l2_m2m_dec: add a dequeue_timeout parameter 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 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: 24 Mar 2022, 07:14 by ming.qian@nxp.com: > the dequeue of capture queue will be blocked until > decoded frame available or an input buffer is ready to be dequeued. > but it may cause death waiting in some case. > For example, it has enqueued the first input frame, > and then blocks at ff_v4l2_context_dequeue_frame. > For some reason, the decoder can't decode the first frame, > also it can't return the input buffer. The decoder needs more input data > to decode, so the decoder is just waiting. > This creates some kind of deadlock. > > And in linux/Documentation/userspace-api/media/v4l/dev-decoder.rst, > there are some descriptor like below: > The client must not assume any direct relationship between CAPTURE and > OUTPUT buffers and any specific timing of buffers becoming available to dequeue. > Specifically: > [snip] > - a buffer queued to OUTPUT may result in a buffer being produced on CAPTURE > later into decode process, and/or after processing further OUTPUT buffers, > or be returned out of order, e.g. if display reordering is used, > > And I meet a similar case, there are 16 output buffers, but only one > buffer is queued to driver, then blocks at > ff_v4l2_context_dequeue_frame. > But the decoder need more frame data, otherwise it won't decode it. > > So I think the client should keep processing OUTPUT buffers if there are > available buffers until the end. > > To resolve it, I think we can set a reasonable timeout instead of -1. > So I add a parameter dequeue_timeout, and it works on my side. > Adding a timeout isn't a fix, it's a hack. Can't the driver return EAGAIN to ask for more data, or ENOBUFS if it has nothing to decode into? Why hasn't this been needed so far? _______________________________________________ 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".