[FFmpeg-devel] [EXT] [PATCH v5 7/7] avcodec/v4l2_m2m_dec: setup capture queue before enqueue the first frame

Andriy Gelman andriy.gelman at gmail.com
Sat Mar 26 17:42:45 EET 2022


Hi Ming,

On Mon, 21. Mar 07:27, Ming Qian wrote:
> Hi Andriy,
> 
>     What do you think of this patch?
> 
>     The Initialization flow defined in linux/Documentation/userspace-api/media/v4l/dev-decoder.rst
> 1. Set the coded format on OUTPUT via VIDIOC_S_FMT().
> 2. Allocate source (bytestream) buffers via VIDIOC_REQBUFS() on OUTPUT.
> 3. Start streaming on the OUTPUT queue via VIDIOC_STREAMON().
> 4. This step only applies to coded formats that contain resolution information in the stream. Continue queuing/dequeuing bytestream buffers to/from the OUTPUT queue via VIDIOC_QBUF() and VIDIOC_DQBUF(). The buffers will be processed and returned to the client in order, until required metadata to configure the CAPTURE queue are found. This is indicated by the decoder sending a V4L2_EVENT_SOURCE_CHANGE event with changes set to V4L2_EVENT_SRC_CH_RESOLUTION.
> 	Note: A client capable of acquiring stream parameters from the bytestream on its own may attempt to set the width and height of the OUTPUT format to non-zero values matching the coded size of the stream, skip this step and continue with the Capture Setup sequence.
> 
> 5. Continue with the Capture Setup sequence.
> 
>     In ffmpeg's implementation, ffmpeg will set non-zero width and height on output queue, so the step 4 should be skipped, and setup the capture queue directly.
>     So the flow should be:
> 1. Set the coded format and valid resolution on OUTPUT via VIDIOC_S_FMT().
> 2. Allocate source (bytestream) buffers via VIDIOC_REQBUFS() on OUTPUT.
> 3. Start streaming on the OUTPUT queue via VIDIOC_STREAMON().
> 5. Continue with the Capture Setup sequence.
> 
> And this patch is just following the above flow.
> 
> Ming

The v4 version didn't work for me on odroid xu4
http://ffmpeg.org/pipermail/ffmpeg-devel/2022-January/290679.html

I haven't had time retest but don't think anything has changed.

-- 
Andriy


More information about the ffmpeg-devel mailing list