[vlc-devel] [PATCH] core: add a callback to init/release data for picture pool of opaque formats

Steve Lhomme robux4 at videolabs.io
Mon Apr 20 17:22:07 CEST 2015

On Mon, Apr 20, 2015 at 4:56 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le lundi 20 avril 2015, 16:38:07 Steve Lhomme a écrit :
>> There's no object instance you can use in video_format_t so
>> picture_NewFromFormat() is not an option. And that's what is used in
>> vout_InitWrapper() to create the decoder pool (in this case the
>> decoder already has its pool), the display pool (which needs to be
>> initialized with the same handles as the decoder pool).
> The video output can, and typically does, survive the decoder. The pictures
> can also survive the current decoder output format (especially with threaded
> decoding).

But in this case it shouldn't and it doesn't. See the added check in
ThreadReinit(), calling VoutSafePool(). If the decoder has changed,
the provided p_sys has changed and so the vout will not be reused.

> So I don't see how non-serial data in video_format_t (or alongside it) can
> ever work. FWIW, that issue was already brought up to solve a completely
> different problem - multiple video output windows.
> To take a simple and concrete example, how do you compare the video formats
> when there is an opaque pointer inside? Pointer comparison only works if you
> know that the two pointed objects were concurrent in memory, such that they
> cannot be two distinct objects with the same address.

There's one case where the code above may not work. If the old
decoder_pool_setup_sys_t is freed, a new one is reallocated in the
exact same place. Then it wouldn't work.

I'm open to solutions to solve this.

More information about the vlc-devel mailing list