diff options
author | Matej Knopp <matej.knopp@gmail.com> | 2013-09-07 23:09:31 +0200 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2013-09-09 15:09:10 +0200 |
commit | a41e8698b1ae62b18fd2449dfcb7c1b9d39d02b9 (patch) | |
tree | d5bed33c1a02e9566b2f9b27ac68be6a504919a7 /gst/videoparsers | |
parent | 8fb662884232c6840a094c0d40b54888e3efd6c3 (diff) |
h264parse: don't update src caps if only codec_data differs
https://bugzilla.gnome.org/show_bug.cgi?id=705333
Diffstat (limited to 'gst/videoparsers')
-rw-r--r-- | gst/videoparsers/gsth264parse.c | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c index 9f79a41d0..c6ede5e72 100644 --- a/gst/videoparsers/gsth264parse.c +++ b/gst/videoparsers/gsth264parse.c @@ -1317,22 +1317,35 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps) par_n, par_d, NULL); } - if (buf) { - gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, buf, NULL); - gst_buffer_replace (&h264parse->codec_data, buf); - gst_buffer_unref (buf); - buf = NULL; - } else { - GstStructure *s; - /* remove any left-over codec-data hanging around */ - s = gst_caps_get_structure (caps, 0); - gst_structure_remove_field (s, "codec_data"); - gst_buffer_replace (&h264parse->codec_data, NULL); + src_caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (h264parse)); + + if (src_caps + && gst_structure_has_field (gst_caps_get_structure (src_caps, 0), + "codec_data")) { + /* 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")); } - src_caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (h264parse)); - if (!(src_caps && gst_caps_is_strictly_equal (src_caps, caps))) + if (!(src_caps && gst_caps_is_strictly_equal (src_caps, caps))) { + /* update codec data to new value */ + if (buf) { + gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, buf, NULL); + gst_buffer_replace (&h264parse->codec_data, buf); + gst_buffer_unref (buf); + buf = NULL; + } else { + GstStructure *s; + /* remove any left-over codec-data hanging around */ + s = gst_caps_get_structure (caps, 0); + gst_structure_remove_field (s, "codec_data"); + gst_buffer_replace (&h264parse->codec_data, NULL); + } + gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (h264parse), caps); + } if (src_caps) gst_caps_unref (src_caps); |