Commit d3f15f2e authored by Nicolas Dufresne's avatar Nicolas Dufresne
Browse files

h265parse: Set PTS/DTS and DISCONT on crafted NAL

When we inject a NAL in the bitstream before another one, make
sure to pass both DTS and PTS. Also make sure to transfer the
DISCONT flag properly.
parent 4d478c06
......@@ -1824,7 +1824,7 @@ gst_h265_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
* No ownership is taken of @nal */
static GstFlowReturn
gst_h265_parse_push_codec_buffer (GstH265Parse * h265parse, GstBuffer * nal,
GstClockTime ts)
GstBuffer * buffer)
{
GstMapInfo map;
......@@ -1833,7 +1833,13 @@ gst_h265_parse_push_codec_buffer (GstH265Parse * h265parse, GstBuffer * nal,
map.data, map.size);
gst_buffer_unmap (nal, &map);
GST_BUFFER_TIMESTAMP (nal) = ts;
if (h265parse->discont) {
GST_BUFFER_FLAG_SET (nal, GST_BUFFER_FLAG_DISCONT);
h265parse->discont = FALSE;
}
GST_BUFFER_PTS (nal) = GST_BUFFER_PTS (buffer);
GST_BUFFER_DTS (nal) = GST_BUFFER_DTS (buffer);
GST_BUFFER_DURATION (nal) = 0;
return gst_pad_push (GST_BASE_PARSE_SRC_PAD (h265parse), nal);
......@@ -1947,7 +1953,6 @@ gst_h265_parse_handle_vps_sps_pps_nals (GstH265Parse * h265parse,
GstBuffer *codec_nal;
gint i;
gboolean send_done = FALSE;
GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer);
if (h265parse->align == GST_H265_PARSE_ALIGN_NAL) {
/* send separate config NAL buffers */
......@@ -1955,21 +1960,21 @@ gst_h265_parse_handle_vps_sps_pps_nals (GstH265Parse * h265parse,
for (i = 0; i < GST_H265_MAX_VPS_COUNT; i++) {
if ((codec_nal = h265parse->vps_nals[i])) {
GST_DEBUG_OBJECT (h265parse, "sending VPS nal");
gst_h265_parse_push_codec_buffer (h265parse, codec_nal, timestamp);
gst_h265_parse_push_codec_buffer (h265parse, codec_nal, buffer);
send_done = TRUE;
}
}
for (i = 0; i < GST_H265_MAX_SPS_COUNT; i++) {
if ((codec_nal = h265parse->sps_nals[i])) {
GST_DEBUG_OBJECT (h265parse, "sending SPS nal");
gst_h265_parse_push_codec_buffer (h265parse, codec_nal, timestamp);
gst_h265_parse_push_codec_buffer (h265parse, codec_nal, buffer);
send_done = TRUE;
}
}
for (i = 0; i < GST_H265_MAX_PPS_COUNT; i++) {
if ((codec_nal = h265parse->pps_nals[i])) {
GST_DEBUG_OBJECT (h265parse, "sending PPS nal");
gst_h265_parse_push_codec_buffer (h265parse, codec_nal, timestamp);
gst_h265_parse_push_codec_buffer (h265parse, codec_nal, buffer);
send_done = TRUE;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment