gst-plugins-bad: h264parse: decrease passthrough negotiation preference

Mark Nauwelaerts mnauw at kemper.freedesktop.org
Fri Feb 3 02:30:45 PST 2012


Module: gst-plugins-bad
Branch: master
Commit: c36bb8b73d224ce4872e1533694577707446a527
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=c36bb8b73d224ce4872e1533694577707446a527

Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date:   Fri Feb  3 11:26:53 2012 +0100

h264parse: decrease passthrough negotiation preference

Also ensure parsing fixed caps when negotiating rather than failing to
handle non-fixed list cases.

See #668471.

---

 gst/videoparsers/gsth264parse.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c
index 230fd85..3482d5b 100644
--- a/gst/videoparsers/gsth264parse.c
+++ b/gst/videoparsers/gsth264parse.c
@@ -293,6 +293,9 @@ gst_h264_parse_get_string (GstH264Parse * parse, gboolean format, gint code)
 static void
 gst_h264_parse_format_from_caps (GstCaps * caps, guint * format, guint * align)
 {
+  g_return_if_fail (gst_caps_is_fixed (caps));
+
+  GST_DEBUG ("parsing caps: %" GST_PTR_FORMAT, caps);
 
   if (format)
     *format = GST_H264_PARSE_FORMAT_NONE;
@@ -332,9 +335,20 @@ gst_h264_parse_negotiate (GstH264Parse * h264parse, GstCaps * in_caps)
   guint format = GST_H264_PARSE_FORMAT_NONE;
   guint align = GST_H264_PARSE_ALIGN_NONE;
 
+  g_return_if_fail ((in_caps == NULL) || gst_caps_is_fixed (in_caps));
+
   caps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (h264parse));
   GST_DEBUG_OBJECT (h264parse, "allowed caps: %" GST_PTR_FORMAT, caps);
 
+  /* concentrate on leading structure, since decodebin2 parser
+   * capsfilter always includes parser template caps */
+  if (caps) {
+    caps = gst_caps_make_writable (caps);
+    gst_caps_truncate (caps);
+    GST_DEBUG_OBJECT (h264parse, "negotiating with caps: %" GST_PTR_FORMAT,
+        caps);
+  }
+
   if (in_caps && caps) {
     if (gst_caps_can_intersect (in_caps, caps)) {
       GST_DEBUG_OBJECT (h264parse, "downstream accepts upstream caps");
@@ -345,6 +359,8 @@ gst_h264_parse_negotiate (GstH264Parse * h264parse, GstCaps * in_caps)
   }
 
   if (caps) {
+    /* fixate to avoid ambiguity with lists when parsing */
+    gst_pad_fixate_caps (GST_BASE_PARSE_SRC_PAD (h264parse), caps);
     gst_h264_parse_format_from_caps (caps, &format, &align);
     gst_caps_unref (caps);
   }



More information about the gstreamer-commits mailing list