+2008-10-13 Wim Taymans <wim.taymans@collabora.co.uk>
+
+ * gst-libs/gst/rtp/gstbasertpdepayload.c:
+ (gst_base_rtp_depayload_setcaps), (gst_base_rtp_depayload_chain),
+ (gst_base_rtp_depayload_set_gst_timestamp),
+ (gst_base_rtp_depayload_change_state):
+ * gst-libs/gst/rtp/gstbasertpdepayload.h:
+ Add some more G_LIKELY
+ Fail when the setcaps function was not called.
+
+ * gst-libs/gst/rtp/gstbasertppayload.c:
+ (gst_basertppayload_set_outcaps):
+ Propagate return value of setcaps.
+
2008-10-13 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* gst/subparse/Makefile.am:
GstClockTime duration;
guint32 next_seqnum;
+
+ gboolean negotiated;
};
/* Filter signals and args */
else
res = TRUE;
+ priv->negotiated = res;
+
gst_object_unref (filter);
return res;
gint gap;
filter = GST_BASE_RTP_DEPAYLOAD (GST_OBJECT_PARENT (pad));
+ priv = filter->priv;
+
+ /* we must have a setcaps first */
+ if (G_UNLIKELY (!priv->negotiated))
+ goto not_negotiated;
/* we must validate, it's possible that this element is plugged right after a
* network receiver and we don't want to operate on invalid data */
- if (!gst_rtp_buffer_validate (in))
+ if (G_UNLIKELY (!gst_rtp_buffer_validate (in)))
goto invalid_buffer;
- priv = filter->priv;
priv->discont = GST_BUFFER_IS_DISCONT (in);
timestamp = GST_BUFFER_TIMESTAMP (in);
/* Check seqnum. This is a very simple check that makes sure that the seqnums
* are striclty increasing, dropping anything that is out of the ordinary. We
* can only do this when the next_seqnum is known. */
- if (priv->next_seqnum != -1) {
+ if (G_LIKELY (priv->next_seqnum != -1)) {
gap = gst_rtp_buffer_compare_seqnum (seqnum, priv->next_seqnum);
/* if we have no gap, all is fine */
}
priv->next_seqnum = (seqnum + 1) & 0xffff;
- if (discont && !priv->discont) {
+ if (G_UNLIKELY (discont && !priv->discont)) {
GST_LOG_OBJECT (filter, "mark DISCONT on input buffer");
/* we detected a seqnum discont but the buffer was not flagged with a discont,
* set the discont flag so that the subclass can throw away old data. */
return ret;
/* ERRORS */
+not_negotiated:
+ {
+ /* this is not fatal but should be filtered earlier */
+ GST_ELEMENT_ERROR (filter, CORE, NEGOTIATION, (NULL),
+ ("Not RTP format was negotiated"));
+ gst_buffer_unref (in);
+ return GST_FLOW_NOT_NEGOTIATED;
+ }
invalid_buffer:
{
/* this is not fatal but should be filtered earlier */
GST_BUFFER_DURATION (buf) = priv->duration;
/* if this is the first buffer send a NEWSEGMENT */
- if (filter->need_newsegment) {
+ if (G_UNLIKELY (filter->need_newsegment)) {
GstEvent *event;
event = create_segment_event (filter, FALSE, 0);
priv->npt_stop = -1;
priv->play_speed = 1.0;
priv->play_scale = 1.0;
- filter->priv->next_seqnum = -1;
+ priv->next_seqnum = -1;
+ priv->negotiated = FALSE;
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
{
GstElementClass parent_class;
- /* virtuals */
+ /* virtuals, inform the subclass of the caps. */
gboolean (*set_caps) (GstBaseRTPDepayload *filter, GstCaps *caps);
/* non-pure function, default implementation in base class
GstFlowReturn (*add_to_queue) (GstBaseRTPDepayload *filter, GstBuffer *in);
/* pure virtual function, child must use this to process incoming
- * rtp packets. If the child returns a buffer, the timestamp of @in will be
- * applied to the result buffer and the buffer will be pushed. If this
- * function returns %NULL, nothing is pushed. */
+ * rtp packets. If the child returns a buffer without a valid timestamp,
+ * the timestamp of @in will be applied to the result buffer and the
+ * buffer will be pushed. If this function returns %NULL, nothing is
+ * pushed. */
GstBuffer * (*process) (GstBaseRTPDepayload *base, GstBuffer *in);
/* non-pure function used to convert from RTP timestamp to GST timestamp
...)
{
GstCaps *srccaps, *peercaps;
+ gboolean res;
/* fill in the defaults, there properties cannot be negotiated. */
srccaps = gst_caps_new_simple ("application/x-rtp",
GST_DEBUG_OBJECT (payload, "with peer caps: %" GST_PTR_FORMAT, srccaps);
}
- gst_pad_set_caps (GST_BASE_RTP_PAYLOAD_SRCPAD (payload), srccaps);
+ res = gst_pad_set_caps (GST_BASE_RTP_PAYLOAD_SRCPAD (payload), srccaps);
gst_caps_unref (srccaps);
- return TRUE;
+ return res;
}
/**