basetransform: don't pass NULL outcaps to transform_size on shutdown

gst_pad_get_current_caps() on the source pad might yield NULL caps
if we're being shut down and the source pad has already been
deactivated by the other thread that's changing state. Just bail
out in that case, instead of passing NULL caps to the transform_size
function, which it might not expect.

Fixes spurious warnings in audioresample shutdown unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=693996
This commit is contained in:
Tim-Philipp Müller 2013-02-16 23:02:21 +00:00
parent 15a3a5954f
commit 5a73d15c80

View file

@ -1574,6 +1574,10 @@ default_prepare_output_buffer (GstBaseTransform * trans,
incaps = gst_pad_get_current_caps (trans->sinkpad);
outcaps = gst_pad_get_current_caps (trans->srcpad);
/* srcpad might be flushing already if we're being shut down */
if (outcaps == NULL)
goto no_outcaps;
GST_DEBUG_OBJECT (trans, "getting output size for alloc");
/* copy transform, figure out the output size */
insize = gst_buffer_get_size (inbuf);
@ -1602,7 +1606,6 @@ done:
return GST_FLOW_OK;
/* ERRORS */
/* ERRORS */
activate_failed:
{
GST_ELEMENT_ERROR (trans, RESOURCE, SETTINGS,
@ -1619,6 +1622,12 @@ alloc_failed:
GST_DEBUG_OBJECT (trans, "could not allocate buffer from pool");
return ret;
}
no_outcaps:
{
GST_DEBUG_OBJECT (trans, "no output caps, source pad has been deactivated");
gst_caps_unref (incaps);
return GST_FLOW_FLUSHING;
}
}
typedef struct