rtpstreamdepay: Only allow activation in push mode

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
This commit is contained in:
Sebastian Dröge 2015-08-04 20:59:17 +03:00
parent e1143041ed
commit c9ea95481c

View 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, static GstFlowReturn gst_rtp_stream_depay_handle_frame (GstBaseParse * parse,
GstBaseParseFrame * frame, gint * skipsize); GstBaseParseFrame * frame, gint * skipsize);
static gboolean gst_rtp_stream_depay_sink_activate (GstPad * pad,
GstObject * parent);
static void static void
gst_rtp_stream_depay_class_init (GstRtpStreamDepayClass * klass) gst_rtp_stream_depay_class_init (GstRtpStreamDepayClass * klass)
{ {
@ -95,6 +98,11 @@ static void
gst_rtp_stream_depay_init (GstRtpStreamDepay * self) gst_rtp_stream_depay_init (GstRtpStreamDepay * self)
{ {
gst_base_parse_set_min_frame_size (GST_BASE_PARSE (self), 2); 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 static gboolean
@ -211,6 +219,12 @@ gst_rtp_stream_depay_handle_frame (GstBaseParse * parse,
return gst_base_parse_finish_frame (parse, frame, size + 2); 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 gboolean
gst_rtp_stream_depay_plugin_init (GstPlugin * plugin) gst_rtp_stream_depay_plugin_init (GstPlugin * plugin)
{ {