summaryrefslogtreecommitdiffstats
path: root/services/audioflinger
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2012-09-13 11:44:00 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2012-09-13 12:02:15 -0700
commit4362f5300162ed55f56cf167eccf7f2e5b89d435 (patch)
tree5d7fe2df5bd8f2797e0dc2bf4dd66f658cf4d972 /services/audioflinger
parent66466087f464b641c8c09b195891a9713a554900 (diff)
downloadframeworks_av-4362f5300162ed55f56cf167eccf7f2e5b89d435.zip
frameworks_av-4362f5300162ed55f56cf167eccf7f2e5b89d435.tar.gz
frameworks_av-4362f5300162ed55f56cf167eccf7f2e5b89d435.tar.bz2
Handle audio HAL returning 0 bytes in record thread
Enter standby when HAL returns an error, but also consider 0 bytes returned as NOT_ENOUGH_DATA. Change-Id: Ica83142310e9c176f936e0440571a6034cbc575f
Diffstat (limited to 'services/audioflinger')
-rw-r--r--services/audioflinger/AudioFlinger.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index a44fb3e..582ab65 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -5984,7 +5984,7 @@ bool AudioFlinger::RecordThread::threadLoop()
inputStandBy();
acquireWakeLock();
- // used to verify we've read at least one before evaluating how many bytes were read
+ // used to verify we've read at least once before evaluating how many bytes were read
bool readOnce = false;
// start recording
@@ -6499,9 +6499,9 @@ status_t AudioFlinger::RecordThread::getNextBuffer(AudioBufferProvider::Buffer*
if (framesReady == 0) {
mBytesRead = mInput->stream->read(mInput->stream, mRsmpInBuffer, mInputBytes);
- if (mBytesRead < 0) {
- ALOGE("RecordThread::getNextBuffer() Error reading audio input");
- if (mActiveTrack->mState == TrackBase::ACTIVE) {
+ if (mBytesRead <= 0) {
+ if ((mBytesRead < 0) && (mActiveTrack->mState == TrackBase::ACTIVE)) {
+ ALOGE("RecordThread::getNextBuffer() Error reading audio input");
// Force input into standby so that it tries to
// recover at next read attempt
inputStandBy();