From d58f4fcf48c768607c11597bf83c0e6db469b4b5 Mon Sep 17 00:00:00 2001 From: Josep Torra Valles Date: Fri, 12 Feb 2010 19:43:13 +0100 Subject: [PATCH] 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. --- gst/playback/gstplaysink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c index 9854dd6a82..ac70c68e72 100644 --- a/gst/playback/gstplaysink.c +++ b/gst/playback/gstplaysink.c @@ -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 *