diff options
author | Eric Laurent <elaurent@google.com> | 2011-11-17 11:47:59 -0800 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-11-17 13:14:46 -0800 |
commit | 7db48587ba86708f4d1284014e07c88de044b2d4 (patch) | |
tree | 19294c37030bf0d850ea52bc87afb5c1159300f9 | |
parent | ee9ba87d9b964eb518a836c848907b1c83991e93 (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
-rw-r--r-- | pcm.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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; |