[gst-devel] question re: buffer flags

Jim Thornton jthornton at parc.com
Fri Aug 30 17:44:05 CEST 2002


I would like to add a vote of support for the use of refcounts and
gst_buffer_copy_on_write() rather than setting READONLY in components like
tee, to avoid unnecessary buffer copies.  I think READONLY is ideal for
marking buffers that can't be modified for some reason other than sharing in
the pipeline.  I know of two cases of this:
1) Subbuffers where the problem is that the buffer is actually a reference
into another buffer so refcount on the subbuffer doesn't tell the story
2) Cases where the buffer memory is not writable to the process, as occurs
with buffers out of filesrc where the memory is mmap'd from the file
read-only.

The buffer_merge/buffer_span cases depend on whether a copy happens or the
result is a subbuffer and it looks to me like the right thing is happening:
READONLY and SUBBUFFER get set as befits the situation (copy vs. subbuffer)
and nothing else is copied.  You don't need DONTFREE because creation of a
subbuffer has it's own free that does the right thing so normal deallocation
should work.  Surely DISCONTINUOUS, KEY_UNIT, and PREROLL must be left to
the caller which is the only place the semantics of the amalgamated buffer
can be known?

Jim





More information about the gstreamer-devel mailing list