Commit f48fef2f authored by Sebastian Dröge's avatar Sebastian Dröge

multipartdemux: Post an error message on the bus if we got EOS without having added any pads

parent 37f991f0
......@@ -106,6 +106,8 @@ static const GstNamesMap gstnames[] = {
static GstFlowReturn gst_multipart_demux_chain (GstPad * pad,
GstObject * parent, GstBuffer * buf);
static gboolean gst_multipart_demux_event (GstPad * pad,
GstObject * parent, GstEvent * event);
static GstStateChangeReturn gst_multipart_demux_change_state (GstElement *
element, GstStateChange transition);
......@@ -179,6 +181,8 @@ gst_multipart_demux_init (GstMultipartDemux * multipart)
gst_element_add_pad (GST_ELEMENT_CAST (multipart), multipart->sinkpad);
gst_pad_set_chain_function (multipart->sinkpad,
GST_DEBUG_FUNCPTR (gst_multipart_demux_chain));
gst_pad_set_event_function (multipart->sinkpad,
GST_DEBUG_FUNCPTR (gst_multipart_demux_event));
multipart->adapter = gst_adapter_new ();
multipart->boundary = DEFAULT_BOUNDARY;
......@@ -571,6 +575,30 @@ multipart_find_boundary (GstMultipartDemux * multipart, gint * datalen)
return MULTIPART_NEED_MORE_DATA;
}
static gboolean
gst_multipart_demux_event (GstPad * pad, GstObject * parent, GstEvent * event)
{
GstMultipartDemux *multipart;
multipart = GST_MULTIPART_DEMUX (parent);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
if (!multipart->srcpads) {
GST_ELEMENT_ERROR (multipart, STREAM, WRONG_TYPE,
("This stream contains no valid streams."),
("Got EOS before adding any pads"));
gst_event_unref (event);
return FALSE;
} else {
return gst_pad_event_default (pad, parent, event);
}
break;
default:
return gst_pad_event_default (pad, parent, event);
}
}
static GstFlowReturn
gst_multipart_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment