vkupload: don't require that input memory count matches output memory count
It can very easily not. e.g. videotestsrc ! video/x-raw,format=NV12 ! identity drop-allocation=true ! \ vulkanupload ! vulkancolorconvert ! vulkansink Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8530>
This commit is contained in:
parent
08e76f993c
commit
9f7fe58054
@ -722,13 +722,11 @@ _raw_to_image_perform (gpointer impl, GstBuffer * inbuf, GstBuffer ** outbuf)
|
|||||||
|
|
||||||
n_mems = gst_buffer_n_memory (inbuf);
|
n_mems = gst_buffer_n_memory (inbuf);
|
||||||
n_out_mems = gst_buffer_n_memory (*outbuf);
|
n_out_mems = gst_buffer_n_memory (*outbuf);
|
||||||
if (n_mems != n_out_mems)
|
|
||||||
goto unlock_error;
|
|
||||||
n_planes = GST_VIDEO_INFO_N_PLANES (&raw->in_info);
|
n_planes = GST_VIDEO_INFO_N_PLANES (&raw->in_info);
|
||||||
|
|
||||||
for (i = 0; i < n_mems; i++) {
|
for (i = 0; i < n_out_mems; i++) {
|
||||||
VkBufferImageCopy region;
|
VkBufferImageCopy region;
|
||||||
GstMemory *in_mem, *out_mem;
|
GstMemory *in_mem = NULL, *out_mem;
|
||||||
GstVulkanBufferMemory *buf_mem;
|
GstVulkanBufferMemory *buf_mem;
|
||||||
GstVulkanImageMemory *img_mem;
|
GstVulkanImageMemory *img_mem;
|
||||||
const VkImageAspectFlags aspects[] = { VK_IMAGE_ASPECT_PLANE_0_BIT,
|
const VkImageAspectFlags aspects[] = { VK_IMAGE_ASPECT_PLANE_0_BIT,
|
||||||
@ -737,7 +735,9 @@ _raw_to_image_perform (gpointer impl, GstBuffer * inbuf, GstBuffer ** outbuf)
|
|||||||
VkImageAspectFlags plane_aspect;
|
VkImageAspectFlags plane_aspect;
|
||||||
guint idx;
|
guint idx;
|
||||||
|
|
||||||
in_mem = gst_buffer_peek_memory (inbuf, i);
|
if (i < n_mems)
|
||||||
|
in_mem = gst_buffer_peek_memory (inbuf, i);
|
||||||
|
|
||||||
if (gst_is_vulkan_buffer_memory (in_mem)) {
|
if (gst_is_vulkan_buffer_memory (in_mem)) {
|
||||||
GST_TRACE_OBJECT (raw->upload, "Input is a GstVulkanBufferMemory");
|
GST_TRACE_OBJECT (raw->upload, "Input is a GstVulkanBufferMemory");
|
||||||
buf_mem = (GstVulkanBufferMemory *) in_mem;
|
buf_mem = (GstVulkanBufferMemory *) in_mem;
|
||||||
@ -800,7 +800,7 @@ _raw_to_image_perform (gpointer impl, GstBuffer * inbuf, GstBuffer ** outbuf)
|
|||||||
buf_mem = (GstVulkanBufferMemory *) in_mem;
|
buf_mem = (GstVulkanBufferMemory *) in_mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
idx = MIN (i, n_mems - 1);
|
idx = MIN (i, n_out_mems - 1);
|
||||||
out_mem = gst_buffer_peek_memory (*outbuf, idx);
|
out_mem = gst_buffer_peek_memory (*outbuf, idx);
|
||||||
if (!gst_is_vulkan_image_memory (out_mem)) {
|
if (!gst_is_vulkan_image_memory (out_mem)) {
|
||||||
GST_WARNING_OBJECT (raw->upload, "Output is not a GstVulkanImageMemory");
|
GST_WARNING_OBJECT (raw->upload, "Output is not a GstVulkanImageMemory");
|
||||||
@ -808,7 +808,7 @@ _raw_to_image_perform (gpointer impl, GstBuffer * inbuf, GstBuffer ** outbuf)
|
|||||||
}
|
}
|
||||||
img_mem = (GstVulkanImageMemory *) out_mem;
|
img_mem = (GstVulkanImageMemory *) out_mem;
|
||||||
|
|
||||||
if (n_planes == n_mems)
|
if (n_planes == n_out_mems)
|
||||||
plane_aspect = VK_IMAGE_ASPECT_COLOR_BIT;
|
plane_aspect = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||||
else
|
else
|
||||||
plane_aspect = aspects[i];
|
plane_aspect = aspects[i];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user