Merge "When read() from AudioRecord returns 0 or negative value, report an error to application. DO NOT MERGE." into gingerbread

This commit is contained in:
James Dong
2011-03-31 11:20:40 -07:00
committed by Android (Google) Code Review

View File

@@ -287,9 +287,10 @@ status_t AudioSource::read(
}
ssize_t n = mRecord->read(buffer->data(), buffer->size());
if (n < 0) {
if (n <= 0) {
LOGE("Read from AudioRecord returns: %ld", n);
buffer->release();
return (status_t)n;
return UNKNOWN_ERROR;
}
int64_t recordDurationUs = (1000000LL * n >> 1) / sampleRate;