[gst-devel] question re: buffer handling

Thomas Vander Stichele thomas at urgent.rug.ac.be
Thu Aug 29 02:20:03 CEST 2002


I've been tearing my hair out the last two days because I had some really 
weird issues with a program I was writing.

I finally tracked down what the problem was and realized I didn't really 
know what the best way was to fix it in gstreamer-land.

Here's the thing :

* I get audio data from an input pipe
* this data goes into a tee which feeds two analysis pipes
* the analysis pipe each use the same filter (bpwsinc) to filter data,
  then go through cutter and to fakesink

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.

Now, two obvious ways to quickly fix it

a) have tee send out copies of the buffers instead of pointers to the same 
buffer (and maybe add a copy flag to tee so you can request this 

b) have bpwsinc not do an in-place edit.

Now, the problem here is a pretty general one, so, this should probably be 
solved on a higher level.  I know there are provisions in GStreamer to 
mark a buffer as read-only.

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 ?

b) if so, when does a buffer get marked read-only, and who should be doing 
this ? (ie, I could imagine tee making all of it's output buffers 
read-only by default if it is sending out more than one set of them)

c) should this change to tee be made ?

Any thoughts appreciated.  I might be overlooking something that's already 
there ;)



The Dave/Dina Project : future TV today ! - http://davedina.apestaart.org/
<-*-                      -*->
Hold me in your arms
I want to be your only possession
<-*- thomas at apestaart.org -*->
URGent, the best radio on the Internet - 24/7 ! - http://urgent.rug.ac.be/

More information about the gstreamer-devel mailing list