vulkan: Return early in use_buffers

This fixes accesing a buffer in [1] when none is provided.

[1] 3f80bc2e70
This commit is contained in:
columbarius 2024-01-29 13:54:24 +01:00 committed by Wim Taymans
parent 324ec9df15
commit 2b2e53ad90

View file

@ -524,9 +524,11 @@ int spa_vulkan_compute_use_buffers(struct vulkan_compute_state *s, struct vulkan
clear_buffers(s, p); clear_buffers(s, p);
p->format = SPA_VIDEO_FORMAT_UNKNOWN; p->format = SPA_VIDEO_FORMAT_UNKNOWN;
if (n_buffers == 0)
return 0;
bool alloc = flags & SPA_NODE_BUFFERS_FLAG_ALLOC; bool alloc = flags & SPA_NODE_BUFFERS_FLAG_ALLOC;
int ret; int ret;
p->n_buffers = 0;
for (uint32_t i = 0; i < n_buffers; i++) { for (uint32_t i = 0; i < n_buffers; i++) {
if (alloc) { if (alloc) {
if (SPA_FLAG_IS_SET(buffers[i]->datas[0].type, 1<<SPA_DATA_DmaBuf)) { if (SPA_FLAG_IS_SET(buffers[i]->datas[0].type, 1<<SPA_DATA_DmaBuf)) {