diff options
author | Jaroslav Kysela <perex@perex.cz> | 2010-11-18 09:27:07 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2010-11-18 09:27:07 +0100 |
commit | ba9332e9192814a5431a3a2505d25d74a9232124 (patch) | |
tree | a37c9f6e76d05f6c20d2bd8f246df6aa3d4d5256 | |
parent | 7c99bd24bcf6852d55e90e0f42f7ac5ea8f14fbb (diff) |
pcm: fix snd_pcm_avail_delay() function
For capture stream, the delay must be obtained as last, but we need to
update the ring buffer pointers for the avail_update call. So, rearrange
the code a bit and add hwsync call as first.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r-- | src/pcm/pcm.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index f378779a..74099438 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -2470,18 +2470,22 @@ int snd_pcm_avail_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) { snd_pcm_sframes_t sf; + int err; assert(pcm && availp && delayp); if (CHECK_SANITY(! pcm->setup)) { SNDMSG("PCM not set up"); return -EIO; } - sf = pcm->fast_ops->delay(pcm->fast_op_arg, delayp); - if (sf < 0) - return (int)sf; + err = pcm->fast_ops->hwsync(pcm->fast_op_arg); + if (err < 0) + return err; sf = pcm->fast_ops->avail_update(pcm->fast_op_arg); if (sf < 0) return (int)sf; + err = pcm->fast_ops->delay(pcm->fast_op_arg, delayp); + if (err < 0) + return err; *availp = sf; return 0; } |