aboutsummaryrefslogtreecommitdiff
path: root/pcm.c
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-11-17 11:47:59 -0800
committerSimon Wilson <simonwilson@google.com>2011-11-17 13:14:46 -0800
commit7db48587ba86708f4d1284014e07c88de044b2d4 (patch)
tree19294c37030bf0d850ea52bc87afb5c1159300f9 /pcm.c
parentee9ba87d9b964eb518a836c848907b1c83991e93 (diff)
pcm: more state checking in pcm_get_htimestamp()
pcm_get_htimestamp() should return an error if stream state is not running or draining as the time stamp returned by the driver is not valid in other states. Change-Id: Icdfe9554b26f57119d7a8d762a6ea6e8e3eaf370
Diffstat (limited to 'pcm.c')
-rw-r--r--pcm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pcm.c b/pcm.c
index 461eb5a..010d054 100644
--- a/pcm.c
+++ b/pcm.c
@@ -333,7 +333,8 @@ int pcm_get_htimestamp(struct pcm *pcm, unsigned int *avail,
if (rc < 0)
return -1;
- if (pcm->mmap_status->state == PCM_STATE_XRUN)
+ if ((pcm->mmap_status->state != PCM_STATE_RUNNING) &&
+ (pcm->mmap_status->state != PCM_STATE_DRAINING))
return -1;
*tstamp = pcm->mmap_status->tstamp;