Commit 1a557e60 authored by Wim Taymans's avatar Wim Taymans

playbin2: fix refcounting of visualisations

See #577794.
parent 33ef15fa
...@@ -433,7 +433,7 @@ gst_play_sink_vis_blocked (GstPad * tee_pad, gboolean blocked, ...@@ -433,7 +433,7 @@ gst_play_sink_vis_blocked (GstPad * tee_pad, gboolean blocked,
gst_bin_remove (GST_BIN_CAST (chain->chain.bin), chain->vis); gst_bin_remove (GST_BIN_CAST (chain->chain.bin), chain->vis);
/* add new plugin and set state to playing */ /* add new plugin and set state to playing */
chain->vis = gst_object_ref (playsink->visualisation); chain->vis = playsink->visualisation;
gst_bin_add (GST_BIN_CAST (chain->chain.bin), chain->vis); gst_bin_add (GST_BIN_CAST (chain->chain.bin), chain->vis);
gst_element_set_state (chain->vis, GST_STATE_PLAYING); gst_element_set_state (chain->vis, GST_STATE_PLAYING);
...@@ -1567,6 +1567,7 @@ gen_vis_chain (GstPlaySink * playsink) ...@@ -1567,6 +1567,7 @@ gen_vis_chain (GstPlaySink * playsink)
GstBin *bin; GstBin *bin;
gboolean res; gboolean res;
GstPad *pad; GstPad *pad;
GstElement *elem;
chain = g_new0 (GstPlayVisChain, 1); chain = g_new0 (GstPlayVisChain, 1);
chain->chain.playsink = playsink; chain->chain.playsink = playsink;
...@@ -1598,12 +1599,17 @@ gen_vis_chain (GstPlaySink * playsink) ...@@ -1598,12 +1599,17 @@ gen_vis_chain (GstPlaySink * playsink)
chain->blockpad = gst_element_get_static_pad (chain->resample, "src"); chain->blockpad = gst_element_get_static_pad (chain->resample, "src");
if (playsink->visualisation) { if (playsink->visualisation) {
chain->vis = gst_object_ref (playsink->visualisation); GST_DEBUG_OBJECT (playsink, "trying configure vis");
} else { chain->vis = try_element (playsink, playsink->visualisation, FALSE);
chain->vis = gst_element_factory_make ("goom", "vis");
if (!chain->vis)
goto no_goom;
} }
if (chain->vis == NULL) {
GST_DEBUG_OBJECT (playsink, "trying goom");
elem = gst_element_factory_make ("goom", "vis");
chain->vis = try_element (playsink, elem, TRUE);
}
if (chain->vis == NULL)
goto no_goom;
gst_bin_add (bin, chain->vis); gst_bin_add (bin, chain->vis);
res = gst_element_link_pads (chain->queue, "src", chain->conv, "sink"); res = gst_element_link_pads (chain->queue, "src", chain->conv, "sink");
...@@ -1776,8 +1782,8 @@ gst_play_sink_reconfigure (GstPlaySink * playsink) ...@@ -1776,8 +1782,8 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
playsink->audio_tee_vissrc = NULL; playsink->audio_tee_vissrc = NULL;
} }
srcpad = srcpad =
gst_element_get_static_pad (GST_ELEMENT_CAST (playsink->vischain-> gst_element_get_static_pad (GST_ELEMENT_CAST (playsink->
chain.bin), "src"); vischain->chain.bin), "src");
gst_pad_unlink (srcpad, playsink->videochain->sinkpad); gst_pad_unlink (srcpad, playsink->videochain->sinkpad);
} }
add_chain (GST_PLAY_CHAIN (playsink->videochain), FALSE); add_chain (GST_PLAY_CHAIN (playsink->videochain), FALSE);
...@@ -1942,8 +1948,8 @@ gst_play_sink_reconfigure (GstPlaySink * playsink) ...@@ -1942,8 +1948,8 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
if (playsink->vischain) { if (playsink->vischain) {
GST_DEBUG_OBJECT (playsink, "setting up vis chain"); GST_DEBUG_OBJECT (playsink, "setting up vis chain");
srcpad = srcpad =
gst_element_get_static_pad (GST_ELEMENT_CAST (playsink->vischain-> gst_element_get_static_pad (GST_ELEMENT_CAST (playsink->
chain.bin), "src"); vischain->chain.bin), "src");
add_chain (GST_PLAY_CHAIN (playsink->vischain), TRUE); add_chain (GST_PLAY_CHAIN (playsink->vischain), TRUE);
activate_chain (GST_PLAY_CHAIN (playsink->vischain), TRUE); activate_chain (GST_PLAY_CHAIN (playsink->vischain), TRUE);
if (playsink->audio_tee_vissrc == NULL) { if (playsink->audio_tee_vissrc == NULL) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment