[vlc-devel] Using logger during asynchronous close

Alexandre Janniaux ajanni at videolabs.io
Mon Mar 8 15:56:54 UTC 2021


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.

 - 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. :/

Regards,
--
Alexandre Janniaux
Videolabs


More information about the vlc-devel mailing list