unixfdsrc: fix allocating FD memory with nonzero offsets
The element should allocate GstFdMemory large enough to fit incoming memory's size plus its potential offset. Fixes "gst_memory_resize: assertion 'size + mem->offset + offset <= mem->maxsize' failed". Fixes an issue reproducible on Raspberry Pi 4 that results in a garbled image on the receiver's end: gst-launch-1.0 libcamerasrc ! unixfdsink socket-path=/tmp/socket gst-launch-1.0 unixfdsrc socket-path=/tmp/socket ! autovideosink Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8025>
This commit is contained in:
parent
98bcd041d1
commit
75517d0faf
@ -405,10 +405,10 @@ again:
|
||||
ctx->id = new_buffer->id;
|
||||
ctx->n_memory = new_buffer->n_memory;
|
||||
for (int i = 0; i < new_buffer->n_memory; i++) {
|
||||
GstMemory *mem = gst_fd_allocator_alloc (allocator, fds_arr[i],
|
||||
new_buffer->memories[i].size, GST_FD_MEMORY_FLAG_NONE);
|
||||
gst_memory_resize (mem, new_buffer->memories[i].offset,
|
||||
new_buffer->memories[i].size);
|
||||
GstMemory *mem = gst_fd_allocator_alloc_full (allocator, fds_arr[i],
|
||||
new_buffer->memories[i].offset + new_buffer->memories[i].size,
|
||||
new_buffer->memories[i].offset, new_buffer->memories[i].size,
|
||||
GST_FD_MEMORY_FLAG_NONE);
|
||||
GST_MINI_OBJECT_FLAG_SET (mem, GST_MEMORY_FLAG_READONLY);
|
||||
|
||||
g_hash_table_insert (self->memories, mem, ctx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user