This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ALSA/Audio overrun errors on with 8168/Linux

Hello everyone,

We've noticed that there has been some on and off activity on the topic
of 'ALSA/Audio overrun errors' in the forums but no definitive solution
or workaround that we've seen.

Our questions are:

  Question 1) What's causing this?

  Question 2) How can we fix it or work around it?


We've recently had a chance to start looking into this problem with audio capture
overrun errors being reported from our application which is loosely based on
the audio_encode application delivered with earlier SDKs.

In particular, the problem is coming from the the A8-side capture of audio
via the ALSA subsystem and is not related to the DSP or the encoding of the
audio samples.

We've managed to track the location to the linux kernel file: 

    $KERNEL/sound/core/pcm_lib.c (at approximately line #437).

Specifically, when the problem occurs, the check for:

    if (delta > runtime->period_size + runtime->period_size / 2) { /*** ... ***/ }

is being flagged in the function snd_pcm_update_hw_ptr0(...).

Since there's an actual check for this in the kernel [note the "Lost interrupts?" hw_ptr_error()
condition] it seems like someone must have noticed this too and at least tried to
detect it.


THINGS we've tried but that didn't work:

We've tried getting rid of the video capture to see if it was a CPU loading issue
on the A8 (i.e.: removed the OpenMax video components execution from the A8 side)
with no change in the symptoms.

We've tried running the audio data transfer with a different asp_chan_q
(EVENTQ_1 vs EVENTQ_2) to see if it makes any difference. (It didn't.)

The forum traffic seems to implicate McASP/DMA interrupt issues. Since we've
"peeled-off" most of everything else and we still see this it is becoming a
concern for the project.

   Question 3) Is there any tweaking/tuning that we may be missing?

Thanks for reading and we would appreciate any insights anyone may have.

Juan Solis

 

  • We have also tried bumping-up the priority of the "audio-capture" task. This helped but it's still not reliable.

    We've lowered the sampling rate from 48kHz stereo to 16kHz sterea. This also helped but we still get overruns

    though we see less of them.

    We've also marked the MMC device as non-removable based on another post in another forum that hinted that

    the kernel might be too busy trying to poll for the MMC device being removed. In our case it won't so it doesn't hurt

    for us to mark it as non-removable. This didn't seem to make any difference for us.

     

    Juan Solis

     

  • Bump.

    I've also tried everything you've done....still no luck. Any chance there's been a solution for this found?

    Craig

  • Are you using PulseAudio by any chance?

  • Hi All,

    I met the similar issue...

    After look into the alsa driver and enable alsa debug(CONFIG_SND_DEBUG=y, CONFIG_SND_PCM_XRUN_DEBUG=y)

    And enable xrun_debug(XRUN_DEBUG_BASIC)

    # echo 1 > /proc/asound/card0/pcm0c/xrun_debug

    Sometimes the error print out as below:

    # PCM: Lost interrupts? (stream=1, delta=32705, new_hw_ptr=19407936, old_hw_ptr=19375231)

    And the audio time stamp is wrong...

    Then I enable xrun_debug level to (XRUN_DEBUG_BASIC and XRUN_DEBUG_JIFFIESCHECK)

    messages as below...

    # PCM: hw_ptr skipping! (pos=22592, delta=32705, period=1024, jdelta=0/74/0, hw_ptr=16996479/16996479)

    Enable XRUN_DEBUG_JIFFIESCHECK will enable PCM hw_ptr_jiffies check and it will filter the invalid hw_ptr.

    It seems audio DMA issues? low level driver return wrong DMA position value?

    Thanks a lot.

    BR

    Steven