videodecoder: Detect buffers inputted with DTS
authorEdward Hervey <edward.hervey@collabora.co.uk>
Tue, 24 Apr 2012 13:07:31 +0000 (15:07 +0200)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Tue, 24 Apr 2012 15:03:40 +0000 (17:03 +0200)
commita744c9898572ca150a418504033875245cc719d0
tree649c6a21816a96ccb1a12e672369fb26286a4df4
parent7bfd1bc3d7d0507e707af7a37762ee59954cde72
videodecoder: Detect buffers inputted with DTS

Some container formats (like AVI) set DTS on the buffers instead of
PTS.
We detect this by:
* detecting if input timestamps are non-increasing
* detecting if the order the frames come out is the same as the order
  they were inputted (meaning the implementation is reordering frames).

If the decoder reorders frames, but input buffer timestamps were not
reordered, that means the buffers has DTS and not PTS as their timestamp.
If this is the case, we use set the PTS of the outgoing frames in the
same order as they were given to the decoder.

This fixes the issue for any decoder using this base class (yay).
gst-libs/gst/video/gstvideodecoder.c