[Libav-user] Logging in multi-stream multi-threaded video processing service
alex3d at netup.ru
Tue Jan 10 13:23:25 EET 2017
We are developing multi-stream multi-threaded video processing service and
would like to improve log usefulness by including media-stream identifier.
So instead of
[mp4 @ 0x313b820] Application provided invalid, non monotonically ...
We would like to get something like
[live stream #5] [mp4 @ 0x313b820] Application provided invalid, ...
I've found similar discussion in libav-user 2012 archives but it's not
Now we are considering three options:
1) Register all contexts we create in context registry singleton.
- we should also register indirectly created contexts
(e.g. codecs created by avformat_open_input)
- some indirectly created contexts probably can log before we register
it or can be created on-demand and we won't register it
2) Set thread-local media-stream identifier before calling libav functions.
- this won't work for threads created inside context
(e.g. multi-threaded codecs)
3) Inject stream identifier into some field in context (opaque or metadata)
- it seems that there is no reliable way to inject data into context.
Some contexts contain opaque or metadata field, others don't
- same cons as in registry option
Probably we are missing something and there are better ways to achieve
What is the best practices of logging in multi-stream libav video
С уважением, Шумский Александр
More information about the Libav-user