playsink: Reset the sink's state to NULL before unreffing it unless it's the same instance again

This makes sure that we don't destroy the last reference before the
element gets back to NULL state. Fixes assertion failures if a playbin2
instance is reused but different sinks are automatically chosen because
of different caps.
This commit is contained in:
Josep Torra Valles 2010-02-12 19:43:13 +01:00 committed by Sebastian Dröge
parent 76f715cb8b
commit d58f4fcf48

View file

@ -445,8 +445,11 @@ gst_play_sink_set_sink (GstPlaySink * playsink, GstPlaySinkType type,
}
GST_PLAY_SINK_UNLOCK (playsink);
if (old)
if (old) {
if (old != sink)
gst_element_set_state (old, GST_STATE_NULL);
gst_object_unref (old);
}
}
GstElement *