summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2016-02-04 18:15:56 +1100
committerMatthew Waters <matthew@centricular.com>2016-02-04 18:19:40 +1100
commit2a49811721fca9d412fc73d3544f687efba56f56 (patch)
tree52515b53065e414063509cd56e0ae0907a732598 /gst
parent72bc7d7f736a10117fedb8e1d4013a4946cfefbc (diff)
downloadgstreamer-plugins-bad-2a49811721fca9d412fc73d3544f687efba56f56.tar.gz
h265parse: avoid sending unnecessary downstream caps queries/events
h265 versions of the following commits: f352691a04896d0de3381fe8ee85ada948bd6337 try the current caps before querying downstream 72bc7d7f736a10117fedb8e1d4013a4946cfefbc increase caps equality check for no codec_data https://bugzilla.gnome.org/show_bug.cgi?id=761014
Diffstat (limited to 'gst')
-rw-r--r--gst/videoparsers/gsth265parse.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/gst/videoparsers/gsth265parse.c b/gst/videoparsers/gsth265parse.c
index ea12c24c3..96251222f 100644
--- a/gst/videoparsers/gsth265parse.c
+++ b/gst/videoparsers/gsth265parse.c
@@ -1341,11 +1341,20 @@ get_compatible_profile_caps (GstH265SPS * sps)
static void
ensure_caps_profile (GstH265Parse * h265parse, GstCaps * caps, GstH265SPS * sps)
{
- GstCaps *filter_caps, *peer_caps, *compat_caps;
+ GstCaps *peer_caps, *compat_caps;
- filter_caps = gst_caps_new_empty_simple ("video/x-h265");
- peer_caps =
- gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (h265parse), filter_caps);
+ peer_caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (h265parse));
+ if (!peer_caps || !gst_caps_can_intersect (caps, peer_caps)) {
+ GstCaps *filter_caps = gst_caps_new_empty_simple ("video/x-h265");
+
+ if (peer_caps)
+ gst_caps_unref (peer_caps);
+ peer_caps =
+ gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (h265parse),
+ filter_caps);
+
+ gst_caps_unref (filter_caps);
+ }
if (peer_caps && !gst_caps_can_intersect (caps, peer_caps)) {
GstStructure *structure;
@@ -1376,7 +1385,6 @@ ensure_caps_profile (GstH265Parse * h265parse, GstCaps * caps, GstH265SPS * sps)
}
if (peer_caps)
gst_caps_unref (peer_caps);
- gst_caps_unref (filter_caps);
}
static void
@@ -1558,15 +1566,22 @@ gst_h265_parse_update_src_caps (GstH265Parse * h265parse, GstCaps * caps)
src_caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (h265parse));
- if (src_caps
- && gst_structure_has_field (gst_caps_get_structure (src_caps, 0),
- "codec_data")) {
+ if (src_caps) {
/* use codec data from old caps for comparison; we don't want to resend caps
if everything is same except codec data; */
- gst_caps_set_value (caps, "codec_data",
- gst_structure_get_value (gst_caps_get_structure (src_caps, 0),
- "codec_data"));
+ if (gst_structure_has_field (gst_caps_get_structure (src_caps, 0),
+ "codec_data")) {
+ gst_caps_set_value (caps, "codec_data",
+ gst_structure_get_value (gst_caps_get_structure (src_caps, 0),
+ "codec_data"));
+ } else if (!buf) {
+ GstStructure *s;
+ /* remove any left-over codec-data hanging around */
+ s = gst_caps_get_structure (caps, 0);
+ gst_structure_remove_field (s, "codec_data");
+ }
}
+
if (!(src_caps && gst_caps_is_strictly_equal (src_caps, caps))) {
/* update codec data to new value */
if (buf) {