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 89bb112d1bf60cd7d2364b444f28a8a852a6aa27..6b8b36a71eddd4e8a94da6043a44073d05b5ad29 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