appsink -> appsrc performance issue
Hello, I have pipelines like this:
.. ! vaapih264dec ! vaapipostproc ! video/x-raw,format=BGRx ! appsink
appsrc ! vaapih264enc ! ..
If I pass the samples directly without any modification:
GstSample *sample = gst_app_sink_try_pull_sample(appsink,timeout);
gst_app_src_push_sample (appsrc, sample);
It is working fine but when I create a new buffer, copy the data and pass it to the appsrc I get about 30% less GPU usage.
gsize bufsize = gst_buffer_get_size (buffer);
GstBuffer *new_buffer = gst_buffer_new_allocate (NULL, bufsize, NULL);
GstMapInfo map;
gst_buffer_map (buffer, &map, GST_MAP_READ);
gst_buffer_fill (new_buffer, 0, map.data, bufsize);
Tested so far with no success:
-create a new buffer and assign GstMemory from the old one
-modify GstMemory flags
-change memory align to 7 in gst_vaapi_video_memory_new in gst/vaapi/gstvaapivideomemory.c
The only way how to get lower GPU usage, what I have found so far, is using deep copy with gst_buffer_fill.
Why is this happening? I would like to avoid copying if possible. Thank you
Tomas