From: Andriy Gelman <andriy.gelman@gmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v5 1/7] avcodec/v4l2_context: don't reinit output queue when dynamic resolution change
Date: Tue, 4 Jan 2022 17:22:19 -0500
Message-ID: <20220104222219.yl35omgchbfyl4jc@jackie> (raw)
In-Reply-To: <20220104090836.31660-1-ming.qian@nxp.com>
On Tue, 04. Jan 17:08, 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 <ming.qian@nxp.com>
> ---
> 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);
> - 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);
> --
> 2.33.0
lgtm
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".
prev parent reply other threads:[~2022-01-04 22:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-04 9:08 Ming Qian
2022-01-04 9:08 ` [FFmpeg-devel] [PATCH v5 2/7] avcodec/v4l2_m2m: remove ff_v4l2_m2m_codec_full_reinit Ming Qian
2022-01-04 9:08 ` [FFmpeg-devel] [PATCH v5 3/7] avcodec/v4l2_context: add v4l2_start_decode Ming Qian
2022-01-04 22:37 ` Andriy Gelman
2022-01-04 9:08 ` [FFmpeg-devel] [PATCH v5 4/7] avcodec/v4l2_context: set resolution change if decoded format changed Ming Qian
2022-01-04 9:08 ` [FFmpeg-devel] [PATCH v5 5/7] avcodec/v4l2_context: resume the decoding process after source change event received Ming Qian
2022-01-04 22:41 ` Andriy Gelman
2022-01-12 4:44 ` Ming Qian
2022-01-04 9:08 ` [FFmpeg-devel] [PATCH v5 6/7] avcodec/v4l2_context: sync v4l2 context status with driver Ming Qian
2022-01-04 9:08 ` [FFmpeg-devel] [PATCH v5 7/7] avcodec/v4l2_m2m_dec: setup capture queue before enqueue the first frame Ming Qian
2022-03-21 7:27 ` [FFmpeg-devel] [EXT] " Ming Qian
2022-03-26 15:42 ` Andriy Gelman
2022-03-29 6:51 ` Ming Qian
2022-04-03 22:29 ` Andriy Gelman
2022-04-04 12:14 ` Ming Qian
2022-01-04 22:22 ` Andriy Gelman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220104222219.yl35omgchbfyl4jc@jackie \
--to=andriy.gelman@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git