summaryrefslogtreecommitdiffstats
path: root/libaudio
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2010-10-20 14:04:28 -0700
committerEric Laurent <elaurent@google.com>2010-10-20 14:04:28 -0700
commite2db396bbde79109dd373cbd1f4d738773944de8 (patch)
tree823b8192c306e3e0baf1cf73e6e2de58626be505 /libaudio
parentb04161d0dbfe7234197da747a495ae5b4d70fc44 (diff)
downloaddevice_samsung_crespo-e2db396bbde79109dd373cbd1f4d738773944de8.zip
device_samsung_crespo-e2db396bbde79109dd373cbd1f4d738773944de8.tar.gz
device_samsung_crespo-e2db396bbde79109dd373cbd1f4d738773944de8.tar.bz2
Fix issue 3113477.
Fix problem in audio HAL AudioStreamInALSA::read() function when the down sampler is used and a read error from kernel driver occurs: the requested frame count should be reset before calling the resampler again otherwise we loop for ever requesting 0 frames. Change-Id: Ie85f7a1db4e417f5c1d97c0f0e0f5a28a62ee92a
Diffstat (limited to 'libaudio')
-rwxr-xr-xlibaudio/AudioHardwareALSA.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/libaudio/AudioHardwareALSA.cpp b/libaudio/AudioHardwareALSA.cpp
index 4df3c42..86a6f30 100755
--- a/libaudio/AudioHardwareALSA.cpp
+++ b/libaudio/AudioHardwareALSA.cpp
@@ -1627,6 +1627,7 @@ ssize_t AudioStreamInALSA::read(void *buffer, ssize_t bytes)
} else {
n = status;
}
+ frames = snd_pcm_bytes_to_frames(mHandle, bytes);
} else {
n = frames;
}
@@ -1736,7 +1737,7 @@ status_t AudioStreamInALSA::getNextBuffer(ALSABufferProvider::Buffer* buffer)
(uint8_t *)mPcmIn +
(mInPcmInBuf * mDefaults->channelCount * sizeof(int16_t)),
PERIOD_SZ_CAPTURE - mInPcmInBuf);
- if (mReadStatus <= 0) {
+ if (mReadStatus < 0) {
buffer->raw = NULL;
buffer->frameCount = 0;
LOGV("resampler read error %d", mReadStatus);
@@ -2452,7 +2453,7 @@ int ALSADownsampler::resample(int16_t* out, size_t *outFrameCount)
}
if (out == NULL || outFrameCount == NULL) {
- return mStatus;
+ return BAD_VALUE;
}
int16_t *outLeft = mTmp2Left;