Let's consider the state transitions for PCM devices during capture.
The state diagram for a PCM device during capture is shown below.
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_capture_prepare(), snd_pcm_channel_prepare(), or snd_pcm_plugin_prepare() |
PREPARED | RUNNING | Calling snd_pcm_read() or snd_pcm_plugin_read(), or calling select() against the capture file descriptors |
RUNNING | PAUSED | Calling snd_pcm_capture_pause() or snd_pcm_channel_pause() |
PAUSED | RUNNING | Calling snd_pcm_capture_resume() or snd_pcm_channel_resume() |
RUNNING | OVERRUN | The hardware buffer became full during capture; snd_pcm_read() and snd_pcm_plugin_read() fail |
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 |
OVERRUN, UNSECURE, CHANGE, or ERROR | PREPARED | Calling snd_pcm_capture_prepare(), snd_pcm_channel_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.