From 7db48587ba86708f4d1284014e07c88de044b2d4 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Thu, 17 Nov 2011 11:47:59 -0800 Subject: 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 --- pcm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pcm.c') 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; -- cgit v1.2.3