After recovery the pcm device can be in prepared state. To continue capturing data
the device must be put into running state again, hence the call to snd_pcm_start().
{
msg_Warn (demux, "cannot read samples: %s",
snd_strerror (frames));
- continue;
+ snd_pcm_state_t state = snd_pcm_state (pcm);
+ switch (state)
+ {
+ case SND_PCM_STATE_PREPARED:
+ val = snd_pcm_start (pcm);
+ if (val < 0)
+ {
+ msg_Err (demux, "cannot prepare device: %s",
+ snd_strerror (val));
+ return NULL;
+ }
+ continue;
+ case SND_PCM_STATE_RUNNING:
+ continue;
+ default:
+ break;
+ }
}
msg_Err (demux, "cannot recover record stream: %s",
snd_strerror (val));