From 3784bd4a739fe08d591f8374bafb968b605196f3 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 7 May 2020 08:29:28 -0400 Subject: [PATCH] h265parse: Ensure correct timestamps 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: --- gst/videoparsers/gsth265parse.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gst/videoparsers/gsth265parse.c b/gst/videoparsers/gsth265parse.c index 33cb962fa7..0c4ca177bd 100644 --- a/gst/videoparsers/gsth265parse.c +++ b/gst/videoparsers/gsth265parse.c @@ -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) {