clock resynchro breaks muxers
On PCR gap of more than 60 seconds, the clock does resynchro and offsets its clock to compensate such gap.
"feeding synchro with a new reference point trying to recover from clock gap"
The first effect of this, is some double discontinuity:
- demux sends packets based on timestamps A
- demux sends PCR update for A (optional step)
- demux sends packets based on timestamps N
- demux sends PCR update for N
- input offsets its clock by ~ |N-A|
- sout fifos still have the blocks based on timestamp A (the pre PCR N step)
- sout fifos then queue blocks based on timestamp N Result is sout muxers do experience a duplicate discontinuity A then N then A, since already queued blocks could not be restamped on clock resynchro.
The second issue is caused by the lack of discontinuity notification, to decoders, on resynchro.
As some decoders (mpegaudio) and packetizers do DTS/PTS interpolation after start, they do expect some DISCONTINUITY_FLAG on such discontinuity to reset their timebase to the current/next block.
Failing to do so creates a double offset (depending of clock gap sign) as the discontuinity did not happen at decoder level, but the clock resynchro offset applies on decoder output.
This is mainly the cause of the "too strange dts" issues with ts muxer, and is unfixable at muxer level.