Re: buffer management [was Re: libsoup-2.4 branch merged to trunk]



On Tue, Feb 05, 2008 at 11:27:41AM +0100, Wouter Cloetens wrote:
> On Mon, Feb 04, 2008 at 09:38:57PM -0500, Dan Winship wrote:

> > > I discovered a third issue; GStreamer allows for downstream elements to
> > > allocate the buffers in which to write. This is especially useful if the
> > > next element in the pipeline does hardware buffer management to offload
> > > some operation to hardware.

To do this, it actually has to allocate a GstBuffer as well as the
actual data buffer.

> > That seems a lot nicer; we could make a new SoupBuffer subtype
> > representing data owned by another object, with a GDestroyNotify
> > attached to clean things up, and then the allocation callback would
> > allocate SoupBuffers, and everything should just work...

Yep. I'm passing the GstBuffer as the destroy_data, and the data buffer
as the data argument to soup_buffer_new_external(). The GDestroyNotify
handler is passed the GstBuffer, and unrefs it.

> > What do you think of the attached diff? I think this would let you solve
> > both of your issues (hardware buffer management, and the original
> > I-want-smaller-buffers-and-no-copies thing).

There's just one problem. The got-chunk callback is passed a SoupBuffer. I
only have visibility of the data buffer and size, not the destroy_data I
passed to soup_buffer_new_external(), i.e. the GstBuffer that I need.
Any chance of exposing SoupBufferPrivate.extra_data somehow?

bfn, Wouter


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]