Commit 4f7fe897 authored by Seungha Yang's avatar Seungha Yang 🐑 Committed by Nicolas Dufresne
Browse files

h264parse: Don't duplicate SPS/PPS per config-interval if exists

Don't need to manually insert SPS/PPS since inband data could be useable.

Fixes #824
parent 2b8659a3
......@@ -196,6 +196,8 @@ gst_h264_parse_reset_frame (GstH264Parse * h264parse)
h264parse->header = FALSE;
h264parse->frame_start = FALSE;
h264parse->aud_insert = TRUE;
h264parse->have_sps_in_frame = FALSE;
h264parse->have_pps_in_frame = FALSE;
gst_adapter_clear (h264parse->frame_out);
}
......@@ -743,6 +745,7 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu)
GST_DEBUG_OBJECT (h264parse, "triggering src caps check");
h264parse->update_caps = TRUE;
h264parse->have_sps = TRUE;
h264parse->have_sps_in_frame = TRUE;
if (h264parse->push_codec && h264parse->have_pps) {
/* SPS and PPS found in stream before the first pre_push_frame, no need
* to forcibly push at start */
......@@ -777,6 +780,7 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu)
h264parse->update_caps = TRUE;
}
h264parse->have_pps = TRUE;
h264parse->have_pps_in_frame = TRUE;
if (h264parse->push_codec && h264parse->have_sps) {
/* SPS and PPS found in stream before the first pre_push_frame, no need
* to forcibly push at start */
......@@ -2314,6 +2318,11 @@ gst_h264_parse_handle_sps_pps_nals (GstH264Parse * h264parse,
gboolean send_done = FALSE;
GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer);
if (h264parse->have_sps_in_frame && h264parse->have_pps_in_frame) {
GST_DEBUG_OBJECT (h264parse, "SPS/PPS exist in frame, will not insert");
return TRUE;
}
if (h264parse->align == GST_H264_PARSE_ALIGN_NAL) {
/* send separate config NAL buffers */
GST_DEBUG_OBJECT (h264parse, "- sending SPS/PPS");
......
......@@ -85,6 +85,10 @@ struct _GstH264Parse
gboolean have_sps;
gboolean have_pps;
/* per frame sps/pps check for periodic push codec decision */
gboolean have_sps_in_frame;
gboolean have_pps_in_frame;
gboolean sent_codec_tag;
/* collected SPS and PPS NALUs */
......
Markdown is supported
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