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
This commit is contained in:
Eric Laurent
2011-11-17 11:47:59 -08:00
committed by Simon Wilson
parent ee9ba87d9b
commit 7db48587ba
+2 -1
View File
@@ -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;