AnsweredAssumed Answered

GStreamer audio pipeline hangs

Question asked by Daniel Morgan on Jul 10, 2014
Latest reply on Nov 26, 2014 by Daniel Morgan

Hi all,


I'm using i.MX6Q (with Freescale's BSP 3.0.35) and having issues with a GStreamer audio pipeline hanging in an infinite loop.

I have i.MX6Q as the I2S slave sending out an audio stream to an external device set as the I2S master.

Audio is streamed through the alsasink element without any problems until the external device stops the I2S clock.


When the I2S clock stops, the alsasink element keeps trying to write pcm buffers left in the pipeline (gstalsasink.c: gst_alsasink_write: snd_pcm_writei).

The pcm ring buffer in the kernel eventually becomes full, and returns EAGAIN (sound/core/pcm_lib.c: snd_pcm_lib_write1).

Upon receiving EAGAIN, the alsasink element retries indefinitely thinking that a buffer would free up eventually.

Obviously, a buffer is never going to free up since the kernel cannot write out the remaining pcm buffers when the I2S clock stops.

Once in this state, I cannot stop the pipeline since it is stuck in an infinite loop.


Are there any suggestions in overcoming this?

Currently, the best way I can think of is change the kernel code so that the remaining pcm buffers are thrown away when the I2S clock stops.

I checked the kernel source code contained in BSP 3.10.17, but it looks like the issue will still be present.


Any help would be greatly appreciated.