h265parse: Ensure correct timestamps
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Thu, 7 May 2020 12:29:28 +0000 (08:29 -0400)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Thu, 7 May 2020 16:08:36 +0000 (12:08 -0400)
If the input has a miss-placed filler zero byte (e.g. a filler without a 4
bytes start code on the next NAL), we would endup using the same timestamp
twice. Ask the base class to read the timestamp from the buffer were the NAL
actually starts.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1251>

gst/videoparsers/gsth265parse.c

index 33cb962..0c4ca17 100644 (file)
@@ -1216,6 +1216,10 @@ gst_h265_parse_handle_frame (GstBaseParse * parse,
             ("Error parsing H.265 stream"), ("Invalid H.265 stream"));
         goto invalid_stream;
     }
+
+    /* Ensure we use the TS of the first NAL. This avoids broken timestamp in
+     * the case of a miss-placed filler byte. */
+    gst_base_parse_set_ts_at_offset (parse, nalu.offset);
   }
 
   while (TRUE) {