invalidate cache when external libav* changes
Endless OS and Flatpak runtimes with a codecs extension both share the property that in certain cases, libav gets replaced with a more capable version elsewhere on the library search path. The GStreamer caching machinery does not "notice" this change (indeed I'm not sure it's monitoring the dependent .so files at all) so in the case of a more capable system libav with more supported codecs, if GStreamer has already built its caches they are not updated and the new codecs are unavailable.
Endless has an ugly patch for this which has been copied into the Flatpak freedesktop-sdk runtime - https://gitlab.com/freedesktop-sdk/freedesktop-sdk/blob/18.08/patches/gst-libav-stop-caching-codecs.patch
This works, in as much as when a more capable libav is provided in an alternative location on the path, the cache is invalidated and refreshed. However it has the obvious downside that this is hardcoding the library search path, which means that if you place a different libav in another location on the library path (particularly in a sandboxed context like Flatpak where the library path can be changed dynamically) it is not noticed.
We could avoid hardcoding the library path and solve this problem more robustly by fetching the path of the currently loaded libav* using dlinfo, and then making the cache validity dependent on the properties of that file, so that if a different one is found by the linker, the cache will be correctly invalidated.
Perhaps in the end you would want to add a function to the registry to allow a dynamic library file cache dependency to be added easily, or you could do this dlinfo lookup in gst-libav as a special case.