playback: Delay usage of GstFactoryList

By delaying it to when it's actually needed, we speed things up a bit
since some elements might have been added/removed in between.

https://bugzilla.gnome.org/show_bug.cgi?id=626718
This commit is contained in:
Edward Hervey 2010-08-06 17:16:27 +02:00
parent 268270d35e
commit 8b4bea5f6a
3 changed files with 2 additions and 16 deletions

View file

@ -913,7 +913,6 @@ gst_decode_bin_init (GstDecodeBin * decode_bin)
{
/* first filter out the interesting element factories */
decode_bin->factories_lock = g_mutex_new ();
gst_decode_bin_update_factories_list (decode_bin);
/* we create the typefind element only once */
decode_bin->typefind = gst_element_factory_make ("typefind", "typefind");
@ -3496,9 +3495,6 @@ gst_decode_bin_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_NULL_TO_READY:
if (dbin->typefind == NULL)
goto missing_typefind;
g_mutex_lock (dbin->factories_lock);
gst_decode_bin_update_factories_list (dbin);
g_mutex_unlock (dbin->factories_lock);
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
/* Make sure we've cleared all existing chains */

View file

@ -1164,8 +1164,6 @@ gst_play_bin_init (GstPlayBin * playbin)
/* first filter out the interesting element factories */
playbin->elements_lock = g_mutex_new ();
gst_play_bin_update_elements_list (playbin);
GST_FACTORY_LIST_DEBUG (playbin->elements);
/* add sink */
playbin->playsink = g_object_new (GST_TYPE_PLAY_SINK, NULL);
@ -1205,6 +1203,7 @@ gst_play_bin_finalize (GObject * object)
if (playbin->text_sink)
gst_object_unref (playbin->text_sink);
if (playbin->elements)
g_value_array_free (playbin->elements);
g_mutex_free (playbin->lock);
g_mutex_free (playbin->dyn_lock);
@ -3415,9 +3414,6 @@ gst_play_bin_change_state (GstElement * element, GstStateChange transition)
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
g_mutex_lock (playbin->elements_lock);
gst_play_bin_update_elements_list (playbin);
g_mutex_unlock (playbin->elements_lock);
memset (&playbin->duration, 0, sizeof (playbin->duration));
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:

View file

@ -530,7 +530,6 @@ gst_uri_decode_bin_init (GstURIDecodeBin * dec, GstURIDecodeBinClass * klass)
{
/* first filter out the interesting element factories */
dec->factories_lock = g_mutex_new ();
gst_uri_decode_bin_update_factories_list (dec);
dec->lock = g_mutex_new ();
@ -2199,11 +2198,6 @@ gst_uri_decode_bin_change_state (GstElement * element,
decoder = GST_URI_DECODE_BIN (element);
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
g_mutex_lock (decoder->factories_lock);
gst_uri_decode_bin_update_factories_list (decoder);
g_mutex_unlock (decoder->factories_lock);
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
if (!setup_source (decoder))
goto source_failed;