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>
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;
}