mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 05:16:13 +00:00
v4l2videodec: support orphaning
Recent kernels allow REQBUFS(0) on a queue that still has buffers in use (mmapped or exported via dmabuf), orphaning all buffers on the queue. If this is supported, the v4l2videodec element does not have to send a drain request downstream.
This commit is contained in:
parent
dfc20013cc
commit
e2ff87732d
1 changed files with 8 additions and 7 deletions
|
@ -233,19 +233,20 @@ gst_v4l2_video_dec_set_format (GstVideoDecoder * decoder,
|
||||||
gst_v4l2_video_dec_finish (decoder);
|
gst_v4l2_video_dec_finish (decoder);
|
||||||
gst_v4l2_object_stop (self->v4l2output);
|
gst_v4l2_object_stop (self->v4l2output);
|
||||||
|
|
||||||
/* The renegotiation flow don't blend with the base class flow. To
|
/* The renegotiation flow don't blend with the base class flow. To properly
|
||||||
* properly stop the capture pool we need to reclaim our buffers, which
|
* stop the capture pool, if the buffers can't be orphaned, we need to
|
||||||
* will happend through the allocation query. The allocation query is
|
* reclaim our buffers, which will happend through the allocation query.
|
||||||
* triggered by gst_video_decoder_negotiate() which requires the output
|
* The allocation query is triggered by gst_video_decoder_negotiate() which
|
||||||
* caps to be set, but we can't know this information as we rely on the
|
* requires the output caps to be set, but we can't know this information
|
||||||
* decoder, which requires the capture queue to be stopped.
|
* as we rely on the decoder, which requires the capture queue to be
|
||||||
|
* stopped.
|
||||||
*
|
*
|
||||||
* To workaround this issue, we simply run an allocation query with the
|
* To workaround this issue, we simply run an allocation query with the
|
||||||
* old negotiated caps in order to drain/reclaim our buffers. That breaks
|
* old negotiated caps in order to drain/reclaim our buffers. That breaks
|
||||||
* the complexity and should not have much impact in performance since the
|
* the complexity and should not have much impact in performance since the
|
||||||
* following allocation query will happen on a drained pipeline and won't
|
* following allocation query will happen on a drained pipeline and won't
|
||||||
* block. */
|
* block. */
|
||||||
{
|
if (!gst_v4l2_buffer_pool_orphan (&self->v4l2capture->pool)) {
|
||||||
GstCaps *caps = gst_pad_get_current_caps (decoder->srcpad);
|
GstCaps *caps = gst_pad_get_current_caps (decoder->srcpad);
|
||||||
if (caps) {
|
if (caps) {
|
||||||
GstQuery *query = gst_query_new_allocation (caps, FALSE);
|
GstQuery *query = gst_query_new_allocation (caps, FALSE);
|
||||||
|
|
Loading…
Reference in a new issue