]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/platform-external-tinyalsa.git/blobdiff - pcm.c
am 1b32ddfd: Update to latest tinyalsa
[android-sdk/platform-external-tinyalsa.git] / pcm.c
diff --git a/pcm.c b/pcm.c
index f499a05d6c3bcb1151ccd20b2813ba753b430a5e..9324f384143a533a23cfca3898fc226973e73d82 100644 (file)
--- a/pcm.c
+++ b/pcm.c
@@ -341,7 +341,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;
@@ -550,9 +551,14 @@ struct pcm *pcm_open(unsigned int card, unsigned int device,
         sparams.start_threshold = config->start_threshold;
 
     /* pick a high stop threshold - todo: does this need further tuning */
-    if (!config->stop_threshold)
-        pcm->config.stop_threshold = sparams.stop_threshold =
-            config->period_count * config->period_size;
+    if (!config->stop_threshold) {
+        if (pcm->flags & PCM_IN)
+            pcm->config.stop_threshold = sparams.stop_threshold =
+                config->period_count * config->period_size * 10;
+        else
+            pcm->config.stop_threshold = sparams.stop_threshold =
+                config->period_count * config->period_size;
+    }
     else
         sparams.stop_threshold = config->stop_threshold;