Re: [PATCHv5 6/8] vb2: add vb2_find_timestamp()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/12/18 7:28 PM, Jonas Karlman wrote:
> Hi Hans,
> 
> Since this function only return DEQUEUED and DONE buffers,
> it cannot be used to find a capture buffer that is both used for
> frame output and is part of the frame reference list.
> E.g. a bottom field referencing a top field that is already
> part of the capture buffer being used for frame output.
> (top and bottom field is output in same buffer)
> 
> Jernej Škrabec and me have worked around this issue in cedrus driver by
> first checking
> the tag/timestamp of the current buffer being used for output frame.
> 
> 
> // field pictures may reference current capture buffer and is not
> returned by vb2_find_tag
> if (v4l2_buf->tag == dpb->tag)
>     buf_idx = v4l2_buf->vb2_buf.index;
> else
>     buf_idx = vb2_find_tag(cap_q, dpb->tag, 0);
> 
> 
> What is the recommended way to handle such case?

That is the right approach for this. Interesting corner case, I hadn't
considered that.

> Could vb2_find_timestamp be extended to allow QUEUED buffers to be returned?

No, because only the driver knows what the current buffer is.

Buffers that are queued to the driver are in state ACTIVE. But there may be
multiple ACTIVE buffers and vb2 doesn't know which buffer is currently
being processed by the driver.

So this will have to be checked by the driver itself.

Regards,

	Hans

> 
> 
> In our sample code we only keep at most one output, one capture buffer
> in queue
> and use buffer indices as tag/timestamp to simplify buffer handling.
> FFmpeg keeps track of buffers/frames referenced and a buffer will not be
> reused
> until the codec and display pipeline have released all references to it.
> 
> Sample code having interlaced and multi-slice support using previous tag
> version of this patchset can be found at:
> https://github.com/jernejsk/LibreELEC.tv/blob/hw_dec_ffmpeg/projects/Allwinner/patches/linux/0025-H264-fixes.patch#L120-L124
> https://github.com/Kwiboo/FFmpeg/compare/4.0.3-Leia-Beta5...v4l2-request-hwaccel
> 
> Regards,
> Jonas



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux