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 74B2840FEF for ; Sun, 2 Jan 2022 16:53:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AE91D68B161; Sun, 2 Jan 2022 18:53:20 +0200 (EET) Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 43D026897E2 for ; Sun, 2 Jan 2022 18:53:14 +0200 (EET) Received: by mail-qv1-f52.google.com with SMTP id kk22so29028876qvb.0 for ; Sun, 02 Jan 2022 08:53:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=3JN7Mjmuhj1qBWry4eI4+R1D6CPGIh1LNLCL2DR8yhM=; b=qTpj9e1ZvO7/bpW+o/uf3lPM1mg5XvY3H3yvyad75Rq7tAUppV84+EI/jt6GFRhslQ GP6vIWL9YDRTc4Gz1++l2FnBwFc7bgfP4QPgyOc9kTFTzeEKB7nrK5oliuBntuve22fV qztzj3GIJaFdRIOLyMQuiCf2ZGeJQLV5+PjQcWxEbdIfl/sdK0KzTsN+3Da2vwqq2Gre kZXFwU/GgbJ9q3/KatFoRlILrcmEJCAToRZemmki8tunJUnSRGcDIxsbZBPMwhXp44gI +DJEmeFT2abaCwIk4262CA9vTE2hBSz0Kcfa02zh6P93N5VbAl4MrjXR3zYQ2aM2AZb9 F/rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=3JN7Mjmuhj1qBWry4eI4+R1D6CPGIh1LNLCL2DR8yhM=; b=jssf4vbGC+W4qU0iW0ZrvF1MgwinnC6VKiQNVQX183Ngg+XKOpO5t2AyNWniUX2WUr A3TRpde0+tjLzSV29YUqAe/p3jk2yD+Hle77HhQdqgk5T4N+AshyNEhw/ubUOVJc9Pgx akxwEATc+F1qFsmdubdWBq/81lo37CDbSyj2kRJONFK8tZA2MsHsuNJ8E4dCFHWbDHYu ogcHhlx5/ZsrJJXnkb2rwaR9zLBwscUVDhasdb0TUFu8puO/VFWIqR90l6njn96Cycda yA8/1COZlJcRKGWkI1zYA+EM7ypO+ylnw+obDy7eQG3LJMAjL72YKZpzsa+0VGumgCwy zMKA== X-Gm-Message-State: AOAM53034jS4Wvl58lDRnbARi5ogyPPBIWs9+Bkk1Ar/gqXmqipgcTLJ uT/lkdd1vtADXkWy9+0Lt1YU0SJ6rTU= X-Google-Smtp-Source: ABdhPJzLbpgxAWU7w7rAG/WqIhvpZXzKtd1yyH0iv0OrqwalDu1h3VmSe4xtuvkTZYNrdGdyD7pnKw== X-Received: by 2002:a05:6214:62e:: with SMTP id a14mr38881741qvx.14.1641142392735; Sun, 02 Jan 2022 08:53:12 -0800 (PST) Received: from jackie (pool-108-20-185-127.bstnma.fios.verizon.net. [108.20.185.127]) by smtp.gmail.com with ESMTPSA id o21sm28063812qta.89.2022.01.02.08.53.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jan 2022 08:53:11 -0800 (PST) Date: Sun, 2 Jan 2022 11:53:10 -0500 From: Andriy Gelman To: FFmpeg development discussions and patches Message-ID: <20220102165310.agu7efa2fpba7eup@jackie> References: <20210819085533.1174-1-ming.qian@nxp.com> <20210819085533.1174-3-ming.qian@nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210819085533.1174-3-ming.qian@nxp.com> Subject: Re: [FFmpeg-devel] [PATCH v4 3/3] avcodec/v4l2_m2m_dec: setup capture queue before enqueue the first frame 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: On Thu, 19. Aug 16:55, Ming Qian wrote: > there are two proper ways to setup capture queue. > 1. client wait the source change event, > then setup the capture queue and streamon > 2. client setup the capture queue in advance, > but to avoid time issues, client should start > the capture queue before it enqueue the sequence > header to decoder driver through output queue. > and the sequence header is always in the first > frame, so client should start capture before > enqueue the first frame. > > ffmpeg use the method 2 to setup capture queue, > but currently ffmpeg enqueue the first frame > before starting the capture queue. > so in driver side, there are time issues. > when driver has parsed the resolution from sequence header, > but the client may not finished setup the capture. > so driver can't decide whether to notify a source change event to > client. and the following flow may be chaotic. > > And it's OK that client setup capture queue first, then enqueue the > first frame. > > Signed-off-by: Ming Qian > --- > libavcodec/v4l2_m2m_dec.c | 18 ++++++++---------- > 1 file changed, 8 insertions(+), 10 deletions(-) > > diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c > index 224eb3d5e7be..6b936b6df2a9 100644 > --- a/libavcodec/v4l2_m2m_dec.c > +++ b/libavcodec/v4l2_m2m_dec.c > @@ -149,6 +149,14 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) > if (s->draining) > goto dequeue; > > + ret = v4l2_try_start(avctx); > + if (ret) { > + /* can't recover */ > + if (ret != AVERROR(ENOMEM)) > + ret = 0; > + goto fail; > + } > + > ret = ff_v4l2_context_enqueue_packet(output, &s->buf_pkt); > if (ret < 0 && ret != AVERROR(EAGAIN)) > goto fail; > @@ -157,16 +165,6 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) > if (ret != AVERROR(EAGAIN)) > av_packet_unref(&s->buf_pkt); > > - if (!s->draining) { > - ret = v4l2_try_start(avctx); > - if (ret) { > - /* cant recover */ > - if (ret != AVERROR(ENOMEM)) > - ret = 0; > - goto fail; > - } > - } > - > dequeue: > return ff_v4l2_context_dequeue_frame(capture, frame, -1); > fail: Unfortunately this does not work on odroid xu4. It needs to parse the parameter sets before VIDIOC_G_FMT ioctl is called on the capture queue: https://github.com/hardkernel/linux/blob/odroid-5.4.y/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c#L317 Thanks, -- Andriy _______________________________________________ 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".