rtpstreamdepay: Only allow activation in push mode
authorSebastian Dröge <sebastian@centricular.com>
Tue, 4 Aug 2015 17:59:17 +0000 (20:59 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Tue, 4 Aug 2015 18:00:31 +0000 (21:00 +0300)
We need a proper caps event from upstream with the full RTP caps as we can't
create caps ourselves from thin air. Fixes usage of rtpstreamdepay after e.g.
a filesrc or any other element that supports pull mode.

https://bugzilla.gnome.org/show_bug.cgi?id=753066

gst/rtp/gstrtpstreamdepay.c

index 26a2e32..699b15c 100644 (file)
@@ -64,6 +64,9 @@ static GstCaps *gst_rtp_stream_depay_get_sink_caps (GstBaseParse * parse,
 static GstFlowReturn gst_rtp_stream_depay_handle_frame (GstBaseParse * parse,
     GstBaseParseFrame * frame, gint * skipsize);
 
+static gboolean gst_rtp_stream_depay_sink_activate (GstPad * pad,
+    GstObject * parent);
+
 static void
 gst_rtp_stream_depay_class_init (GstRtpStreamDepayClass * klass)
 {
@@ -95,6 +98,11 @@ static void
 gst_rtp_stream_depay_init (GstRtpStreamDepay * self)
 {
   gst_base_parse_set_min_frame_size (GST_BASE_PARSE (self), 2);
+
+  /* Force activation in push mode. We need to get a caps event from upstream
+   * to know the full RTP caps. */
+  gst_pad_set_activate_function (GST_BASE_PARSE_SINK_PAD (self),
+      gst_rtp_stream_depay_sink_activate);
 }
 
 static gboolean
@@ -211,6 +219,12 @@ gst_rtp_stream_depay_handle_frame (GstBaseParse * parse,
   return gst_base_parse_finish_frame (parse, frame, size + 2);
 }
 
+static gboolean
+gst_rtp_stream_depay_sink_activate (GstPad * pad, GstObject * parent)
+{
+  return gst_pad_activate_mode (pad, GST_PAD_MODE_PUSH, TRUE);
+}
+
 gboolean
 gst_rtp_stream_depay_plugin_init (GstPlugin * plugin)
 {