TS: lip sync problem, mismatching PCR and DTS
When I play a HLS video stream with VLC I get lip sync problems. I believe that is caused by a bug in the PCR/DTS handling in VLC. The video stream plays fine in for instance Safari. And I can fix the lip sync problem in VLC by specifying --no-ts-pcr-offsetfix
.
According to i.e. DVBInspector the PCR and DTS timestamps in the attached ts file are matching.
As far as I can see, the first PCR/DTS in the TS file is 4890970688. The second PCR/DTS in the TS file is 4890974288.
When ParsePESDataChain
in modules/demux/mpeg/ts.c is called the first time, it determines that the DTS is 4890974288 and that the PCR is 4890970688.
So it seems it takes the first DTS timestamp and the second PCR timestamp.
The result is that this warning is written:
msg_Warn( p_demux, "Broken stream: pid %d sends packets with dts %"PRId64
I can reproduce the problem with latest git HEAD.