From e11d94c57625a82e40eeb722359e0e0097d0379b Mon Sep 17 00:00:00 2001 From: He Junyan Date: Tue, 22 Nov 2022 16:42:26 +0800 Subject: [PATCH] h265parse: Add the missing timestamp when splitting a frame. When splitting a frame, the gst_buffer_copy_region() does not copy the timestamp correctly for sub frames when the offset is not 0. We still need those timestamps for each output sub frame. Part-of: --- subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c b/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c index 2eb902d546..abed37e69e 100644 --- a/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c +++ b/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c @@ -1075,6 +1075,10 @@ gst_h265_parse_handle_frame_packetized (GstBaseParse * parse, tmp_frame.overhead = frame->overhead; tmp_frame.buffer = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, nalu.offset, nalu.size); + /* Don't lose timestamp when offset is not 0. */ + GST_BUFFER_PTS (tmp_frame.buffer) = GST_BUFFER_PTS (buffer); + GST_BUFFER_DTS (tmp_frame.buffer) = GST_BUFFER_DTS (buffer); + GST_BUFFER_DURATION (tmp_frame.buffer) = GST_BUFFER_DURATION (buffer); /* Set marker on last packet */ if (nl + nalu.size == left) {