[gst-devel] question re: buffer handling
camh+gst at xdna.net
Thu Aug 29 05:56:04 CEST 2002
Once upon a time Thomas Vander Stichele said...
> To be efficient, I coded the bpwsinc filter to do an in-place edit on the
> Of course, tee sends out pointers to the buffer, and thus both filters
> work on the same data in-memory. That's the root of my problem.
> So, here are the questions :
> a) should each plug-in that wants to do in-place editing for efficiency
> check if it's allowed to by himself and make a copy if necessary ?
This would seem to be correct. I'm only just getting into gstreamer so
I've been reading the manual, and chapter 10 of the application
development manual says:
A more complex case is when the filter modifies the data in place. It
does so and simply passes on the buffer to the next element. This is
just as easy to deal with. An element that works in place has to be
careful when the buffer is used in more than one element; a copy on
write has to made in this situation.
Since buffers are reference counted, you could use that to see if you
are the only one holding a reference (I think).
If you're going to do an inplace modification, you could then copy the
buffer and unreference the old one.
I'm only going by what I've read. I haven't done any of this stuff
More information about the gstreamer-devel