mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-04 05:22:30 +00:00
gst/gstcaps.c: Fix crasher when passed NULL. Doc clarification.
Original commit message from CVS: * gst/gstcaps.c: (gst_caps_replace): Fix crasher when passed NULL. Doc clarification. Optimize for the trivial case. * gst/gstpipeline.c: (gst_pipeline_change_state): Small cleanups. * libs/gst/base/gstbasesrc.c: (gst_base_src_loop): Small documentation cleanup. * libs/gst/base/gstbasetransform.c: (gst_base_transform_buffer_alloc): Don't use silly gst_pad_get_negotiated_caps, GST_PAD_CAPS is what we need and it avoids a whole lot of redundant refcount operations.
This commit is contained in:
parent
33d4367def
commit
ccb2e93a3a
6 changed files with 46 additions and 30 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
2006-06-22 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/gstcaps.c: (gst_caps_replace):
|
||||
Fix crasher when passed NULL. Doc clarification.
|
||||
Optimize for the trivial case.
|
||||
|
||||
* gst/gstpipeline.c: (gst_pipeline_change_state):
|
||||
Small cleanups.
|
||||
|
||||
* libs/gst/base/gstbasesrc.c: (gst_base_src_loop):
|
||||
Small documentation cleanup.
|
||||
|
||||
* libs/gst/base/gstbasetransform.c:
|
||||
(gst_base_transform_buffer_alloc):
|
||||
Don't use silly gst_pad_get_negotiated_caps, GST_PAD_CAPS
|
||||
is what we need and it avoids a whole lot of redundant
|
||||
refcount operations.
|
||||
|
||||
2006-06-22 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
Patch by: Philip Jägenstedt <philip at lysator liu se>
|
||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
|||
Subproject commit bbfa0146961f4ca61ddbca7b42360b5741a6354b
|
||||
Subproject commit 123195d3bbcc0b6e1cf867d3a180685f8766a0be
|
|
@ -1560,26 +1560,28 @@ gst_caps_load_thyself (xmlNodePtr parent)
|
|||
* Replaces *caps with @newcaps. Unrefs the #GstCaps in the location
|
||||
* pointed to by @caps, if applicable, then modifies @caps to point to
|
||||
* @newcaps. An additional ref on @newcaps is taken.
|
||||
*
|
||||
* This function does not take any locks so you might want to lock
|
||||
* the object owning @caps pointer.
|
||||
*/
|
||||
void
|
||||
gst_caps_replace (GstCaps ** caps, GstCaps * newcaps)
|
||||
{
|
||||
GstCaps *oldcaps;
|
||||
|
||||
#if 0 /* disable this, since too many plugins rely on undefined behavior */
|
||||
#ifdef USE_POISONING
|
||||
//if (newcaps) CAPS_POISON (newcaps);
|
||||
#endif
|
||||
#endif
|
||||
g_return_if_fail (caps != NULL);
|
||||
|
||||
oldcaps = *caps;
|
||||
|
||||
if (newcaps)
|
||||
gst_caps_ref (newcaps);
|
||||
if (newcaps != oldcaps) {
|
||||
if (newcaps)
|
||||
gst_caps_ref (newcaps);
|
||||
|
||||
*caps = newcaps;
|
||||
*caps = newcaps;
|
||||
|
||||
if (oldcaps)
|
||||
gst_caps_unref (oldcaps);
|
||||
if (oldcaps)
|
||||
gst_caps_unref (oldcaps);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -111,7 +111,6 @@ enum
|
|||
PROP_0,
|
||||
PROP_DELAY,
|
||||
PROP_AUTO_FLUSH_BUS
|
||||
/* FILL ME */
|
||||
};
|
||||
|
||||
#define GST_PIPELINE_GET_PRIVATE(obj) \
|
||||
|
@ -320,7 +319,6 @@ gst_pipeline_get_property (GObject * object, guint prop_id,
|
|||
* A flushing seek also resets the stream time to 0 so that when
|
||||
* we go back to PLAYING after the seek, the base_time is recalculated
|
||||
* and redistributed to the elements.
|
||||
*
|
||||
*/
|
||||
static gboolean
|
||||
do_pipeline_seek (GstElement * element, GstEvent * event)
|
||||
|
@ -506,8 +504,9 @@ gst_pipeline_change_state (GstElement * element, GstStateChange transition)
|
|||
|
||||
if (need_reset)
|
||||
gst_pipeline_set_new_stream_time (pipeline, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||
break;
|
||||
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
||||
|
@ -734,7 +733,7 @@ gst_pipeline_use_clock (GstPipeline * pipeline, GstClock * clock)
|
|||
* @clock: the clock to set
|
||||
*
|
||||
* Set the clock for @pipeline. The clock will be distributed
|
||||
* to all the elements managed by the pipeline.
|
||||
* to all the elements managed by the pipeline.
|
||||
*
|
||||
* Returns: TRUE if the clock could be set on the pipeline. FALSE if
|
||||
* some element did not accept the clock.
|
||||
|
|
|
@ -1530,7 +1530,8 @@ pause:
|
|||
src->priv->last_sent_eos = TRUE;
|
||||
}
|
||||
} else {
|
||||
/* for fatal errors we post an error message */
|
||||
/* for fatal errors we post an error message, post the error
|
||||
* first so the app knows about the error first. */
|
||||
GST_ELEMENT_ERROR (src, STREAM, FAILED,
|
||||
(_("Internal data flow error.")),
|
||||
("streaming task paused, reason %s", reason));
|
||||
|
|
|
@ -1041,32 +1041,31 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
|
|||
buf);
|
||||
} else {
|
||||
/* if we are configured, request a buffer with the src caps */
|
||||
GstCaps *srccaps = gst_pad_get_negotiated_caps (trans->srcpad);
|
||||
GstCaps *sinkcaps = gst_pad_get_negotiated_caps (trans->sinkpad);
|
||||
GstCaps *srccaps;
|
||||
GstCaps *sinkcaps;
|
||||
|
||||
srccaps = GST_PAD_CAPS (trans->srcpad);
|
||||
if (!srccaps)
|
||||
goto not_configured;
|
||||
|
||||
sinkcaps = GST_PAD_CAPS (trans->sinkpad);
|
||||
if (sinkcaps != NULL) {
|
||||
if (sinkcaps != caps || !gst_caps_is_equal (sinkcaps, caps)) {
|
||||
gst_caps_unref (sinkcaps);
|
||||
gst_caps_unref (srccaps);
|
||||
goto not_configured;
|
||||
}
|
||||
gst_caps_unref (sinkcaps);
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (trans, "calling transform_size");
|
||||
if (!gst_base_transform_transform_size (trans,
|
||||
GST_PAD_DIRECTION (pad), caps, size, srccaps, &new_size)) {
|
||||
gst_caps_unref (srccaps);
|
||||
goto unknown_size;
|
||||
}
|
||||
|
||||
res =
|
||||
gst_pad_alloc_buffer_and_set_caps (trans->srcpad, offset, new_size,
|
||||
srccaps, buf);
|
||||
gst_caps_unref (srccaps);
|
||||
}
|
||||
|
||||
if (res == GST_FLOW_OK && !trans->have_same_caps) {
|
||||
|
@ -1075,19 +1074,19 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
|
|||
the alloc_buffer served to transmit caps information but we can't use the
|
||||
buffer. fall through and allocate a buffer corresponding to our sink
|
||||
caps, if any */
|
||||
GstCaps *sinkcaps = gst_pad_get_negotiated_caps (trans->sinkpad);
|
||||
GstCaps *srccaps = gst_pad_get_negotiated_caps (trans->srcpad);
|
||||
GstCaps *sinkcaps;
|
||||
GstCaps *srccaps;
|
||||
|
||||
sinkcaps = GST_PAD_CAPS (trans->sinkpad);
|
||||
if (!sinkcaps)
|
||||
goto not_configured;
|
||||
|
||||
srccaps = GST_PAD_CAPS (trans->srcpad);
|
||||
|
||||
if (!gst_base_transform_transform_size (trans,
|
||||
GST_PAD_DIRECTION (trans->srcpad), srccaps, GST_BUFFER_SIZE (*buf),
|
||||
sinkcaps, &new_size)) {
|
||||
gst_caps_unref (srccaps);
|
||||
gst_caps_unref (sinkcaps);
|
||||
sinkcaps, &new_size))
|
||||
goto unknown_size;
|
||||
}
|
||||
|
||||
gst_buffer_unref (*buf);
|
||||
|
||||
|
@ -1095,9 +1094,6 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
|
|||
gst_buffer_set_caps (*buf, sinkcaps);
|
||||
GST_BUFFER_OFFSET (*buf) = offset;
|
||||
res = GST_FLOW_OK;
|
||||
|
||||
gst_caps_unref (srccaps);
|
||||
gst_caps_unref (sinkcaps);
|
||||
}
|
||||
|
||||
done:
|
||||
|
|
Loading…
Reference in a new issue