Playback states

Let's consider the state transitions for a PCM device during playback.

Figure 1. State diagram for PCM devices during playback.

In the figure above, the oval groups the Underrun, Error, and Unsecure states together to indicate that each state can transition to the Prepared state

The transition between SND_PCM_STATUS_* states is the result of executing an API call, or the result of conditions that occur in the hardware:

From To Cause
NOTREADY READY Calling snd_pcm_channel_params() or snd_pcm_plugin_params()
READY PREPARED Calling snd_pcm_channel_prepare(), snd_pcm_playback_prepare(), or snd_pcm_plugin_prepare()
PREPARED RUNNING Calling snd_pcm_write() or snd_pcm_plugin_write()
RUNNING PAUSED Calling snd_pcm_channel_pause() or snd_pcm_playback_pause()
PAUSED RUNNING Calling snd_pcm_channel_resume() or snd_pcm_playback_resume()
RUNNING UNDERRUN The hardware buffer became empty during playback
RUNNING UNSECURE The application marked the stream as protected, the hardware level supports a secure transport (e.g., HDCP for HDMI), and authentication was lost
RUNNING CHANGE The stream changed
RUNNING ERROR A hardware error occurred
UNDERRUN, UNSECURE, CHANGE, or ERROR PREPARED Calling snd_pcm_channel_prepare(), snd_pcm_playback_prepare(), or snd_pcm_plugin_prepare()
RUNNING PREEMPTED Audio is blocked because another libasound session has initiated playback, and the audio driver has determined that that session has higher priority

For more details on these transitions, see the description of each function in the Audio Library chapter.