summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-08-04 12:09:12 +0300
committerSebastian Dröge <sebastian@centricular.com>2015-08-04 12:45:06 +0300
commit8dda570e477e5848e4ffe80af2c86b93eec85ae1 (patch)
tree94570c128d5148a69473ce1a2630292abcdf6fb3
parente0c124f76d8c39ad6114ecc0e3c244953f41a21d (diff)
rtph264depay: Only update the srcpad caps if something else than the codec_data changed
h264parse does the same, let's keep the behaviour consistent. As we now include the codec_data inside the stream too here, this causes less caps renegotiation.
-rw-r--r--gst/rtp/gstrtph264depay.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/gst/rtp/gstrtph264depay.c b/gst/rtp/gstrtph264depay.c
index 5686d87aa..755cb8159 100644
--- a/gst/rtp/gstrtph264depay.c
+++ b/gst/rtp/gstrtph264depay.c
@@ -386,14 +386,51 @@ gst_rtp_h264_set_src_caps (GstRtpH264Depay * rtph264depay)
gst_buffer_unmap (codec_data, &map);
gst_buffer_set_size (codec_data, new_size);
-
gst_caps_set_simple (srccaps,
"codec_data", GST_TYPE_BUFFER, codec_data, NULL);
gst_buffer_unref (codec_data);
}
- res = gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph264depay),
- srccaps);
+ if (gst_pad_has_current_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph264depay))) {
+ GstCaps *old_caps =
+ gst_pad_get_current_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph264depay));
+
+ /* 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
+ */
+ if (rtph264depay->byte_stream) {
+ if (!gst_caps_is_equal (srccaps, old_caps))
+ res =
+ gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph264depay),
+ 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 (rtph264depay),
+ srccaps);
+ else
+ res = TRUE;
+
+ gst_caps_unref (tmp_caps);
+ }
+ } else {
+ res =
+ gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph264depay),
+ srccaps);
+ }
+
gst_caps_unref (srccaps);
/* Insert SPS and PPS into the stream on next opportunity */