'avoid to copy video frame to appsrc in gstreamer

I am trying to deliver the NV12 video format frame v4l2h264enc. At this time, I am going to do this by passing the video frame to appsrc. The video resolution is 1920x1080, but it takes a lot of time to copy memory. Is there any way to avoid memory copy?

gstbuf = gst_buffer_new_allocate(NULL, size, NULL);

gst_buffer_map(gstbuf, &map, GST_MAP_WRITE);

memcpy(map.data, data, size);

gst_buffer_unmap(gstbuf, &map);

gst_app_src_push_buffer(GST_APP_SRC(appsrc), gstbuf);



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source