aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordvdli <dvdli@google.com>2021-01-28 11:53:30 +0800
committerdvdli <dvdli@google.com>2021-01-28 14:25:40 +0800
commitc0f924738de2b8f5478e8b454b4ad5521802f3f6 (patch)
treecc0248f32f5e6c7afee5b098d416c846cf435c04 /src
parentb618ec79a1fde67594d7361c5fdc07d74a464951 (diff)
prepare in pcm_generic_transfer
Diffstat (limited to 'src')
-rw-r--r--src/pcm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pcm.c b/src/pcm.c
index 8678919..3d7da0c 100644
--- a/src/pcm.c
+++ b/src/pcm.c
@@ -1637,6 +1637,10 @@ static int pcm_generic_transfer(struct pcm *pcm, void *data,
if (frames > INT_MAX)
return -EINVAL;
+ if (pcm_state(pcm) == PCM_STATE_SETUP && pcm_prepare(pcm) != 0) {
+ return -1;
+ }
+
again:
if (pcm->flags & PCM_MMAP)