tsdemux: Add an automatic latency mode
Quoted from !652 (comment 213781) :
tsdemux doesn't output data until it's seen a PCR and a DTS on at least 1 stream. PCR has to happen every 100ms, but DTS/PTS are only required to appear every 700ms, which is where the 700ms comes from.
However, by the time it's ready to output data it might be possible to calculate how much data has been skipped and report a more accurate actual latency. If the input has timestamps on the buffers I can see how that could be done. Without them, in live mode you might have to base the answer on how much clock time has passed since the base-time and base the answer on that?
So using this approach, we could update the latency at the end of the pre-roll based on observed latency for the specific stream. This has the side effect that latency may change each time we need to resync (e.g. on discont ?).