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 8F9F840FE0 for ; Sun, 2 Jan 2022 16:24:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 78FCE6899A7; Sun, 2 Jan 2022 18:24:00 +0200 (EET) Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 298A968041C for ; Sun, 2 Jan 2022 18:23:54 +0200 (EET) Received: by mail-qk1-f181.google.com with SMTP id m2so27577475qkd.8 for ; Sun, 02 Jan 2022 08:23:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=hjG9JdxgClVDQQaFyO7zHYaHAxODEPn0+eXbcws9NnA=; b=Ljxi5QiJKEs2z/5ewEvNeFwmF/Tr5pc2jkjyXhn3E+LLqOMZxJ2Cr9nTfw+rWhib33 EoY6edG1tlckra+JPXznU+6WcmCkF+j+YN86CtZmScPfyGfjFN87NNvfYxfhwk72QRlB Ya9yzE+7KK9eVjS2mHR5AgmtXll7N3A9iiaTgjoTv2J4c55mm2yo8stL9UBYIBctKh5X Rv6PEOz6DfcZSARkeXdqu93j+fDVcXhy3TRekMUwLjMLoY/wohavHQeVaYCtQcZN93tu ci7TUJuQ52kxBxz5p+mvIRzIsf4XcWAHsf5I/w4D/qqfy04rtkl9OvcHL1zOXVDp2WWk Ghdw== 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:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hjG9JdxgClVDQQaFyO7zHYaHAxODEPn0+eXbcws9NnA=; b=thDDTzrs0Pwc+pOHmrDUwn5vN5M3Jmthq0tBni2krJ5oKoOFo0hWTpd0VMogYnOgOj sDcn5KtiY8YYQEKW29k/5oMT9G9JTwNz7aMV2mVtpnhMBXtZK2j8rUeKjzw9qXqhdKzq +MkqDFR+8lHtUIVoJLQDMc6p53fM7fUjuNfl62Q0E3zdt/nadCpTPn8lZmjNB6pUwk0V AP9v+9p9AbkJ8Y8JjyaGgpbG5VtzCFSCi3jsivO7FgPeK2ZHisPxQ5UHh01WiKo3CpXn FiFcL4XeR+G5d53aDegCJmL6cJzGaVwuXvxd/1IYQ+92ODZ2ZkAJzid3ZgeOxacD2uGR 5epw== X-Gm-Message-State: AOAM533N0DbMPDlctvjBfE7RSZxrdxVAumfba+vCWS3jHW09lydvezwI 1K/otg4qbLUBVJmgrwTkqgzKUjJt2eU= X-Google-Smtp-Source: ABdhPJzhEys3D/trNogcmBv/VGJI8qCTwwYU9FeKYBzQUrUlMyW6ozEWOwEmCBaB2vokEd2rc1S68Q== X-Received: by 2002:a05:620a:a0f:: with SMTP id i15mr30894434qka.332.1641140632620; Sun, 02 Jan 2022 08:23:52 -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 b9sm26804441qtb.53.2022.01.02.08.23.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jan 2022 08:23:52 -0800 (PST) Date: Sun, 2 Jan 2022 11:23:50 -0500 From: Andriy Gelman To: FFmpeg development discussions and patches Message-ID: <20220102162350.lkdedjwlgfr6lgec@jackie> References: <20210819085533.1174-1-ming.qian@nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210819085533.1174-1-ming.qian@nxp.com> Subject: Re: [FFmpeg-devel] [PATCH v4 1/3] avcodec/v4l2_context: don't reinit output queue when dynamic resolution change 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: Ming Qian 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: > in the v4l2 stateful video document, we can see the following > description: > During the resolution change sequence, the OUTPUT queue must remain > streaming. Calling VIDIOC_STREAMOFF() on the OUTPUT queue would > abort the sequence and initiate a seek. > > In principle, the OUTPUT queue operates separately from the CAPTURE > queue and this remains true for the duration of the entire > resolution change sequence as well. > > so don't reinit the output queue when handling the resolution change > event > > Signed-off-by: Ming Qian > --- > libavcodec/v4l2_context.c | 27 ++------------------------- > 1 file changed, 2 insertions(+), 25 deletions(-) > > diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c > index ff1ea8e57b08..dda5157698c3 100644 > --- a/libavcodec/v4l2_context.c > +++ b/libavcodec/v4l2_context.c > @@ -162,9 +162,8 @@ static int v4l2_handle_event(V4L2Context *ctx) > { > V4L2m2mContext *s = ctx_to_m2mctx(ctx); > struct v4l2_format cap_fmt = s->capture.format; > - struct v4l2_format out_fmt = s->output.format; > struct v4l2_event evt = { 0 }; > - int full_reinit, reinit, ret; > + int reinit, ret; > > ret = ioctl(s->fd, VIDIOC_DQEVENT, &evt); > if (ret < 0) { > @@ -180,25 +179,12 @@ static int v4l2_handle_event(V4L2Context *ctx) > if (evt.type != V4L2_EVENT_SOURCE_CHANGE) > return 0; > > - ret = ioctl(s->fd, VIDIOC_G_FMT, &out_fmt); > - if (ret) { > - av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_G_FMT\n", s->output.name); > - return 0; > - } > - > ret = ioctl(s->fd, VIDIOC_G_FMT, &cap_fmt); > if (ret) { > av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_G_FMT\n", s->capture.name); > return 0; > } > > - full_reinit = v4l2_resolution_changed(&s->output, &out_fmt); > - if (full_reinit) { > - s->output.height = v4l2_get_height(&out_fmt); > - s->output.width = v4l2_get_width(&out_fmt); > - s->output.sample_aspect_ratio = v4l2_get_sar(&s->output); > - } > - > reinit = v4l2_resolution_changed(&s->capture, &cap_fmt); > if (reinit) { > s->capture.height = v4l2_get_height(&cap_fmt); > @@ -206,18 +192,9 @@ static int v4l2_handle_event(V4L2Context *ctx) > s->capture.sample_aspect_ratio = v4l2_get_sar(&s->capture); > } > > - if (full_reinit || reinit) > + if (reinit) > s->reinit = 1; > > - if (full_reinit) { > - ret = ff_v4l2_m2m_codec_full_reinit(s); This is the only use of the function ff_v4l2_m2m_codec_full_reinit(). An option is to remove the function in the commit. I can see how this private function could be useful in the future though.. Do we then remove the function and add it back in the future or just let it be? Suggestion on IRC was to remove, but I also want to check on ML. > - if (ret) { > - av_log(logger(ctx), AV_LOG_ERROR, "v4l2_m2m_codec_full_reinit\n"); > - return AVERROR(EINVAL); > - } > - goto reinit_run; > - } > - > if (reinit) { > if (s->avctx) > ret = ff_set_dimensions(s->avctx, s->capture.width, s->capture.height); Otherwise, the patch looks good to me. Sorry for the delay. 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".