gstqueue, gstqueue2: check if parent of pad is NULL in _getcaps

Parent of the pad (the queue) may be set to NULL while there is
a buffer alloc going on.
This commit is contained in:
Stian Selnes 2011-03-29 11:57:06 +02:00 committed by Sebastian Dröge
parent ba6054b862
commit 339df347a0
2 changed files with 10 additions and 2 deletions

View file

@ -487,13 +487,17 @@ gst_queue_getcaps (GstPad * pad)
GstPad *otherpad;
GstCaps *result;
queue = GST_QUEUE (GST_PAD_PARENT (pad));
queue = GST_QUEUE (gst_pad_get_parent (pad));
if (G_UNLIKELY (queue == NULL))
return gst_caps_new_any ();
otherpad = (pad == queue->srcpad ? queue->sinkpad : queue->srcpad);
result = gst_pad_peer_get_caps (otherpad);
if (result == NULL)
result = gst_caps_new_any ();
gst_object_unref (queue);
return result;
}

View file

@ -648,13 +648,17 @@ gst_queue2_getcaps (GstPad * pad)
GstPad *otherpad;
GstCaps *result;
queue = GST_QUEUE2 (GST_PAD_PARENT (pad));
queue = GST_QUEUE2 (gst_pad_get_parent (pad));
if (G_UNLIKELY (queue == NULL))
return gst_caps_new_any ();
otherpad = (pad == queue->srcpad ? queue->sinkpad : queue->srcpad);
result = gst_pad_peer_get_caps (otherpad);
if (result == NULL)
result = gst_caps_new_any ();
gst_object_unref (queue);
return result;
}