From a25bf11c1ce7f26c13db2b9b6c2ce21beab4827c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 4 Dec 2015 12:48:03 +0100 Subject: [PATCH] pinospay: error if downstream doesn't handle control-messages We really need a downstream element that can handle the control-messages or else we'll be losing the data. --- src/gst/gstpinospay.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/gst/gstpinospay.c b/src/gst/gstpinospay.c index e469c28a2..9bf721e32 100644 --- a/src/gst/gstpinospay.c +++ b/src/gst/gstpinospay.c @@ -103,6 +103,33 @@ gst_pinos_pay_query (GstPad * pad, GstObject * parent, GstQuery * query) return res; } +static gboolean +do_allocation (GstPinosPay *pay, GstCaps *caps) +{ + GstQuery *query; + + GST_DEBUG_OBJECT (pay, "doing allocation query"); + query = gst_query_new_allocation (caps, TRUE); + if (!gst_pad_peer_query (pay->srcpad, query)) { + /* not a problem, just debug a little */ + GST_DEBUG_OBJECT (pay, "peer ALLOCATION query failed"); + } + if (!gst_query_find_allocation_meta (query, + GST_NET_CONTROL_MESSAGE_META_API_TYPE, NULL)) + goto no_meta; + + return TRUE; + + /* ERRORS */ +no_meta: + { + GST_ELEMENT_ERROR (pay, STREAM, FORMAT, + ("Incompatible downstream element"), + ("The downstream element does not handle control-message metadata API")); + return FALSE; + } +} + static gboolean gst_pinos_pay_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { @@ -123,6 +150,10 @@ gst_pinos_pay_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) caps = gst_caps_new_empty_simple ("application/x-pinos"); res = gst_pad_push_event (pay->srcpad, gst_event_new_caps (caps)); gst_caps_unref (caps); + + if (res) + /* now negotiate the allocation */ + res = do_allocation (pay, caps); break; } default: