playbin2: fix refcounting of _get_sink()

g_value_set_object() increases the refcount of the sink, which is not needed
because the object should already be refcounted. Make sure this is always the
case and use g_value_take_object().

Fixes: #592884
This commit is contained in:
Wim Taymans 2009-08-24 15:06:28 +02:00
parent 8ce3612b71
commit c3ebeec5a5

View file

@ -1618,8 +1618,12 @@ gst_play_bin_get_current_sink (GstPlayBin * playbin, GstElement ** elem,
GST_PTR_FORMAT ", the originally set %s sink is %" GST_PTR_FORMAT, GST_PTR_FORMAT ", the originally set %s sink is %" GST_PTR_FORMAT,
dbg, sink, dbg, *elem); dbg, sink, dbg, *elem);
if (sink == NULL) if (sink == NULL) {
sink = *elem; GST_PLAY_BIN_LOCK (playbin);
if ((sink = *elem))
gst_object_ref (sink);
GST_PLAY_BIN_UNLOCK (playbin);
}
return sink; return sink;
} }
@ -1720,26 +1724,26 @@ gst_play_bin_get_property (GObject * object, guint prop_id, GValue * value,
GST_PLAY_BIN_UNLOCK (playbin); GST_PLAY_BIN_UNLOCK (playbin);
break; break;
case PROP_VIDEO_SINK: case PROP_VIDEO_SINK:
g_value_set_object (value, g_value_take_object (value,
gst_play_bin_get_current_sink (playbin, &playbin->video_sink, gst_play_bin_get_current_sink (playbin, &playbin->video_sink,
"video", GST_PLAY_SINK_TYPE_VIDEO)); "video", GST_PLAY_SINK_TYPE_VIDEO));
break; break;
case PROP_AUDIO_SINK: case PROP_AUDIO_SINK:
g_value_set_object (value, g_value_take_object (value,
gst_play_bin_get_current_sink (playbin, &playbin->audio_sink, gst_play_bin_get_current_sink (playbin, &playbin->audio_sink,
"audio", GST_PLAY_SINK_TYPE_AUDIO)); "audio", GST_PLAY_SINK_TYPE_AUDIO));
break; break;
case PROP_VIS_PLUGIN: case PROP_VIS_PLUGIN:
g_value_set_object (value, g_value_take_object (value,
gst_play_sink_get_vis_plugin (playbin->playsink)); gst_play_sink_get_vis_plugin (playbin->playsink));
break; break;
case PROP_TEXT_SINK: case PROP_TEXT_SINK:
g_value_set_object (value, g_value_take_object (value,
gst_play_bin_get_current_sink (playbin, &playbin->text_sink, gst_play_bin_get_current_sink (playbin, &playbin->text_sink,
"text", GST_PLAY_SINK_TYPE_TEXT)); "text", GST_PLAY_SINK_TYPE_TEXT));
break; break;
case PROP_SUBPIC_SINK: case PROP_SUBPIC_SINK:
g_value_set_object (value, g_value_take_object (value,
gst_play_bin_get_current_sink (playbin, &playbin->subpic_sink, gst_play_bin_get_current_sink (playbin, &playbin->subpic_sink,
"subpicture", GST_PLAY_SINK_TYPE_SUBPIC)); "subpicture", GST_PLAY_SINK_TYPE_SUBPIC));
break; break;