avoid to copy video frame to appsrc in gstreamer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

avoid to copy video frame to appsrc in gstreamer

408 Views
yibhan
Contributor III

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?

Belows are my psuedo code : I'd like to remove memcpy to access to directly some memory

My raw data are located in g2d memory, It may not be cpu area but, gpu area. So, when I am going to use raw video frame to gstreamer which is operated in cpu area(? not sure), I can copy video frame to user area in gstreamer, but it takes time to complete for every video frame. So, I have to change my scheme that no use memcpy to access directly raw video frame in gstreamer. Do you have any ideas or guides?

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);

 

0 Kudos
0 Replies