diff options
author | Alexander E. Patrakov <patrakov@gmail.com> | 2014-09-15 20:17:47 +0600 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2014-09-16 19:26:20 +0200 |
commit | 048568bbea700dfd9921b40321f8d5aa7e5ef417 (patch) | |
tree | 2374a3ef6e394847c93a9c11aadb6740ef94fbb8 | |
parent | 650b8c975cd5c3f7dca6e78e74db587b57bcdfd8 (diff) | |
download | alsa-lib-048568bbea700dfd9921b40321f8d5aa7e5ef417.tar.gz |
pcm, rate: hw_avail must not be negative before starting the stream
If it is, then it means most likely the driver problem, so we should
return error immediately instead.
Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r-- | src/pcm/pcm_rate.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index 736d5583..c76db25b 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -1069,7 +1069,10 @@ static int snd_pcm_rate_start(snd_pcm_t *pcm) gettimestamp(&rate->trigger_tstamp, pcm->tstamp_type); avail = snd_pcm_mmap_playback_hw_avail(rate->gen.slave); - if (avail <= 0) { + if (avail < 0) /* can't happen on healthy drivers */ + return -EBADFD; + + if (avail == 0) { /* postpone the trigger since we have no data committed yet */ rate->start_pending = 1; return 0; |