summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMisael Lopez Cruz <misael.lopez@ti.com>2014-12-04 11:28:58 -0600
committerMisael Lopez Cruz <misael.lopez@ti.com>2014-12-04 11:37:44 -0600
commitd9b0b9552b694d9a77cb044d090d5f61ec502295 (patch)
tree56edd6db2edf39331170bd5daca3f1565704fffc
parentef9d7cc3ff081453fd7a30e7fa135e3bdef644f9 (diff)
downloadjacinto6evm-d9b0b9552b694d9a77cb044d090d5f61ec502295.tar.gz
audio: Legacy: Use pcm_update_avail for voice input frames
The pcm input stream is said to be "steady" when the ALSA buffer has available frames to read. However, the input stream could go into the XRUN state when the voice thread takes too long between explicitly starting the stream and querying the number of available frames. For the purpose of determining whether the input stream is ready, the XRUN state means that the ALSA buffer is full and the audio frames can be read immediately. The number of available frames was previously queried using the pcm_get_htimestamp() function which returns an error when the stream is in overrun state and doesn't update the number of available frames. The pcm_update_avail() function does return the amount of available frames regardless of the stream state. Change-Id: I3afbb6f3d274b5f4fbd7133e48d2cbe51c223ccc Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
-rw-r--r--audio/legacy/audio_hw.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/audio/legacy/audio_hw.c b/audio/legacy/audio_hw.c
index e9763f0..12459e5 100644
--- a/audio/legacy/audio_hw.c
+++ b/audio/legacy/audio_hw.c
@@ -418,7 +418,6 @@ static void *voice_thread_func(void *arg)
{
struct j6_voice_stream *stream = (struct j6_voice_stream *)arg;
struct j6_audio_device *adev = stream->dev;
- struct timespec now;
size_t frames = stream->out_frames;
uint32_t periods = 0;
uint32_t avail;
@@ -437,8 +436,8 @@ static void *voice_thread_func(void *arg)
stream->out_buffer,
&frames);
} else {
- ret = pcm_get_htimestamp(stream->pcm_in, &avail, &now);
- if (!ret && (avail > 0)) {
+ avail = pcm_avail_update(stream->pcm_in);
+ if (avail > 0) {
in_steady = true;
continue;
}