Skip to content

Incorrect value returned for DEMUX_GET_POSITION by TS muxer DTS is not available

When playing a TS muxed stream for which DTS is not available (e.g. playing video from a TS file accessed via HTTP), the time position should be calculated from the current byte position, but by mistake a wrong estimation is made from an invalid DTS value and the result produced for DEMUX_GET_POSITION is incorrect.

The issue was introduiced in commit 178c1a4d which modified modules/demux/mpeg/ts.c line 930 (nowadays 929), changing ...

p_pmt->i_last_dts > VLC_TS_INVALID

by

p_pmt->i_last_dts != VLC_TS_INVALID

This change did not 'fix' the comparison but broke it, because the field p_pmt->i_last_dts is initialized (somewhere else) with value -1, and VLC_TS_INVALID (nowadays VLC_TICK_INVALID) equals 0. As a consequence, the value -1 is used as a parameter for calling TimeStampWrapAround, what causes that DEMUX_GET_POSITION returns a completely wrong value.

The effect of this error is that, for that particular kind of stream, the VLC time slider does not show the current play position.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information