Opened 6 years ago

#2177 new defect

Playback freezes due to audio buffer underrun in ALSA output

Reported by: kbrenneman Owned by:
Priority: normal Component: ao
Version: unspecified Severity: blocker
Keywords: Cc:
Blocked By: Blocking:
Reproduced by developer: no Analyzed by developer: no


If a buffer underrun occurs when using ALSA output, mplayer doesn't recover from it.

The function get_space is libao2/ao_alsa.c uses snd_pcm_status_get_avail to see how much room is available in the buffer. After an underrun, snd_pcm_status_get_avail will always return zero.

The result is that playback freezes: Mplayer spins in its event loop, waiting for more room in the audio buffer, which never happens.

Seeking forward or backward is usually enough to get it going again.

How to reproduce:

% mplayer -ao alsa input

Any file should work as long as it has video and audio. The problem is hard to reproduce, though, because you need a delay big enough to drain the whole audio buffer.

The easiest way I've found to reproduce it is to add a sleep call to the event loop.

Change History (0)

Note: See TracTickets for help on using tickets.