summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorSeungha Yang <seungha.yang@navercorp.com>2018-11-23 11:28:44 +0900
committerNicolas Dufresne <nicolas@ndufresne.ca>2018-11-30 02:19:17 +0000
commit4f7fe897b9be77c983f935538d30a5c90cecc947 (patch)
tree8fda095ccd66e52fff462f63115aa3b11076d11b /gst
parent2b8659a3efaa7d1efe7a5c4ce26707e8df8de89d (diff)
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
Diffstat (limited to 'gst')
-rw-r--r--gst/videoparsers/gsth264parse.c9
-rw-r--r--gst/videoparsers/gsth264parse.h4
2 files changed, 13 insertions, 0 deletions
diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c
index 903d204ad..f308d174d 100644
--- a/gst/videoparsers/gsth264parse.c
+++ b/gst/videoparsers/gsth264parse.c
@@ -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");
diff --git a/gst/videoparsers/gsth264parse.h b/gst/videoparsers/gsth264parse.h
index 137c2cdc7..61a996d17 100644
--- a/gst/videoparsers/gsth264parse.h
+++ b/gst/videoparsers/gsth264parse.h
@@ -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 */