> From: Andriy Gelman
> Sent: Monday, April 4, 2022 6:29 AM
> To: Ming Qian
> Cc: FFmpeg development discussions and patches de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [EXT] [PATCH v5 7/7] avcodec/v4l2_m2m_dec:
> setup capture queue before enqueue the first frame
&g
> From: Andriy Gelman [mailto:andriy.gel...@gmail.com]
> Sent: Saturday, March 26, 2022 11:43 PM
> To: FFmpeg development discussions and patches
> Cc: Ming Qian
> Subject: Re: [FFmpeg-devel] [EXT] [PATCH v5 7/7] avcodec/v4l2_m2m_dec:
> setup capture queue before enque
For the reason similar to decoder,
Set a reasonable timeout instead of -1
to avoid dead waiting in some case.
Signed-off-by: Ming Qian
---
libavcodec/v4l2_context.c | 4 ++--
libavcodec/v4l2_context.h | 2 +-
libavcodec/v4l2_m2m_enc.c | 5 -
3 files changed, 7 insertions(+), 4 deletions
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.
Signed-off-by: Ming Qian
---
libavcodec/v4l2_m2m.h | 5
if the v4l2 buffer is supported to export dma-buf,
then we can report it to AV_PIX_FMT_DRM_PRIME,
so the caller can pass it to other hardware device,
such as display it directly without copy frame data.
Signed-off-by: Ming Qian
---
libavcodec/v4l2_buffers.c | 115
queue via VIDIOC_STREAMON().
5. Continue with the Capture Setup sequence.
And this patch is just following the above flow.
Ming
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Ming Qian
> Sent: Tuesday, January 4, 2022 5:09 PM
> To: ffmpeg-devel@ffmpeg.o
On Tue, 04. Jan 17:41, Andriy Gelman wrote:
> On Tue, 04. Jan 17:08, Ming Qian wrote:
> > client need to resume the decoding process
> > after it dequeues the source change event.
> > no matter what's the return value of v4l2_resolution_changed().
> > if the client
> -Original Message-
> From: Andriy Gelman [mailto:andriy.gel...@gmail.com]
> Sent: Sunday, January 9, 2022 1:13 AM
> To: Ming Qian
> Cc: FFmpeg development discussions and patches
> Subject: Re: [EXT] Re: [FFmpeg-devel] [PATCH v4 2/3] avcodec/v4l2_context:
>
> -Original Message-
> From: Andriy Gelman [mailto:andriy.gel...@gmail.com]
> Sent: Wednesday, January 5, 2022 6:58 AM
> To: Ming Qian
> Cc: FFmpeg development discussions and patches
> Subject: Re: [EXT] Re: [FFmpeg-devel] [PATCH v4 2/3] avcodec/v4l2_context:
>
() with the
V4L2_DEC_CMD_START command.
2. Continue with the Capture Setup sequence.
Signed-off-by: Ming Qian
---
libavcodec/v4l2_context.c | 31 +++
1 file changed, 11 insertions(+), 20 deletions(-)
diff --git a/libavcodec/v4l2_context.c b/libavcodec
. the minimum number of buffers needed for decoding
4. bit-depth of the bitstream has been changed
when the bit-depth is changed, the pixel format will be changed,
so the format is changed after a source change event,
we should handle it and reinit the capture queue.
Signed-off-by: Ming Qian
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 b0c3d30ac8ae..e67758531ace 100644
--- a/libavcodec
on dynamic resolution change,
The decoding process must be resumed with either a pair of calls to
VIDIOC_STREAMOFF() and VIDIOC_STREAMON() on the CAPTURE queue, or a call
to VIDIOC_DECODER_CMD() with the V4L2_DEC_CMD_START command.
Signed-off-by: Ming Qian
---
libavcodec/v4l2_context.c | 18
Check v4l2 context before call VIDIOC_STREAMON() or
VIDIOC_STREAMOFF().
Signed-off-by: Ming Qian
---
libavcodec/v4l2_context.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index b7b584dfbef6..8910ae08d3a5 100644
--- a/libavcodec
ff_v4l2_m2m_codec_full_reinit is not used any more,
so remove it.
Signed-off-by: Ming Qian
---
libavcodec/v4l2_m2m.c | 76 ---
libavcodec/v4l2_m2m.h | 10 --
2 files changed, 86 deletions(-)
diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c
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
> -Original Message-
> From: Andriy Gelman [mailto:andriy.gel...@gmail.com]
> Sent: Monday, January 3, 2022 12:41 AM
> To: FFmpeg development discussions and patches
> Cc: Ming Qian
> Subject: [EXT] Re: [FFmpeg-devel] [PATCH v4 2/3] avcodec/v4l2_context:
> resume
> -Original Message-
> From: Andriy Gelman [mailto:andriy.gel...@gmail.com]
> Sent: Monday, January 3, 2022 12:24 AM
> To: FFmpeg development discussions and patches
> Cc: Ming Qian
> Subject: [EXT] Re: [FFmpeg-devel] [PATCH v4 1/3] avcodec/v4l2_context: don't
> rei
if the v4l2 buffer is supported to export dma-buf,
then we can report it to AV_PIX_FMT_DRM_PRIME,
so the caller can pass it to other hardware device,
such as display it directly without copy frame data.
Signed-off-by: Ming Qian
---
libavcodec/v4l2_buffers.c | 115
> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Ming Qian
> Sent: Monday, November 15, 2021 10:49 AM
> To: FFmpeg development discussions and patches
> Subject: Re: [FFmpeg-devel] [EXT] Re: [PATCH v1 2/2] avcodec/v4l2_buf
port
> v4l2 buffer dma-buf
>
> Caution: EXT Email
>
> 12 Nov 2021, 09:36 by ming.q...@nxp.com:
>
> > Signed-off-by: Ming Qian
> > ---
> > libavcodec/v4l2_buffers.c | 14 ++
> > libavcodec/v4l2_buffers.h | 1 + libavcodec/v4l2_context.c | 4 ++
Signed-off-by: Ming Qian
---
libavcodec/v4l2_buffers.c | 14 ++
libavcodec/v4l2_buffers.h | 1 +
libavcodec/v4l2_context.c | 4
3 files changed, 19 insertions(+)
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index 4b2679eb3814..efa42f4c58ea 100644
add a member dmafd in buffer struct.
we can use it represents dma-buf.
Signed-off-by: Ming Qian
---
libavutil/buffer.c | 12
libavutil/buffer.h | 14 ++
libavutil/buffer_internal.h | 1 +
3 files changed, 27 insertions(+)
diff --git a/libavutil
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
() with the
V4L2_DEC_CMD_START command.
2. Continue with the Capture Setup sequence.
Signed-off-by: Ming Qian
---
libavcodec/v4l2_context.c | 52 ---
1 file changed, 32 insertions(+), 20 deletions(-)
diff --git a/libavcodec/v4l2_context.c b
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
> -Original Message-
> From: Andriy Gelman [mailto:andriy.gel...@gmail.com]
> Sent: Tuesday, August 17, 2021 1:34 AM
> To: Ming Qian
> Cc: FFmpeg development discussions and patches
> Subject: Re: [EXT] Re: [FFmpeg-devel] [PATCH v3 1/3] avcodec/v4l2_context:
> don'
> capture streamon -> capture streamoff -> capture
streamon.
Then it may led to some unforeseen and serious problems.
So to avoid such timing issues, the client should setup the
capture queue after the first source change event is received.
Signed-off-by: Ming Qian
---
libavcodec/v
() with the
V4L2_DEC_CMD_START command.
2. Continue with the Capture Setup sequence.
Signed-off-by: Ming Qian
---
libavcodec/v4l2_context.c | 31 +++
1 file changed, 11 insertions(+), 20 deletions(-)
diff --git a/libavcodec/v4l2_context.c b/libavcodec
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
() with the
V4L2_DEC_CMD_START command.
2. Continue with the Capture Setup sequence.
Signed-off-by: Ming Qian
---
libavcodec/v4l2_context.c | 31 +++
1 file changed, 11 insertions(+), 20 deletions(-)
diff --git a/libavcodec/v4l2_context.c b/libavcodec
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
() with the
V4L2_DEC_CMD_START command.
2. Continue with the Capture Setup sequence.
Signed-off-by: Ming Qian
---
libavcodec/v4l2_context.c | 31 +++
1 file changed, 11 insertions(+), 20 deletions(-)
diff --git a/libavcodec/v4l2_context.c b/libavcodec
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
> On Wed, 29. Apr 16:14, Ming Qian wrote:
> > Without this setting, bitrate may have no effect
> > if the default value of bitrate mode is VBR.
> >
> > Signed-off-by: Ming Qian
> > ---
> > libavcodec/v4l2_m2m_enc.c | 1 +
> > 1 fi
> From: Andriy Gelman
>
> V4L2 api can indicate that flushing of the capture buffers is completed by
> setting the V4L2_BUF_FLAG_LAST flag.
> Use guards because the flag was only defined in Linux v4.2.
>
> Reference:
> linux/Documentation/media/uapi/v4l/dev-decoder.rst
>
> "The client must
> From: Andriy Gelman
>
> v4l2_m2m devices may send an empty packet/frame while draining to indicate
> that all capture buffers have been flushed.
>
> Currently, the empty packet/frame is not handled correctly:
> When encoding, the empty packet is forwarded to the muxer, usually creating
>
Without this setting, bitrate may have no effect
if the default value of bitrate mode is VBR.
Signed-off-by: Ming Qian
---
libavcodec/v4l2_m2m_enc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
index 8454e2326c..6296ad88c6
hanges in v5:
> - Check that qmin does not exceed qmax (thanks for feedback from Ming
> Qian)
>
> libavcodec/v4l2_m2m_enc.c | 23 +++
> 1 file changed, 19 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2
lgtm
Best regards,
Ming Qian
Tel#:86-512-6805-6630
-Original Message-
From: ffmpeg-devel On Behalf Of Andriy Gelman
Sent: Saturday, March 14, 2020 10:32 PM
To: ffmpeg-devel@ffmpeg.org
Subject: [EXT] Re: [FFmpeg-devel] [PATCH v4 1/3] avcodec/v4l2_m2m_enc: Reduce
log verbosity
Lgtm,
But if don't prevent enqueue frame buffer of capture port, unlikely to happen
this case.
And I think we can get a proper num_frame_buffers by g_ctrl
V4L2_CID_MIN_BUFFERS_FOR_CAPTURE and V4L2_CID_MIN_BUFFERS_FOR_OUTPUT.
Best regards,
Ming Qian
Tel#:86-512-6805-6630
-Original
ure buffers
are dequeued (v4l2_context.c:300), and this patch would prevent it (although
it's not needed if an eos event is received).
Yes, but I think it's not appropriate to judge whether the capture port is done
by checking all the capture buffers are dequeued.
Best regards,
Ming Qian
Tel#:86-
the capture buffers
Signed-off-by: Ming Qian
---
libavcodec/v4l2_context.c | 6 ++
libavcodec/v4l2_m2m_dec.c | 8
libavcodec/v4l2_m2m_enc.c | 19 +++
3 files changed, 33 insertions(+)
diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index 8110bbb555
at the end of encoding/decoding when
flushing the capture buffers
Signed-off-by: Ming Qian
---
libavcodec/v4l2_context.c | 5 +
libavcodec/v4l2_m2m_dec.c | 9 +
libavcodec/v4l2_m2m_enc.c | 20
3 files changed, 34 insertions(+)
diff --git a/libavcodec
v4l2 set the frame rate through frame intervals,
not set frame rate directly.
the frame rate and frame intervals are reciprocal.
so in libavdevice/v4l2.c we can see the following code:
tpf->numerator = framerate_q.den;
tpf->denominator = framerate_q.num;
Signed-off-by: Min
at the end of encoding/decoding when
flushing the capture buffers
Signed-off-by: Ming Qian
---
libavcodec/v4l2_context.c | 5 +
libavcodec/v4l2_m2m_dec.c | 9 +
libavcodec/v4l2_m2m_enc.c | 22 +-
3 files changed, 35 insertions(+), 1 deletion(-)
diff --git
10:02, Ming Qian wrote:
> the draining is set when the output port is finished,
> but it doesn't mean the capture port is finished.
> especially for decoder, there may be a stream buffer to store several
> frames.
> so the decoder still need capture buffer even if the draining is
when the last frame of capture is dequeueed,
driver may send this V4L2_EVENT_EOS event,
if this event is received, then we can set the capture port done
Signed-off-by: Ming Qian
---
libavcodec/v4l2_context.c | 5 +
libavcodec/v4l2_m2m_dec.c | 10 ++
libavcodec/v4l2_m2m_enc.c | 22
the draining is set when the output port is finished,
but it doesn't mean the capture port is finished.
especially for decoder, there may be a stream buffer to store several
frames.
so the decoder still need capture buffer even if the draining is set.
Signed-off-by: Ming Qian
---
libavcodec
v4l2 set the frame rate through frame intervals,
not set frame rate directly.
the frame rate and frame intervals are reciprocal.
so in libavdevice/v4l2.c we can see the following code:
tpf->numerator = framerate_q.den;
tpf->denominator = framerate_q.num;
Signed-off-by: Min
50 matches
Mail list logo