mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
v4l2bufferpool: queue back the buffer flagged LAST but empty
Some decoder drivers need to wait enough capture buffers before starting to decode. But the dequeued buffer flag LAST but empty has no chance to queue back to driver, which makes decode hang after seek. So need to queue back such kind of buffer to driver. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6579>
This commit is contained in:
parent
e1f5bacf8d
commit
105d232fde
1 changed files with 11 additions and 6 deletions
|
@ -1238,6 +1238,7 @@ static GstFlowReturn
|
|||
gst_v4l2_buffer_pool_dqbuf (GstV4l2BufferPool * pool, GstBuffer ** buffer,
|
||||
gboolean * outstanding, gboolean wait)
|
||||
{
|
||||
GstBufferPool *bpool = GST_BUFFER_POOL_CAST (pool);
|
||||
GstFlowReturn res;
|
||||
GstBuffer *outbuf = NULL;
|
||||
GstV4l2Object *obj = pool->obj;
|
||||
|
@ -1281,12 +1282,6 @@ gst_v4l2_buffer_pool_dqbuf (GstV4l2BufferPool * pool, GstBuffer ** buffer,
|
|||
group->buffer.index);
|
||||
}
|
||||
|
||||
if (group->buffer.flags & V4L2_BUF_FLAG_LAST &&
|
||||
group->planes[0].bytesused == 0) {
|
||||
GST_DEBUG_OBJECT (pool, "Empty last buffer, signalling eos.");
|
||||
goto eos;
|
||||
}
|
||||
|
||||
outbuf = pool->buffers[group->buffer.index];
|
||||
if (outbuf == NULL)
|
||||
goto no_buffer;
|
||||
|
@ -1298,6 +1293,16 @@ gst_v4l2_buffer_pool_dqbuf (GstV4l2BufferPool * pool, GstBuffer ** buffer,
|
|||
GST_OBJECT_UNLOCK (pool);
|
||||
}
|
||||
|
||||
if (group->buffer.flags & V4L2_BUF_FLAG_LAST &&
|
||||
group->planes[0].bytesused == 0) {
|
||||
GST_DEBUG_OBJECT (pool, "Empty last buffer, signalling eos.");
|
||||
*buffer = outbuf;
|
||||
outbuf = NULL;
|
||||
gst_buffer_ref (*buffer);
|
||||
gst_v4l2_buffer_pool_complete_release_buffer (bpool, *buffer, FALSE);
|
||||
goto eos;
|
||||
}
|
||||
|
||||
timestamp = GST_TIMEVAL_TO_TIME (group->buffer.timestamp);
|
||||
|
||||
for (i = 0; i < group->n_mem; i++) {
|
||||
|
|
Loading…
Reference in a new issue