Skip to content

tsmux: Fix PCR calculation for CBR live streams

Vivia Nikolaidou requested to merge vivia/gst-plugins-bad:tsmux_cbr_pcr into master

Take the first ever timestamp as an offset

This is WIP and largely untested, I just wanted to dump my thoughts here before I leave on holidays.

14:12 < thaytan> vivia, for some reason, there's like a 35 second gap between the PCR and the PTSs of the stream
14:13 < thaytan> in MPEG terms, that implies data arrives 35 seconds before it's supposed to be played out
14:15 < vivia> thaytan: ahh, thanks! it's taken from a live stream basically and we're starting to encode/mux maybe 35 seconds into
               the stream
14:16 < thaytan> are you running the muxer in constant bitrate mode?
14:17 < thaytan> I guess not, because there's not a stack of padding at the start
14:17 < vivia> we probably are.. this is a UDP dump from the middle of the stream
14:18 < thaytan> must be I think - otherwise the PCR generation is locked to the PTS/DTS of the stream being written
14:19 < thaytan> and can't get so far off
14:20 < thaytan> seems like a bug in the PCR calculation in CBR mode, not accounting for an initial running time offset
14:20 < vivia> fraxinas: did you have CBR enabled?
14:21 < fraxinas> it was setup with srt://:7701?bitrate_bps=10000000 so i think yes
14:22 < vivia> fraxinas: and were you starting the recording manually? if so, it might explain why sometimes it did work (you were
               fast enough for the drift to not be too big)
14:22 < fraxinas> yes
Edited by Vivia Nikolaidou

Merge request reports