static ssize_t snd_compr_read(struct file *f, char __user *buf, size_t count, loff_t *offset) {
- return -ENXIO;
- struct snd_compr_file *data = f->private_data;
- struct snd_compr_stream *stream;
- size_t avail;
- int retval;
- if (snd_BUG_ON(!data))
return -EFAULT;
- stream = &data->stream;
- mutex_lock(&stream->device->lock);
- /* read is allowed when stream is running */
- if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING) {
retval = -EBADFD;
goto out;
minor one but shouldnt we allow read even when we have stoped or paused the stream. Stop is important as you might want to get all buffers after you have stopped.
Yes, looks like a bug to me. Not sure that it's a blocker - new feature so nobody is going to be using this immediately. As you can't capture sounds from the future(!) the DSP could only hold data up to the point you stopped/paused. But the DSP could have some audio packets queued that it hasn't sent to host yet and you still need to read them. You'd probably not have much queued anyway as it would be disturbing for user if they monitor recording through their device headphones and it has significant latency from the real world sounds?