summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis de Bethencourt <luis@debethencourt.com>2015-08-12 17:22:42 +0100
committerTim-Philipp Müller <tim@centricular.com>2016-02-16 00:24:40 +0000
commit18b628824b7b3aaaf847efba74e049027df05ac3 (patch)
tree7b989fde699598b7f000ae617d7eacdaf7e3fb65
parent3979ffa6a3ad3c047d4d1d4fe36a36acd500ee42 (diff)
downloadgstreamer-plugins-good-18b628824b7b3aaaf847efba74e049027df05ac3.tar.gz
rtph265depay: only update the srcpad caps if something else than the codec_data changed
h264parse and gstrtph264depay do the same, let's keep the behaviour consistent. As we now include the codec_data inside the stream, this causes less caps renegotiation. https://bugzilla.gnome.org/show_bug.cgi?id=753228
-rw-r--r--gst/rtp/gstrtph265depay.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/gst/rtp/gstrtph265depay.c b/gst/rtp/gstrtph265depay.c
index 5ee4a74e7..99755d7d2 100644
--- a/gst/rtp/gstrtph265depay.c
+++ b/gst/rtp/gstrtph265depay.c
@@ -530,8 +530,47 @@ gst_rtp_h265_set_src_caps (GstRtpH265Depay * rtph265depay)
gst_buffer_unref (codec_data);
}
- res = gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph265depay),
- srccaps);
+ if (gst_pad_has_current_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph265depay))) {
+ GstCaps *old_caps =
+ gst_pad_get_current_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph265depay));
+
+ /* Only update the caps if they are not equal. For
+ * AVC we don't update caps if only the codec_data
+ * changes. This is the same behaviour as in h264parse
+ * and gstrtph264depay
+ */
+ if (rtph265depay->byte_stream) {
+ if (!gst_caps_is_equal (srccaps, old_caps))
+ res =
+ gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph265depay),
+ srccaps);
+ else
+ res = TRUE;
+ } else {
+ GstCaps *tmp_caps = gst_caps_copy (srccaps);
+ GstStructure *old_s, *tmp_s;
+
+ old_s = gst_caps_get_structure (old_caps, 0);
+ tmp_s = gst_caps_get_structure (tmp_caps, 0);
+ if (gst_structure_has_field (old_s, "codec_data"))
+ gst_structure_set_value (tmp_s, "codec_data",
+ gst_structure_get_value (old_s, "codec_data"));
+
+ if (!gst_caps_is_equal (old_caps, tmp_caps))
+ res =
+ gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph265depay),
+ srccaps);
+ else
+ res = TRUE;
+
+ gst_caps_unref (tmp_caps);
+ }
+ } else {
+ res =
+ gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph265depay),
+ srccaps);
+ }
+
gst_caps_unref (srccaps);
/* Insert SPS and PPS into the stream on next opportunity */