GNOME Bugzilla – Bug 759227
ring buffer state is still GST_AUDIO_RING_BUFFER_STATE_ERROR after changing element state from null to ready failed.
Last modified: 2015-12-11 08:00:03 UTC
try to setup a pipeline of which the source is alsasrc. when set pipeline state to playing, the alsasrc device is not ready and we got a resource error, the state change failed. after this the state of audiosrcringbuffer is GST_AUDIO_RING_BUFFER_STATE_ERROR. then we set pipeline state to null and try to set the pipeline state to play again, this time the alsa src device is ready and open is success. but we still get an internal flow error as the ring buffer is not created again, the state is still GST_AUDIO_RING_BUFFER_STATE_ERROR. simply use following modification to help understanding this problem: ===========================code=============================== static GstStateChangeReturn gst_audio_base_src_change_state (GstElement * element, GstStateChange transition) { GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; GstAudioBaseSrc *src = GST_AUDIO_BASE_SRC (element); switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: GST_DEBUG_OBJECT (src, "NULL->READY"); GST_OBJECT_LOCK (src); + if (src->ringbuffer != NULL) { + gst_object_unparent (GST_OBJECT_CAST (src->ringbuffer)); + src->ringbuffer = NULL; + } if (src->ringbuffer == NULL) { gst_audio_clock_reset (GST_AUDIO_CLOCK (src->clock), 0); src->ringbuffer = gst_audio_base_src_create_ringbuffer (src); }
Why is this happening? in READY_TO_NULL the ringbuffer would be destroyed so if you set the state back to NULL after an error there shouldn't be a problem.
Hi, when changing state from NULL to ready, the device open operation failed, so the state of audiobasesrc is still NULL, so when set state to NULL, the element didn't do READY_TO_NULL transition.
http://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/gst-libs/gst/audio/gstaudiobasesrc.c#n1146 You mean this here fails? Then src->ringbuffer should already be NULL.
Hi, It's happening in version 1.0. I checked version 1.6, there should not be such problem as ringbuffer is always initialised in NULL_TO_READY.