Hi,
I have our application instantiating a gsreamer pipeline running on Jetson Orin NX.
It basically captures frames directly into NVMM memory for later processing with CUDA.
nvv4l2camerasrc device=/dev/video0 ! video/x-raw(memory:NVMM),width=1920,height=1080,framerate=25/1 ! appsink name=i_appsink sync=false drop=true max-buffers=5
events for appsink frame ready are enabled using:
g_object_set (G_OBJECT (appsink), "emit-signals", TRUE, "sync", FALSE, NULL);
g_signal_connect (appsink, "new-sample", G_CALLBACK (on_buffer), NULL);
callback function is a straightforward one:
void on_buffer(GstAppSink * sink, Callback_Data* callback_data) {
GstSample *sample = gst_app_sink_pull_sample (GST_APP_SINK (appsink));
if (sample) {
GstBuffer *buffer = gst_sample_get_buffer(sample);
GstMapInfo info;
gst_buffer_map(buffer, &info, GST_MAP_READ);
NvBufSurface *nvBuf_surface = (NvBufSurface*) info.data;
// map nvBuf_surface and use data here ........
gst_buffer_unmap (buffer, &info);
}
gst_sample_unref(sample);
}
The code works as it should.
My question is, will the call to gst_buffer_unmap() cause NvBufSurfaceDestroy() to be called to free up the dma buffer in NvBufSurface.
What if I want to unref/unmap the gst buffer and keep the underlying NvBufSurface for longer, how can I proceed?
Thanks,
Malek