Skip to content

videodecoder: avoid duplicate timestamps for buffers inputted with DTS but need reorder

Qi Hou requested to merge hq/gstreamer:timestamp-manager into main
Some containers like AVI set DTS instead of PTS on the buffer. If the
input buffer timestamps are DTS, but the decoder reorders frames, then
needs videodecoder to calculate the PTS for output frames.

For example, the first 4 input buffer timestamps are 0,33ms,66ms,100ms.
But the decoder output frames sequence is 0->2->1->3.

In such case, videodecoder sets flag reordered_output to TRUE only when
frame's DTS is smaller that the previous output timestamp currently.
It causes output frame timestamps to  0,66ms,66ms,100ms.

To avoid above duplicate timestamp, we need to set reordered_output to
TRUE when the frame's DTS is larger than any DTS still in the frame list.
Edited by Qi Hou

Merge request reports