Le jeudi 5 septembre 2013 18:22:23 Stefano Pigozzi a écrit :
> On Thu, Sep 5, 2013 at 12:33 PM, Rémi Denis-Courmont <[email protected]> 
wrote:
> >> +    /**
> >> +     * The Core Video pixel buffer that contains the current image
> > 
> > data.
> > 
> >> +     *
> >> +     * encoding: unused
> >> +     * decoding: Set by libavcodec. Unset by user.
> > 
> > That scheme cannot work and I guess it is responsible for the massive
> > memory leaks experienced in VLC's VDA.
> 
> IIRC the VDA framework itself creates these CVPixelBuffers (it has a
> pool of them). CVPixelBuffers are refcounted and if their refcount
> reaches 0 the underlying IOSurface can be reused by the OS. Maybe the
> AVFrame could be made to call CVPixelBufferRelease when it is
> deallocated.

All other hwaccel allocate the pixel buffers from get_buffer().

> Client media players can then store these CVPixelBuffers
> and call CVPixelBufferRetain to hold onto them.

You could maybe make a special case for VDA then, and have libavcodec allocate 
and deallocate the video buffers. But regardless, libavcodec is not supposed to 
override the AVFrame.data[] pointers while decoding.

Furthermore, the pixel buffer handle should be in AVFrame, not in the decoder 
context.

> Btw, I have no idea why one has to provide a get_buffer implementation
> when using VDA's hwaccel API since the "buffer" is created by libav
> itself. In mpv-player I have been providing dummy buffers...

Yes. This is a design bug of the current VDA hwaccel implementation.

-- 
Rémi Denis-Courmont
http://www.remlab.net/

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to