rtph264pay: Add unrestricted caps
authorJonas Holmberg <jonashg@axis.com>
Mon, 21 May 2012 10:17:35 +0000 (12:17 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 24 May 2012 08:01:19 +0000 (10:01 +0200)
If there are no profile restrictions downstream, return caps with
profile=constrained-baseline in the first structure and append
unrestricted caps as the last structure.

Fixes bug #672019

gst/rtp/gstrtph264pay.c

index 90a41be..1190795 100644 (file)
@@ -273,6 +273,7 @@ gst_rtp_h264_pay_getcaps (GstRTPBasePayload * payload, GstPad * pad,
   GstCaps *template_caps;
   GstCaps *allowed_caps;
   GstCaps *caps, *icaps;
+  gboolean append_unrestricted;
   guint i;
 
   allowed_caps =
@@ -296,6 +297,7 @@ gst_rtp_h264_pay_getcaps (GstRTPBasePayload * payload, GstPad * pad,
 
   caps = gst_caps_new_empty ();
 
+  append_unrestricted = FALSE;
   for (i = 0; i < gst_caps_get_size (allowed_caps); i++) {
     GstStructure *s = gst_caps_get_structure (allowed_caps, i);
     GstStructure *new_s = gst_structure_new_empty ("video/x-h264");
@@ -364,15 +366,20 @@ gst_rtp_h264_pay_getcaps (GstRTPBasePayload * payload, GstPad * pad,
             "profile", G_TYPE_STRING, "constrained-baseline", NULL);
       }
     } else {
-      /* No profile-level-id also means baseline */
+      /* No profile-level-id means baseline or unrestricted */
 
       gst_structure_set (new_s,
           "profile", G_TYPE_STRING, "constrained-baseline", NULL);
+      append_unrestricted = TRUE;
     }
 
     caps = gst_caps_merge_structure (caps, new_s);
   }
 
+  if (append_unrestricted) {
+    gst_caps_merge_structure (caps, gst_structure_new ("video/x-h264", NULL));
+  }
+
   icaps = gst_caps_intersect (caps, template_caps);
   gst_caps_unref (caps);
   caps = icaps;