After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 759227 - ring buffer state is still GST_AUDIO_RING_BUFFER_STATE_ERROR after changing element state from null to ready failed.
ring buffer state is still GST_AUDIO_RING_BUFFER_STATE_ERROR after changing e...
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
1.0.0
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
https://bugzilla.gnome.org/show_bug.c...
Depends on:
Blocks:
 
 
Reported: 2015-12-09 07:05 UTC by Yang
Modified: 2015-12-11 08:00 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Yang 2015-12-09 07:05:18 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);
      }
Comment 1 Sebastian Dröge (slomo) 2015-12-09 09:21:38 UTC
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.
Comment 2 Yang 2015-12-10 01:07:43 UTC
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.
Comment 3 Sebastian Dröge (slomo) 2015-12-10 08:19:54 UTC
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.
Comment 4 Yang 2015-12-11 02:08:01 UTC
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.