[vlc-devel] Using logger during asynchronous close

Thomas Guillem thomas at gllm.fr
Mon Mar 8 16:17:17 UTC 2021


Hello Alexandre,

On Mon, Mar 8, 2021, at 16:56, Alexandre Janniaux wrote:
> Hi,
> 
> After merging my last mediacodec patches, I encountered segmentation
> faults that unfortunately never occurred previously but were bound to
> happen.
> 
> Indeed, after those patches, the mediacodec decoder_t object can be
> closed while the mediacodec core is still valid as long as the video
> context is valid. If the mediacodec core is logging message, it will
> go through the closed and potentially destroyed decoder_t object.
> 
> I'm looking for solution for this problem but I'm not sure we already
> encountered this issue so I'm not sure how to solve it.
> 
> So far, I have those solutions:
> 
>  - adding back refcount on vlc_object_t, which would probably be
>    horrible.
> 
>  - adding refcount to logger object. We basically know that the current
>    logger is always available but it might change in the future so
>    having a way to ensure it's validity in a better way than having a
>    way to ensure the validity of the underlying object.

I'm OK with that solution (refcounting the logger).

> 
>  - creating a dedicated object to log onto from libvlc, but then I lose
>    the benefit of the logger inheritency infrastructure.
> 
>  - likewise, using the logger from the libvlc instance, but same problem.
> 
>  - using the logger from the object, but it could disappear too.
> 
> None of them looks great, so I hope you have better alternatives than
> disabling logs (conditionnally or not) in the async parts of mediacodec. :/

Another solution consists on documenting and asserting that the logger can't be changed or destroyed during the lifetime of libvlc. So, before destroying the logger, you need to ensure that there are no more player, preparser or other alive.

> 
> Regards,
> --
> Alexandre Janniaux
> Videolabs
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list