glupload/glsink: Missing draining support
@ndufresne
Submitted by Nicolas Dufresne Link to original bug (#786175)
Description
V4L2 in it's archaism requires that all buffers produced are returned before the driver can re-allocate buffers (renegotiate the frame size). This problem is solved by draining (returning back) all buffers when an allocation or drain query passes buy. This has been implemented properly in kmssink. The following pipeline currently fails on the first renegotiation:
gst-launch-1.0 v4l2src io-mode=dmabuf ! glimagesink
This work is not trivial and may require few iteration. My plan is to move the EGLImage cache inside the glupload object (needed anyway as the current cache with qdata is not thread safe). This will also clearing the cache when an allocation query, or a drain query is received.
That will help, but won't be sufficient, as the glupload element simply attach the imported buffer to a new buffer (it's half pass-through). We'll need to make sure that it runs in return a downstream allocation query. glvideoconvert would need to do the same when running asynchronously (sync fence) and finally the sinks themself need to copy their render buffer for potential redraws during the process. I think all this should be condition (e.g. sink can check if the render buffer has a parent buffer).
Version: 1.13.x