[FFmpeg-devel] Buffers Threads and refcounts

Michael Niedermayer michaelni at gmx.at
Wed Jan 9 19:58:03 CET 2013

On Wed, Jan 09, 2013 at 03:43:03PM +0100, Hendrik Leppkes wrote:
> On Wed, Jan 9, 2013 at 3:11 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> >>
> >>
> >> I won't go into detail on all the pros and cons, however i would like
> >> to say that refcounted buffers for both AVPacket and AVFrames is
> >> something that has been bugging me for years. Not knowing the real
> >> life-time of the buffers in those structs without studying the code
> >> very carefully seriously limits the flexibility and basically ensures
> >> that you start memcpy'ing them, so for my use-case, i would save a lot
> >
> > so
> > 1. Docs are crap
> > 2. Users unneccessarily memcpy just to be sure as the docs dont
> >    document when its actually needed
> > 3. Isnt it logic to fix the docs here ?
> >
> Even if it was documented, from what i've found out so far, the
> "logic" which determines when you can keep/use a buffer is not quite
> sound in itself.
> And even if it was documented to all extend, there are many cases
> where you still need to memcpy which a proper refcounted buffer would
> avoid (or i have to implement quite a bit of boilerplate logic around
> it which is prone to error)

Does what you say contain any information beyond reiterating that you
are right and there are many unspecified cases ?

> Refcounting is just the right way to approach this topic. Its a
> well-known system for concepts like this.

So is garbage collection and object oriented design if you ask
someone who likes these. Then if you ask someone who doesnt he will
say the opposit

I was not interrested to discuss THAT thing :)
Everyone has things they like and things they dont.

What my mail was about was a specific patchset, a specific
implementation and the real world meassureable effects of that like
speed and bugs.
It seems somehow you mistook this for a dislike of ref counts and
argue against that now.
I dont really have a preferance about refcounts or not ...


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130109/b3c379fd/attachment.asc>

More information about the ffmpeg-devel mailing list