Can GStreamer plugin perform DMA copy
Enrique Ocaña González
eocanha at igalia.com
Mon May 31 13:38:20 UTC 2021
El lunes, 31 de mayo de 2021 13:58:32 (CEST) ChrisLiuv via gstreamer-devel
escribió:
> Currently I have constructed a custom element that separate one video source
> to 2 video.
> For example, one 800x1200 video separate to two 800x600 video.
> I use memcpy method to copy video data to 2 new GstBuffer and then push it
> to src pad.
> So it costs much more cpu usage.
>
> I further check the tee element, which also branch a new pipeline, a new
> GstBuffer and low cpu usage.
> But I could not find what I want, it seems using gst_pad_push_list(), I
> didn't find out where it copies the data.
Looking at the loop where gst_tee_handle_data() iterates over all the pads[1]
and to the code that actually pushes the buffers[2], it looks like the
original GstBuffer isn't actually copied, just having its reference count
increased (because it's going to be used from each of the downstream pipeline
branches) and pushed to all the pads.
So, apparently, it's effectively the same buffer. If you add probes on each of
the downstream branches, you should see that the same GstBuffer* pointer
values appears on all the branches.
Cheers.
[1] https://gitlab.freedesktop.org/gstreamer/gstreamer/blob/master/plugins/
elements/gsttee.c#L941
[2] https://gitlab.freedesktop.org/gstreamer/gstreamer/blob/master/plugins/
elements/gsttee.c#L856
--
Enrique Ocaña
More information about the gstreamer-devel
mailing list