Skip to content

Commit ea5d2c5

Browse files
James DongAndroid (Google) Code Review
authored andcommitted
Merge "When read() from AudioRecord returns 0 or negative value, report an error to application. DO NOT MERGE." into gingerbread
2 parents a482d83 + 8a1a0fd commit ea5d2c5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

media/libstagefright/AudioSource.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,10 @@ status_t AudioSource::read(
287287
}
288288

289289
ssize_t n = mRecord->read(buffer->data(), buffer->size());
290-
if (n < 0) {
290+
if (n <= 0) {
291+
LOGE("Read from AudioRecord returns: %ld", n);
291292
buffer->release();
292-
return (status_t)n;
293+
return UNKNOWN_ERROR;
293294
}
294295

295296
int64_t recordDurationUs = (1000000LL * n >> 1) / sampleRate;

0 commit comments

Comments
 (0)