rtp: Filter with the filter caps in the payloader's getcaps
authorSebastian Dröge <sebastian@centricular.com>
Mon, 25 Jul 2016 10:34:02 +0000 (13:34 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 25 Jul 2016 10:35:18 +0000 (13:35 +0300)
gst/rtp/gstrtpbvpay.c
gst/rtp/gstrtpceltpay.c
gst/rtp/gstrtpg722pay.c
gst/rtp/gstrtph263ppay.c
gst/rtp/gstrtph265pay.c
gst/rtp/gstrtpilbcpay.c

index 9292681..e202015 100644 (file)
@@ -217,6 +217,17 @@ gst_rtp_bv_pay_sink_getcaps (GstRTPBasePayload * rtppayload, GstPad * pad,
     }
     gst_caps_unref (otherpadcaps);
   }
+
+  if (filter) {
+    GstCaps *tmp;
+
+    GST_DEBUG_OBJECT (rtppayload, "Intersect %" GST_PTR_FORMAT " and filter %"
+        GST_PTR_FORMAT, caps, filter);
+    tmp = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (caps);
+    caps = tmp;
+  }
+
   return caps;
 }
 
index db2ebff..1d5287d 100644 (file)
@@ -200,6 +200,16 @@ gst_rtp_celt_pay_getcaps (GstRTPBasePayload * payload, GstPad * pad,
     gst_caps_unref (otherpadcaps);
   }
 
+  if (filter) {
+    GstCaps *tmp;
+
+    GST_DEBUG_OBJECT (payload, "Intersect %" GST_PTR_FORMAT " and filter %"
+        GST_PTR_FORMAT, caps, filter);
+    tmp = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (caps);
+    caps = tmp;
+  }
+
   return caps;
 }
 
index eb88c3c..c2fe88d 100644 (file)
@@ -213,6 +213,17 @@ gst_rtp_g722_pay_getcaps (GstRTPBasePayload * rtppayload, GstPad * pad,
     }
     gst_caps_unref (otherpadcaps);
   }
+
+  if (filter) {
+    GstCaps *tmp;
+
+    GST_DEBUG_OBJECT (rtppayload, "Intersect %" GST_PTR_FORMAT " and filter %"
+        GST_PTR_FORMAT, caps, filter);
+    tmp = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (caps);
+    caps = tmp;
+  }
+
   return caps;
 }
 
index 844d3f7..176d7cc 100644 (file)
@@ -254,8 +254,9 @@ gst_rtp_h263p_pay_sink_getcaps (GstRTPBasePayload * payload, GstPad * pad,
   if (!peercaps || gst_caps_is_any (peercaps)) {
     if (peercaps)
       gst_caps_unref (peercaps);
-    return
+    caps =
         gst_pad_get_pad_template_caps (GST_RTP_BASE_PAYLOAD_SINKPAD (payload));
+    goto done;
   }
 
   /* We basically need to differentiate two use-cases here: One where there's
@@ -264,9 +265,11 @@ gst_rtp_h263p_pay_sink_getcaps (GstRTPBasePayload * payload, GstPad * pad,
    * we want it to produce. The second case is simply payloader ! depayloader
    * where we are dealing with the depayloader's template caps. In this case
    * we should accept any input compatible with our sink template caps. */
-  if (!gst_caps_is_fixed (peercaps))
-    return
+  if (!gst_caps_is_fixed (peercaps)) {
+    caps =
         gst_pad_get_pad_template_caps (GST_RTP_BASE_PAYLOAD_SINKPAD (payload));
+    goto done;
+  }
 
   templ = gst_pad_get_pad_template_caps (GST_RTP_BASE_PAYLOAD_SRCPAD (payload));
   intersect = gst_caps_intersect (peercaps, templ);
@@ -601,6 +604,18 @@ gst_rtp_h263p_pay_sink_getcaps (GstRTPBasePayload * payload, GstPad * pad,
 
   gst_caps_unref (intersect);
 
+done:
+
+  if (filter) {
+    GstCaps *tmp;
+
+    GST_DEBUG_OBJECT (payload, "Intersect %" GST_PTR_FORMAT " and filter %"
+        GST_PTR_FORMAT, caps, filter);
+    tmp = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (caps);
+    caps = tmp;
+  }
+
   return caps;
 }
 
index b63360e..10898b8 100644 (file)
@@ -368,6 +368,16 @@ gst_rtp_h265_pay_getcaps (GstRTPBasePayload * payload, GstPad * pad,
 
 done:
 
+  if (filter) {
+    GstCaps *tmp;
+
+    GST_DEBUG_OBJECT (payload, "Intersect %" GST_PTR_FORMAT " and filter %"
+        GST_PTR_FORMAT, caps, filter);
+    tmp = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (caps);
+    caps = tmp;
+  }
+
   gst_caps_unref (template_caps);
   gst_caps_unref (allowed_caps);
 
index 83161ff..cbc7d93 100644 (file)
@@ -206,6 +206,17 @@ gst_rtp_ilbc_pay_sink_getcaps (GstRTPBasePayload * rtppayload, GstPad * pad,
     }
     gst_caps_unref (otherpadcaps);
   }
+
+  if (filter) {
+    GstCaps *tmp;
+
+    GST_DEBUG_OBJECT (rtppayload, "Intersect %" GST_PTR_FORMAT " and filter %"
+        GST_PTR_FORMAT, caps, filter);
+    tmp = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (caps);
+    caps = tmp;
+  }
+
   return caps;
 }