Hi, I want to zero-copy pass dma buffer (NvBuffer) to GstBuffer for video streaming.
While scrolling this forum I found poorpong_nvmm sample application. After some tweaks it works on my side, but I’m struggling with gst_buffer_new_wrapped_full
call in feed_function
.
From sample it’s
buffer = gst_buffer_new_wrapped_full(flags,
data,
par.nv_buffer_size,
0,
par.nv_buffer_size,
user_data,
notify_to_destroy);
and then
gst_buffer_map (buffer, &map, GST_MAP_WRITE);
memcpy(map.data, par.nv_buffer, par.nv_buffer_size);
gst_buffer_unmap(buffer, &map);
What is nv_buffer_size? On my side it’s always equal to 1008 bytes. I assume, this is size of NvBuffer internal struct, or smth like that. Definitely not actual buffer size. Why does the above code works?
According to docs i rewrote the following call as
GstBuffer *buffer = gst_buffer_new_wrapped_full(
(GstMemoryFlags)0,
par.nv_buffer,
par.psize[0],
par.offset[0],
par.psize[0],
user_data,
notify_to_destroy
);
and skipped gst_buffer_map
with memcpy
calls.
Looks like everything is working as intended.
So, the question is: what is nv_buffer_size and why code from poorpong_nvmm actually works?