Skip to content

Commit 8a1a0fd

Browse files
author
James Dong
committed
When read() from AudioRecord returns 0 or negative value, report an error to application. DO NOT MERGE.
Change-Id: I3a66fd0ed3f6b90350d706a608a39d8b4a398e32 related-to-bug: 4195127
1 parent 7544b23 commit 8a1a0fd

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)