From ba8b605c6fc7c92202b8a0451e9547c738cfdc19 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Fri, 28 Sep 2018 16:49:52 -0400 Subject: [PATCH] h264parse: Propagate MARKER flag --- gst/videoparsers/gsth264parse.c | 17 +++++++++++++++++ gst/videoparsers/gsth264parse.h | 1 + 2 files changed, 18 insertions(+) diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c index 8cf3720047..77ab47f893 100644 --- a/gst/videoparsers/gsth264parse.c +++ b/gst/videoparsers/gsth264parse.c @@ -302,6 +302,7 @@ gst_h264_parse_reset (GstH264Parse * h264parse) h264parse->discont = FALSE; h264parse->discard_bidirectional = FALSE; + h264parse->marker = FALSE; gst_h264_parse_reset_stream_info (h264parse); } @@ -1247,6 +1248,12 @@ gst_h264_parse_handle_frame_packetized (GstBaseParse * parse, tmp_frame.buffer = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, nalu.offset, nalu.size); + /* Set marker on last packet */ + if (nl + nalu.size == left) { + if (GST_BUFFER_FLAG_IS_SET (frame->buffer, GST_BUFFER_FLAG_MARKER)) + h264parse->marker = TRUE; + } + /* note we don't need to come up with a sub-buffer, since * subsequent code only considers input buffer's metadata. * Real data is either taken from input by baseclass or @@ -1263,6 +1270,7 @@ gst_h264_parse_handle_frame_packetized (GstBaseParse * parse, gst_buffer_unmap (buffer, &map); if (!h264parse->split_packetized) { + h264parse->marker = TRUE; gst_h264_parse_parse_frame (parse, frame); ret = gst_base_parse_finish_frame (parse, frame, map.size); } else { @@ -1485,6 +1493,7 @@ gst_h264_parse_handle_frame (GstBaseParse * parse, if (current_off > 0) { nalu.size = 0; nalu.offset = nalu.sc_offset; + h264parse->marker = TRUE; break; } } @@ -1508,6 +1517,7 @@ gst_h264_parse_handle_frame (GstBaseParse * parse, /* If there is a marker flag, or input is AU, we know this is complete */ if (GST_BUFFER_FLAG_IS_SET (frame->buffer, GST_BUFFER_FLAG_MARKER) || h264parse->in_align == GST_H264_PARSE_ALIGN_AU) { + h264parse->marker = TRUE; break; } @@ -2567,6 +2577,13 @@ gst_h264_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame) h264parse->discont = FALSE; } + if (h264parse->marker) { + GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_MARKER); + h264parse->marker = FALSE; + } else { + GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_MARKER); + } + /* replace with transformed AVC output if applicable */ av = gst_adapter_available (h264parse->frame_out); if (av) { diff --git a/gst/videoparsers/gsth264parse.h b/gst/videoparsers/gsth264parse.h index 61579c65e7..c526defdd1 100644 --- a/gst/videoparsers/gsth264parse.h +++ b/gst/videoparsers/gsth264parse.h @@ -116,6 +116,7 @@ struct _GstH264Parse gboolean do_ts; gboolean discont; + gboolean marker; /* frame parsing */ /*guint last_nal_pos;*/