baseparse: Don't copy invalid DTS to the PTS
authorVivia Nikolaidou <vivia@ahiru.eu>
Thu, 28 Nov 2019 11:09:45 +0000 (13:09 +0200)
committerVivia Nikolaidou <vivia@ahiru.eu>
Thu, 28 Nov 2019 11:12:50 +0000 (13:12 +0200)
We were checking to make sure the buffer's DTS wouldn't be after its
PTS. However, the check would also trigger when DTS is NONE, which is
e.g. in the case of some broken cameras.

Fixes #470

libs/gst/base/gstbaseparse.c

index 89bb112..6b8b36a 100644 (file)
@@ -998,7 +998,8 @@ gst_base_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
   if (must_approximate_pts) {
     GST_BUFFER_PTS (buffer) = parse->priv->next_pts;
     if (!must_approximate_dts
-        && GST_BUFFER_DTS (buffer) > parse->priv->next_pts) {
+        && GST_BUFFER_DTS (buffer) > parse->priv->next_pts
+        && GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DTS (buffer))) {
       /* Can't present a frame before it's decoded: change the pts! This can
        * happen, for example, when accumulating rounding errors from the
        * buffer durations. Assume DTS is correct because only PTS is