GNOME Bugzilla – Bug 440127
Autoaudiosink does extra switching between null and ready with sink
Last modified: 2007-05-25 10:24:35 UTC
gst_auto_audio_sink_find_best() currently finds an actual sink and leaves it to READY state. However soon the state is switched temporarily back to NULL when syncing state with autoaudiosink container in gst_auto_audio_sink_detect(): /* find element */ GST_DEBUG_OBJECT (sink, "Creating new kid"); if (!(esink = gst_auto_audio_sink_find_best (sink))) { return FALSE; } sink->kid = esink; gst_element_set_state (sink->kid, GST_STATE (sink)); gst_bin_add (GST_BIN (sink), esink); Is it necessary to set the state of actual sink according to container state before adding it? The state of autoaudiosink is always NULL here since we're doing null_to_ready state change. It would be good to avoid extra switches between null and ready states if the opening of audio device is slow.
We could just do: if (GST_STATE (sink->kid) < GST_STATE (sink)) gst_element_set_state (sink->kid, GST_STATE (sink)); instead. That would only change the state in the case that the code one day gets called in a state higher than READY.
Fixed in CVS: 2007-05-25 Jan Schmidt <thaytan@mad.scientist.com> * gst/autodetect/gstautoaudiosink.c: (gst_auto_audio_sink_detect): Don't unnecessarily perform a READY->NULL->READY transition on the detected audio sink when starting up. Fixes: #440127