mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
v4l2: bufferpool: Keep processing bitstream buffer
Bitstream buffers may no fit a single v4l2 buffer, following spec recommendation, keep processing the buffer until all the data has been queued. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5100>
This commit is contained in:
parent
de5e1e334e
commit
76fbc79494
1 changed files with 17 additions and 0 deletions
|
@ -2048,6 +2048,8 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer ** buf,
|
||||||
GstV4l2MemoryGroup *group;
|
GstV4l2MemoryGroup *group;
|
||||||
gint index;
|
gint index;
|
||||||
gboolean outstanding;
|
gboolean outstanding;
|
||||||
|
gsize queued_size = 0;
|
||||||
|
gsize remaining_size = 0;
|
||||||
|
|
||||||
if ((*buf)->pool != bpool)
|
if ((*buf)->pool != bpool)
|
||||||
goto copying;
|
goto copying;
|
||||||
|
@ -2121,6 +2123,13 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer ** buf,
|
||||||
goto start_failed;
|
goto start_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Save the amount of data that has been submitted for encoded data */
|
||||||
|
if (GST_VIDEO_INFO_FORMAT (&pool->caps_info) ==
|
||||||
|
GST_VIDEO_FORMAT_ENCODED) {
|
||||||
|
queued_size = gst_buffer_get_size (to_queue);
|
||||||
|
remaining_size = gst_buffer_get_size (*buf) - queued_size;
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove our ref, we will still hold this buffer in acquire as needed,
|
/* Remove our ref, we will still hold this buffer in acquire as needed,
|
||||||
* otherwise the pool will think it is outstanding and will refuse to stop. */
|
* otherwise the pool will think it is outstanding and will refuse to stop. */
|
||||||
gst_buffer_unref (to_queue);
|
gst_buffer_unref (to_queue);
|
||||||
|
@ -2144,6 +2153,14 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer ** buf,
|
||||||
gst_v4l2_buffer_pool_complete_release_buffer (bpool, buffer,
|
gst_v4l2_buffer_pool_complete_release_buffer (bpool, buffer,
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For encoded data, just queue de remaining in the next available
|
||||||
|
* buffer. */
|
||||||
|
if (remaining_size) {
|
||||||
|
*buf = gst_buffer_make_writable (*buf);
|
||||||
|
gst_buffer_resize (*buf, queued_size, -1);
|
||||||
|
return gst_v4l2_buffer_pool_process (pool, buf, frame_number);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue