summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisael Lopez Cruz2014-12-04 11:28:58 -0600
committerMisael Lopez Cruz2014-12-04 11:37:44 -0600
commitd9b0b9552b694d9a77cb044d090d5f61ec502295 (patch)
tree56edd6db2edf39331170bd5daca3f1565704fffc /audio/legacy
parentef9d7cc3ff081453fd7a30e7fa135e3bdef644f9 (diff)
downloaddevice-ti-jacinto6evm-d9b0b9552b694d9a77cb044d090d5f61ec502295.tar.gz
device-ti-jacinto6evm-d9b0b9552b694d9a77cb044d090d5f61ec502295.tar.xz
device-ti-jacinto6evm-d9b0b9552b694d9a77cb044d090d5f61ec502295.zip
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>
Diffstat (limited to 'audio/legacy')
-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)
418{ 418{
419 struct j6_voice_stream *stream = (struct j6_voice_stream *)arg; 419 struct j6_voice_stream *stream = (struct j6_voice_stream *)arg;
420 struct j6_audio_device *adev = stream->dev; 420 struct j6_audio_device *adev = stream->dev;
421 struct timespec now;
422 size_t frames = stream->out_frames; 421 size_t frames = stream->out_frames;
423 uint32_t periods = 0; 422 uint32_t periods = 0;
424 uint32_t avail; 423 uint32_t avail;
@@ -437,8 +436,8 @@ static void *voice_thread_func(void *arg)
437 stream->out_buffer, 436 stream->out_buffer,
438 &frames); 437 &frames);
439 } else { 438 } else {
440 ret = pcm_get_htimestamp(stream->pcm_in, &avail, &now); 439 avail = pcm_avail_update(stream->pcm_in);
441 if (!ret && (avail > 0)) { 440 if (avail > 0) {
442 in_steady = true; 441 in_steady = true;
443 continue; 442 continue;
444 } 443 }